Skip to content
Snippets Groups Projects

ENH: Add retrieval and queries to Extern C interface

Merged Florian Spreckelsen requested to merge f-extended-c into f-files
2 unresolved threads
3 files
+ 52
5
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 125
24
 
/*
 
* This file is a part of the CaosDB Project.
 
* Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
 
* Copyright (C) 2021 Florian Spreckelsen <f.spreckelsen@indiscale.com>
 
* Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
 
*
 
* This program is free software: you can redistribute it and/or
 
* modify it under the terms of the GNU Affero General Public License
 
* as published by the Free Software Foundation, either version 3 of
 
* the License, or (at your option) any later version.
 
*
 
* This program is distributed in the hope that it will be useful, but
 
* WITHOUT ANY WARRANTY; without even the implied warranty of
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
* Affero General Public License for more details.
 
*
 
* You should have received a copy of the GNU Affero General Public
 
* License along with this program. If not, see
 
* <https://www.gnu.org/licenses/>.
 
*
 
*/
#ifdef __cplusplus
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
#endif
@@ -31,6 +52,12 @@ int caosdb_constants_COMPATIBLE_SERVER_VERSION_PATCH();
@@ -31,6 +52,12 @@ int caosdb_constants_COMPATIBLE_SERVER_VERSION_PATCH();
*/
*/
const char *caosdb_constants_COMPATIBLE_SERVER_VERSION_PRE_RELEASE();
const char *caosdb_constants_COMPATIBLE_SERVER_VERSION_PRE_RELEASE();
 
/**
 
* Return the status code reserved for errors in clients wrapping this
 
* interface.
 
*/
 
int caosdb_status_code_OTHER_CLIENT_ERROR();
 
/**
/**
* A wrapper of the C++ Connection class.
* A wrapper of the C++ Connection class.
*
*
@@ -40,6 +67,7 @@ const char *caosdb_constants_COMPATIBLE_SERVER_VERSION_PRE_RELEASE();
@@ -40,6 +67,7 @@ const char *caosdb_constants_COMPATIBLE_SERVER_VERSION_PRE_RELEASE();
*/
*/
typedef struct {
typedef struct {
void *wrapped_connection;
void *wrapped_connection;
 
bool _deletable = false;
} caosdb_connection_connection;
} caosdb_connection_connection;
/**
/**
@@ -51,6 +79,7 @@ typedef struct {
@@ -51,6 +79,7 @@ typedef struct {
*/
*/
typedef struct {
typedef struct {
void *wrapped_connection_configuration;
void *wrapped_connection_configuration;
 
bool _deletable = false;
} caosdb_connection_connection_configuration;
} caosdb_connection_connection_configuration;
/**
/**
@@ -70,10 +99,12 @@ typedef struct {
@@ -70,10 +99,12 @@ typedef struct {
typedef struct {
typedef struct {
void *wrapped_certificate_provider;
void *wrapped_certificate_provider;
 
bool _deletable = false;
} caosdb_connection_certificate_provider;
} caosdb_connection_certificate_provider;
typedef struct {
typedef struct {
void *wrapped_authenticator;
void *wrapped_authenticator;
 
bool _deletable = false;
} caosdb_authentication_authenticator;
} caosdb_authentication_authenticator;
/**
/**
@@ -242,62 +273,77 @@ int caosdb_connection_connection_manager_get_connection(
@@ -242,62 +273,77 @@ int caosdb_connection_connection_manager_get_connection(
// not sufficient yet.
// not sufficient yet.
typedef struct {
typedef struct {
void *wrapped_transaction;
void *wrapped_transaction;
 
bool _deletable = false;
} caosdb_transaction_transaction;
} caosdb_transaction_transaction;
 
/**
 
* Create a transaction on an existing connection.
 
*
 
* This transaction has to be deleted manually by
 
* caosdb_transaction_delete_transaction() later on.
 
*/
int caosdb_connection_connection_create_transaction(
int caosdb_connection_connection_create_transaction(
caosdb_connection_connection *connection,
caosdb_connection_connection *connection,
caosdb_transaction_transaction *out);
caosdb_transaction_transaction *out);
 
int caosdb_transaction_delete_transaction(
 
caosdb_transaction_transaction *transaction);
int caosdb_transaction_transaction_retrieve_by_id(
int caosdb_transaction_transaction_retrieve_by_id(
caosdb_transaction_transaction *transaction, const char *id);
caosdb_transaction_transaction *transaction, const char *id);
 
