Template Class Entity

Inheritance Relationships

Base Type

Derived Type

Class Documentation

template<typename T>
class Entity : public nix::base::ImplContainer<T>

A class serving as base class for most entities of the NIX data model.

Most entities defined by the NIX data model share some common properties. Among those an unique identifier id with low collision probability. The id allows to identify individual entities even across large collection of data spread over multiple files. Further all entities provide a the properties createdAt and updatedAt containing information about the creation time and the last modification time.

Subclassed by nix::base::NamedEntity< T >

Public Functions

inline Entity()

Constructor that creates a null entity.

inline Entity(const std::shared_ptr<T> &p_impl)

Constructor that creates a new entity from a shared pointer to an implementation instance.

inline Entity(std::shared_ptr<T> &&ptr)

Constructor with move semantics that creates a new entity from a shared pointer to an implementation instance.

inline std::string id() const

Getter for the id of the entity.

The id is generated at creation time of an entity. It contains a randomly generated sequence of characters with low collision probability.

Returns

The id of the entity.

inline time_t updatedAt() const

Gets the time of the last update.

Returns

Time of the last update.

inline time_t createdAt() const

Gets the creation time.

Returns

The creation time of the entity.

inline void setUpdatedAt()

Sets the time of the last update to the current time if the field is not set.

inline void forceUpdatedAt()

Sets the time of the last update to the current time.

inline void setCreatedAt()

Sets the creation time to the current time if the creation time is not set.

inline void forceCreatedAt(time_t t)

Sets the creation time to the provided value even if the field is already set.

Parameters

t – The creation time to set.

inline bool isValidEntity() const
inline virtual ~Entity()

Destructor.