linkahead/data_type.h

namespace linkahead
namespace entity

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().

MessageCodes for entity messages.

In contrast to the status codes, the message codes are part of the LinkAhead API. Messages (and their codes) represent the state of the entities in a transaction or the server.

For a specification of the message codes, look at the protobuf documentation. The sources and documentation can be found at https://gitlab.indiscale.com/caosdb/src/caosdb-proto.

Typedefs

using ProtoAtomicDataType = caosdb::entity::v1::AtomicDataType
typedef caosdb::entity::v1::DataType ProtoDataType
using ProtoListDataType = caosdb::entity::v1::ListDataType
using ProtoReferenceDataType = caosdb::entity::v1::ReferenceDataType
using DataTypeCase = caosdb::entity::v1::DataType::DataTypeCase
using ListDataTypeCase = caosdb::entity::v1::ListDataType::ListDataTypeCase

Enums

enum AtomicDataType

Values:

enumerator UNSPECIFIED
enumerator TEXT
enumerator DOUBLE
enumerator DATETIME
enumerator INTEGER
enumerator BOOLEAN

Variables

const std::map<AtomicDataType, std::string> atomicdatatype_names = {{AtomicDataType::UNSPECIFIED, "UNSPECIFIED"}, {AtomicDataType::TEXT, "TEXT"}, {AtomicDataType::DOUBLE, "DOUBLE"}, {AtomicDataType::DATETIME, "DATETIME"}, {AtomicDataType::INTEGER, "INTEGER"}, {AtomicDataType::BOOLEAN, "BOOLEAN"}}
class DataType : public linkahead::utility::ScalarProtoMessageWrapper<ProtoDataType>

Public Functions

inline DataType(const DataType &other)

Copy constructor.

inline DataType(DataType &&other)

Move constructor.

inline DataType(ProtoDataType *wrapped)
inline DataType()
inline DataType(AtomicDataType data_type, bool list_type = false)

Create an AtomicDataType typed DataType. For references, use the std::string constructor.

inline DataType(const std::string &data_type, bool list_type = false)

Create a reference typed DataType.

~DataType() = default
inline auto IsUndefined() const noexcept -> bool
inline auto IsAtomic() const noexcept -> bool
inline auto GetAsAtomic() const noexcept -> AtomicDataType
inline auto IsReference() const noexcept -> bool
inline auto GetAsReference() const noexcept -> const ReferenceDataType&
inline auto IsList() const noexcept -> bool
inline auto GetAsList() const noexcept -> const ListDataType&
inline auto operator==(const DataType &other) const noexcept -> bool

Return true if other is equal to this object.

This compares the underlying wrapped ProtoMessages and return true if they are both nullptrs or if the serialization is equal.

inline auto operator=(const DataType &other) -> DataType&

Copy assignment operator.

inline auto operator=(DataType &&other) -> DataType&

Move assignment operator.

Public Static Functions

static inline auto ListOf(const AtomicDataType &atomic_data_type) -> DataType
static inline auto ListOf(const std::string reference_data_type) -> DataType

Protected Attributes

mutable std::unique_ptr<ReferenceDataType> reference_data_type
mutable std::unique_ptr<ListDataType> list_data_type

Friends

friend class Entity
friend class Property
class ListDataType : public linkahead::utility::ScalarProtoMessageWrapper<ProtoDataType>

Public Functions

inline auto IsListOfReference() const noexcept -> bool
inline auto GetReferenceDataType() const -> const ReferenceDataType&
inline auto IsListOfAtomic() const noexcept -> bool
inline auto GetAtomicDataType() const -> AtomicDataType

Protected Functions

inline ListDataType()
inline ListDataType(ProtoDataType *wrapped)

Protected Attributes

mutable std::unique_ptr<ReferenceDataType> reference_data_type

Protected Static Functions

static inline auto GetEmptyInstance() -> const ListDataType&
static inline auto Create(ProtoDataType *wrapped) -> std::unique_ptr<ListDataType>

Friends

friend class DataType
class ReferenceDataType : public linkahead::utility::ScalarProtoMessageWrapper<ProtoDataType>

Public Functions

inline auto GetName() const noexcept -> const std::string&
inline auto GetWrapped() const -> const ProtoDataType*

Protected Functions

inline ReferenceDataType()
inline ReferenceDataType(ProtoDataType *wrapped)

Protected Static Functions

static inline auto GetEmptyInstance() -> const ReferenceDataType&
static inline auto Create(ProtoDataType *wrapped) -> std::unique_ptr<ReferenceDataType>

Friends

friend class DataType
friend class ListDataType