int caosdb_transaction_transaction_retrieve_by_ids(
 
caosdb_transaction_transaction *transaction, const char *ids[], int length);
 
int caosdb_transaction_transaction_query(
 
caosdb_transaction_transaction *transaction, const char *query);
int caosdb_transaction_transaction_execute(
int caosdb_transaction_transaction_execute(
caosdb_transaction_transaction *transaction);
caosdb_transaction_transaction *transaction);
 
// TODO(fspreck) execute_asynchronously may be added as a separate
 
// function once we actually support asynchronous execution.
typedef struct {
typedef struct {
void *wrapped_result_set;
void *wrapped_result_set;
 
bool _deletable = false;
} caosdb_transaction_result_set;
} caosdb_transaction_result_set;
int caosdb_transaction_transaction_get_result_set(
int caosdb_transaction_transaction_get_result_set(
caosdb_transaction_transaction *transaction,
caosdb_transaction_transaction *transaction,
caosdb_transaction_result_set *out);
caosdb_transaction_result_set *out);
 
int caosdb_transaction_transaction_get_count_result(
 
caosdb_transaction_transaction *transaction, long *out);
 
typedef struct {
typedef struct {
void *wrapped_entity;
void *wrapped_entity;
char **id;
bool _deletable = false;
char **role;
char **name;
char **description;
char **datatype;
char **unit;
char **value;
char **version_id;
} caosdb_entity_entity;
} caosdb_entity_entity;
int caosdb_transaction_result_set_get_entity(
int caosdb_transaction_result_set_at(caosdb_transaction_result_set *result_set,
caosdb_transaction_result_set *result_set, caosdb_entity_entity *entity,
caosdb_entity_entity *entity, int index);
int index);
int caosdb_transaction_result_set_size(
 
caosdb_transaction_result_set *result_set, int *out);
typedef struct {
typedef struct {
void *wrapped_property;
void *wrapped_property;
char **id;
bool _deletable = false;
char **name;
char **description;
char **datatype;
char **unit;
char **value;
} caosdb_entity_property;
} caosdb_entity_property;
typedef struct {
typedef struct {
void *wrapped_parent;
void *wrapped_parent;
char **id;
bool _deletable = false;
char **name;
char **description;
} caosdb_entity_parent;
} caosdb_entity_parent;
typedef struct {
typedef struct {
void *wrapped_message;
void *wrapped_message;
int *code;
bool _deletable = false;
char **description;
} caosdb_entity_message;
} caosdb_entity_message;
// GETTERS FOR COMPLEX OBJECTS
// GETTERS FOR EVERYTHING
 
int caosdb_entity_entity_get_id(caosdb_entity_entity *entity, char *out);
 
int caosdb_entity_entity_get_role(caosdb_entity_entity *entity, char *out);
 
int caosdb_entity_entity_get_name(caosdb_entity_entity *entity, char *out);
 
int caosdb_entity_entity_get_description(caosdb_entity_entity *entity,
 
char *out);
 
int caosdb_entity_entity_get_datatype(caosdb_entity_entity *entity, char *out);
 
int caosdb_entity_entity_get_unit(caosdb_entity_entity *entity, char *out);
 
int caosdb_entity_entity_get_value(caosdb_entity_entity *entity, char *out);
 
int caosdb_entity_entity_get_version_id(caosdb_entity_entity *entity,
 
char *out);
int caosdb_entity_entity_get_errors_size(caosdb_entity_entity *entity,
int caosdb_entity_entity_get_errors_size(caosdb_entity_entity *entity,
int *out);
int *out);
int caosdb_entity_entity_get_error(caosdb_entity_entity *entity,
int caosdb_entity_entity_get_error(caosdb_entity_entity *entity,
@@ -318,6 +364,29 @@ int caosdb_entity_entity_get_parents_size(caosdb_entity_entity *entity,
@@ -318,6 +364,29 @@ int caosdb_entity_entity_get_parents_size(caosdb_entity_entity *entity,
int caosdb_entity_entity_get_parent(caosdb_entity_entity *entity,
int caosdb_entity_entity_get_parent(caosdb_entity_entity *entity,
caosdb_entity_parent *out, int index);
caosdb_entity_parent *out, int index);
 
int caosdb_entity_property_get_id(caosdb_entity_property *property, char *out);
 
int caosdb_entity_property_get_name(caosdb_entity_property *property,
 
char *out);
 
int caosdb_entity_property_get_description(caosdb_entity_property *property,
 
char *out);
 
int caosdb_entity_property_get_importance(caosdb_entity_property *property,
 
char *out);
 
int caosdb_entity_property_get_datatype(caosdb_entity_property *property,
 
char *out);
 
int caosdb_entity_property_get_unit(caosdb_entity_property *property,
 
char *out);
 
int caosdb_entity_property_get_value(caosdb_entity_property *property,
 
char *out);
 
 
int caosdb_entity_parent_get_id(caosdb_entity_parent *parent, char *out);
 
int caosdb_entity_parent_get_name(caosdb_entity_parent *parent, char *out);
 
int caosdb_entity_parent_get_description(caosdb_entity_parent *parent,
 
char *out);
 
 
int caosdb_entity_message_get_code(caosdb_entity_message *message, int *out);
 
int caosdb_entity_message_get_description(caosdb_entity_message *message,
 
char *out);
 
// CONSTRUCTORS AND DESTRUCTORS
// CONSTRUCTORS AND DESTRUCTORS
int caosdb_entity_create_entity(caosdb_entity_entity *out);
int caosdb_entity_create_entity(caosdb_entity_entity *out);
int caosdb_entity_delete_entity(caosdb_entity_entity *out);
int caosdb_entity_delete_entity(caosdb_entity_entity *out);
@@ -326,11 +395,43 @@ int caosdb_entity_delete_property(caosdb_entity_property *out);
@@ -326,11 +395,43 @@ int caosdb_entity_delete_property(caosdb_entity_property *out);
int caosdb_entity_create_parent(caosdb_entity_parent *out);
int caosdb_entity_create_parent(caosdb_entity_parent *out);
int caosdb_entity_delete_parent(caosdb_entity_parent *out);
int caosdb_entity_delete_parent(caosdb_entity_parent *out);
// SETTERS FOR COMPLEX OBJECTS
// SETTERS FOR EVERYTHING THAT MAY BE SET
 
int caosdb_entity_entity_set_role(caosdb_entity_entity *entity,
 
const char *role);
 
int caosdb_entity_entity_set_name(caosdb_entity_entity *entity,
 
const char *name);
 
int caosdb_entity_entity_set_description(caosdb_entity_entity *entity,
 
const char *description);
 
int caosdb_entity_entity_set_datatype(caosdb_entity_entity *entity,
 
const char *datatype);
 
int caosdb_entity_entity_set_unit(caosdb_entity_entity *entity,
 
const char *unit);
 
int caosdb_entity_entity_set_value(caosdb_entity_entity *entity,
 
const char *value);
int caosdb_entity_entity_append_parent(caosdb_entity_entity *entity,
int caosdb_entity_entity_append_parent(caosdb_entity_entity *entity,
caosdb_entity_parent *parent);
caosdb_entity_parent *parent);
 
int caosdb_entity_entity_remove_parent(caosdb_entity_entity *entity, int index);
int caosdb_entity_entity_append_property(caosdb_entity_entity *entity,
int caosdb_entity_entity_append_property(caosdb_entity_entity *entity,
caosdb_entity_property *property);
caosdb_entity_property *property);
 
int caosdb_entity_entity_remove_property(caosdb_entity_entity *entity,
 
int index);
 
 
int caosdb_entity_property_set_id(caosdb_entity_property *property,
 
const char *id);
 
int caosdb_entity_property_set_name(caosdb_entity_property *property,
 
const char *name);
 
int caosdb_entity_property_set_datatype(caosdb_entity_property *property,
 
const char *datatype);
 
int caosdb_entity_property_set_importance(caosdb_entity_property *property,
 
const char *importance);
 
int caosdb_entity_property_set_unit(caosdb_entity_property *property,
 
const char *unit);
 
int caosdb_entity_property_set_value(caosdb_entity_property *property,
 
const char *value);
 
 
int caosdb_entity_parent_set_id(caosdb_entity_parent *parent, const char *id);
 
int caosdb_entity_parent_set_name(caosdb_entity_parent *parent,
 
const char *name);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
Loading