Skip to content
Snippets Groups Projects
Verified Commit 32c34cd6 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: specify c-interface

parent f19ea58c
No related branches found
No related tags found
1 merge request!4ENH: Allow insertion and deletion of single entities
Pipeline #10941 passed
Pipeline: caosdb-cppinttest

#10943

    #ifdef __cplusplus
    extern "C" {
    #else
    #include <stdbool.h>
    #endif
    /**
    ......@@ -236,6 +234,104 @@ int caosdb_connection_connection_manager_get_default_connection(
    int caosdb_connection_connection_manager_get_connection(
    caosdb_connection_connection *out, const char *name);
    /****************************************************************************
    * ENTITY STUFF AND TRANSACTIONS
    ****************************************************************************/
    // TODO(fspreck) implementations needed, and probably these declarations are
    // not sufficient yet.
    typedef struct {
    void *wrapped_transaction;
    } caosdb_transaction_transaction;
    int caosdb_connection_connection_create_transaction(
    caosdb_connection_connection *connection,
    caosdb_transaction_transaction *out);
    int caosdb_transaction_transaction_retrieve_by_id(
    caosdb_transaction_transaction *transaction, const char *id);
    int caosdb_transaction_transaction_execute(
    caosdb_transaction_transaction *transaction);
    typedef struct {
    void *wrapped_result_set;
    } caosdb_transaction_result_set;
    int caosdb_transaction_transaction_get_result_set(
    caosdb_transaction_transaction *transaction,
    caosdb_transaction_result_set *out);
    typedef struct {
    void *wrapped_entity;
    char **id;
    char **role;
    char **name;
    char **description;
    char **datatype;
    char **unit;
    char **value;
    char **version_id;
    } caosdb_entity_entity;
    int caosdb_transaction_result_set_get_entity(
    caosdb_transaction_result_set *result_set, caosdb_entity_entity *entity,
    int index);
    typedef struct {
    void *wrapped_property;
    char **id;
    char **name;
    char **description;
    char **datatype;
    char **unit;
    char **value;
    } caosdb_entity_property;
    typedef struct {
    void *wrapped_parent;
    char **id;
    char **name;
    char **description;
    } caosdb_entity_parent;
    typedef struct {
    void *wrapped_message;
    int *code;
    char **description;
    } caosdb_entity_message;
    // GETTERS FOR COMPLEX OBJECTS
    int caosdb_entity_entity_get_errors_size(caosdb_entity_entity *entity,
    int *out);
    int caosdb_entity_entity_get_error(caosdb_entity_entity *entity,
    caosdb_entity_message *out, int index);
    int caosdb_entity_entity_get_warnings_size(caosdb_entity_entity *entity,
    int *out);
    int caosdb_entity_entity_get_warning(caosdb_entity_entity *entity,
    caosdb_entity_message *out, int index);
    int caosdb_entity_entity_get_infos_size(caosdb_entity_entity *entity, int *out);
    int caosdb_entity_entity_get_info(caosdb_entity_entity *entity,
    caosdb_entity_message *out, int index);
    int caosdb_entity_entity_get_properties_size(caosdb_entity_entity *entity,
    int *out);
    int caosdb_entity_entity_get_property(caosdb_entity_entity *entity,
    caosdb_entity_property *out, int index);
    int caosdb_entity_entity_get_parents_size(caosdb_entity_entity *entity,
    int *out);
    int caosdb_entity_entity_get_parent(caosdb_entity_entity *entity,
    caosdb_entity_parent *out, int index);
    // CONSTRUCTORS AND DESTRUCTORS
    int caosdb_entity_create_entity(caosdb_entity_entity *out);
    int caosdb_entity_delete_entity(caosdb_entity_entity *out);
    int caosdb_entity_create_property(caosdb_entity_property *out);
    int caosdb_entity_delete_property(caosdb_entity_property *out);
    int caosdb_entity_create_parent(caosdb_entity_parent *out);
    int caosdb_entity_delete_parent(caosdb_entity_parent *out);
    // SETTERS FOR COMPLEX OBJECTS
    int caosdb_entity_entity_append_parent(caosdb_entity_entity *entity,
    caosdb_entity_parent *parent);
    int caosdb_entity_entity_append_property(caosdb_entity_entity *entity,
    caosdb_entity_property *property);
    #ifdef __cplusplus
    }
    #endif
    ......@@ -506,8 +506,6 @@ auto ConfigurationManager::InitializeDefaults() -> int {
    // ... and use the configuration file
    if (configuration_file_path != nullptr) {
    mLoadSingleJSONConfiguration(*configuration_file_path);
    CAOSDB_LOG_INFO(logger_name)
    << "Loaded configuration from" << *(configuration_file_path.get()) << ".";
    }
    if (this->json_configuration.is_object() &&
    ......@@ -518,7 +516,14 @@ auto ConfigurationManager::InitializeDefaults() -> int {
    logging::initialize_logging(logging_configuration);
    } else {
    logging::initialize_logging_defaults();
    CAOSDB_LOG_WARN(logger_name) << "No configuration has been found.";
    CAOSDB_LOG_INFO(logger_name) << "No logging configuration has been found. "
    "We are using the default configuration";
    }
    if (configuration_file_path != nullptr &&
    this->json_configuration.is_object()) {
    CAOSDB_LOG_INFO(logger_name) << "Loaded configuration from "
    << *(configuration_file_path.get()) << ".";
    }
    return 0;
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment