diff --git a/include/ccaosdb.h b/include/ccaosdb.h index b9296349b6f9592bed9e60362ae4848faf95a649..4d1b99dd151fbf09a53d9b80c0963ee3d3368c67 100644 --- a/include/ccaosdb.h +++ b/include/ccaosdb.h @@ -412,6 +412,7 @@ int caosdb_entity_parent_get_description(caosdb_entity_parent *parent, char **ou int caosdb_entity_message_get_code(caosdb_entity_message *message, int *out); int caosdb_entity_message_get_description(caosdb_entity_message *message, char **out); +int caosdb_entity_datatype_is_undefined(caosdb_entity_datatype *datatype, bool *out); int caosdb_entity_datatype_is_atomic(caosdb_entity_datatype *datatype, bool *out); int caosdb_entity_datatype_is_reference(caosdb_entity_datatype *datatype, bool *out); int caosdb_entity_datatype_is_list_of_atomic(caosdb_entity_datatype *datatype, bool *out); diff --git a/src/ccaosdb.cpp b/src/ccaosdb.cpp index a18c56d90a2b72449ef7fcb60c0dd3e79603dafc..77759fce1d216f215dfccd343aa8202b2ec911fa 100644 --- a/src/ccaosdb.cpp +++ b/src/ccaosdb.cpp @@ -991,6 +991,14 @@ ERROR_RETURN_CODE( return 0; }) +ERROR_RETURN_CODE(GENERIC_ERROR, + int caosdb_entity_datatype_is_undefined(caosdb_entity_datatype *datatype, + bool *out), + { + auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); + *out = wrapped_datatype->IsUndefined(); + return 0; + }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_datatype_is_atomic(caosdb_entity_datatype *datatype, bool *out), { diff --git a/test/test_ccaosdb.cpp b/test/test_ccaosdb.cpp index d5b894b8c37eb747b9e13739ced8b1643a6f59ed..1059f161525d513389efd4df95cdd04ec5a088db 100644 --- a/test/test_ccaosdb.cpp +++ b/test/test_ccaosdb.cpp @@ -150,6 +150,9 @@ TEST_F(test_ccaosdb, test_datatype) { EXPECT_EQ(return_code, 0); bool is_a(false); + return_code = caosdb_entity_datatype_is_undefined(&atomic, &is_a); + EXPECT_EQ(return_code, 0); + EXPECT_FALSE(is_a); return_code = caosdb_entity_datatype_is_atomic(&atomic, &is_a); EXPECT_EQ(return_code, 0); EXPECT_TRUE(is_a);