Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
f9147bbd
Commit
f9147bbd
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
DRAFT: Begin datatype creators and destructors
parent
b0d5af32
No related branches found
No related tags found
1 merge request
!24
API: Introduce value and datatype structs to Extern C
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/ccaosdb.h
+5
-1
5 additions, 1 deletion
include/ccaosdb.h
src/ccaosdb.cpp
+32
-0
32 additions, 0 deletions
src/ccaosdb.cpp
with
37 additions
and
1 deletion
include/ccaosdb.h
+
5
−
1
View file @
f9147bbd
...
...
@@ -441,7 +441,11 @@ 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
);
// TODO(fspreck) implementations, also list_datatypes, list_values...
int
caosdb_entity_create_datatype
(
caosdb_entity_datatype
*
out
);
// DATATYPE CONSTRUCTORS for atomic and reference datatypes and lists thereof
int
caosdb_entity_create_atomic_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
);
int
caosdb_entity_create_reference_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
);
int
caosdb_entity_create_atomic_list_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
);
int
caosdb_entity_create_reference_list_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
);
int
caosdb_entity_delete_datatype
(
caosdb_entity_datatype
*
out
);
// VALUE CONSTRUCTORS (resolve overloaded constructors)
int
caosdb_entity_create_int_value
(
caosdb_entity_value
*
out
,
const
int64_t
value
);
...
...
This diff is collapsed.
Click to expand it.
src/ccaosdb.cpp
+
32
−
0
View file @
f9147bbd
...
...
@@ -48,6 +48,8 @@ extern "C" {
#define WRAPPED_MESSAGE_CAST(name) static_cast<caosdb::entity::Message *>(name->wrapped_message)
#define WRAPPED_DATATYPE_CAST(name) static_cast<caosdb::entity::Datatype *>(name->wrapped_datatype)
#define WRAPPED_VALUE_CAST(name) static_cast<caosdb::entity::AbstractValue *>(name->wrapped_value)
#define ENUM_NAME_FROM_VALUE(arg, etype) \
...
...
@@ -56,6 +58,11 @@ extern "C" {
#define ENUM_VALUE_FROM_NAME(arg, etype) \
caosdb::utility::getEnumValueFromName<caosdb::entity::etype>(arg)
#define RETURN_ASSIGNEMENT_ERROR_IF_DELETABLE(name) \
if (name->_deletable) { \
return caosdb::StatusCode::EXTERN_C_ASSIGNMENT_ERROR; \
}
/*
* Macro for wrapping every function into a try-catch clause. If an exception
* occurs, the given StatusCode is being returned.
...
...
@@ -683,6 +690,31 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_delete_parent(caosdb_entity_p
return
0
;
})
ERROR_RETURN_CODE
(
GENERIC_ERROR
,
int
caosdb_entity_create_atomic_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
),
{})
ERROR_RETURN_CODE
(
GENERIC_ERROR
,
int
caosdb_entity_create_reference_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
),
{})
ERROR_RETURN_CODE
(
GENERIC_ERROR
,
int
caosdb_entity_create_atomic_list_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
),
{})
ERROR_RETURN_CODE
(
GENERIC_ERROR
,
int
caosdb_entity_create_reference_list_datatype
(
caosdb_entity_datatype
*
out
,
const
char
*
name
),
{})
ERROR_RETURN_CODE
(
GENERIC_ERROR
,
int
caosdb_entity_delete_datatype
(
caosdb_entity_datatype
*
out
),
{
if
(
out
->
_deletable
)
{
delete
WRAPPED_DATATYPE_CAST
(
out
);
}
out
->
_deletable
=
false
;
return
0
;
})
CREATE_VALUE
(
int_value
,
const
int64_t
value
)
CREATE_VALUE
(
string_value
,
const
char
*
value
)
CREATE_VALUE
(
double_value
,
const
double
value
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment