Skip to content
Snippets Groups Projects

F consolidation

Merged Timm Fitschen requested to merge f-consolidation into dev
Files
11
+ 23
0
@@ -19,6 +19,13 @@
*
*/
/**
* DataTypes have 2 dimensions: They may be atomic or reference typed, and they
* may be scalar or list valued. If they are atomic, they have an
* AtomicDataType. If they are reference typed, the reference name can be
* obtained with GetName().
*/
#ifndef CAOSDB_DATA_TYPE_H
#define CAOSDB_DATA_TYPE_H
#include "caosdb/protobuf_helper.h" // for ProtoMessageWrapper
@@ -144,6 +151,22 @@ public:
DataType(const std::string &data_type) : DataType() {
this->wrapped->mutable_reference_data_type()->set_name(data_type);
}
inline static auto ListOf(const AtomicDataType &atomic_data_type)
-> DataType {
DataType result;
result.wrapped->mutable_list_data_type()->set_atomic_data_type(
static_cast<ProtoAtomicDataType>(atomic_data_type));
return result;
}
inline static auto ListOf(const std::string reference_data_type) -> DataType {
DataType result;
result.wrapped->mutable_list_data_type()
->mutable_reference_data_type()
->set_name(reference_data_type);
return result;
}
[[nodiscard]] inline auto IsAtomic() const noexcept -> bool {
return this->wrapped->data_type_case() == DataTypeCase::kAtomicDataType;
}
Loading