Template Class EntityWithSources¶
Defined in File EntityWithSources.hpp
Inheritance Relationships¶
Base Type¶
public nix::base::EntityWithMetadata< T >
(Template Class EntityWithMetadata)
Class Documentation¶
-
template<typename T>
class EntityWithSources : public nix::base::EntityWithMetadata<T>¶ Base class for entities that can be associated with one or more sources.
In order to describe the provenance of data some entities of the NIX data model can be associated with nix::Source entities. This class serves as a base class for those.
Public Functions
-
inline EntityWithSources()¶
Constructor that creates a null entity.
Constructor that creates a new entity from a shared pointer to an implementation instance.
Constructor with move semantics that creates a new entity from a shared pointer to an implementation instance.
-
inline ndsize_t sourceCount() const¶
Get the number of sources associated with this entity.
- Returns
The number sources.
-
inline bool hasSource(const std::string &id) const¶
Checks if a specific source is associated with this entity.
- Parameters
id – The source id to check.
- Returns
True if the source is associated with this entity, false otherwise.
-
inline bool hasSource(const Source &source) const¶
Checks if a specific source is associated with this entity.
- Parameters
source – The source to check.
- Returns
True if the source is associated with this entity, false otherwise.
-
inline Source getSource(const std::string &id) const¶
Returns an associated source identified by its id.
- Parameters
id – The id of the associated source.
-
inline Source getSource(const size_t index) const¶
Retrieves an associated source identified by its index.
- Parameters
index – The index of the associated source.
- Returns
The source with the given id. If it doesn’t exist an exception will be thrown.
-
inline std::vector<Source> sources(util::Filter<Source>::type filter = util::AcceptAll<Source>()) const¶
Get all sources associated with this entity.
The parameter filter can be used to filter sources by various criteria. By default a filter that accepts all sources is used.
- Parameters
filter – A filter function.
- Returns
All associated sources that match the given filter as a vector
-
inline virtual void sources(const std::vector<Source> &sources)¶
Set all sources associations for this entity.
All previously existing associations will be overwritten.
- Parameters
sources – A vector with all sources.
-
inline void addSource(const std::string &id)¶
Associate a new source with the entity.
If a source with the given id already is associated with the entity, the call will have no effect.
- Parameters
id – The id of the source.
-
inline void addSource(const Source &source)¶
Associate a new source with the entity.
Calling this method will have no effect if the source is already associated to this entity.
- Parameters
source – The source to add.
-
inline bool removeSource(const std::string &id)¶
Remove a source from the list of associated sources.
This method just removes the association between the entity and the source. The source itself will not be deleted from the file.
- Parameters
id – The id of the source to remove.
- Returns
True if the source was removed, false otherwise.
-
inline bool removeSource(const Source &source)¶
Remove a source from the list of associated sources.
This method just removes the association between the entity and the source. The source itself will not be deleted from the file.
- Parameters
source – The source to remove.
- Returns
True if the source was removed, false otherwise.
-
inline virtual ~EntityWithSources()¶
Destructor
-
inline EntityWithSources()¶