Class Source¶
Defined in File Source.hpp
Inheritance Relationships¶
Base Type¶
public nix::base::EntityWithMetadata< base::ISource >
(Template Class EntityWithMetadata)
Class Documentation¶
-
class Source : public nix::base::EntityWithMetadata<base::ISource>¶
A class that describes the provenance of other entities of the NIX data model.
The Source is conceptually a rather simple entity. I t is used to note the provenance of the data and offers the opportunity to bind additional metadata. One special feature of the Source is the possibility to contain other sources as children thus building up a tree of sources. This can, for example, be used to specify that a source electrode array contains multiple electrodes as its child sources.
Public Functions
-
Source()¶
Constructor that creates an uninitialized Source.
Calling any method on an uninitialized source will throw a nix::UninitializedEntity exception. The following code illustrates how to check if a source is initialized:
Source e = ...; if (e) { // e is initialised } else { // e is uninitialized }
-
Source(const Source &other)¶
Copy constructor.
Copying of all NIX front facing objects like Source is a rather cheap operation. Semantically this is equivalent to the creation of another reference to the original object.
- Parameters
other – The source to copy.
Constructor that creates a new source from a shared pointer to an implementation instance.
This constructor should only be used in the back-end.
Constructor with move semantics that creates a new source from a shared pointer to an implementation instance.
This constructor should only be used in the back-end.
-
inline bool hasSource(const std::string &name_or_id) const¶
Checks if this source has a specific source as direct descendant.
- Parameters
name_or_id – The name or id of the source.
- Returns
True if a source with the given name/id is a direct descendant, false otherwise.
-
bool hasSource(const Source &source) const¶
Checks if this source has a specific source as direct descendant.
- Parameters
source – The Source.
- Returns
True if a source is a direct descendant, false otherwise.
-
inline Source getSource(const std::string &name_or_id) const¶
Retrieves a specific child source that is a direct descendant.
- Parameters
name_or_id – The name or id of the source.
- Returns
The source with the given name/id. If it doesn’t exist an exception will be thrown.
-
inline Source getSource(ndsize_t index) const¶
Retrieves a specific source by index.
- Parameters
index – The index of the source.
- Returns
The source at the specified index.
-
inline ndsize_t sourceCount() const¶
Returns the number of sources that are direct descendants of this source.
- Returns
The number of direct child sources.
-
std::vector<Source> sources(const util::Filter<Source>::type &filter = util::AcceptAll<Source>()) const¶
Get all direct child sources associated with this source.
The parameter filter can be used to filter sources by various criteria. By default a filter is used that accepts all sources.
- Parameters
filter – A filter function.
- Returns
A vector containing the matching child sources.
-
std::vector<Source> findSources(const util::Filter<Source>::type &filter = util::AcceptAll<Source>(), size_t max_depth = std::numeric_limits<size_t>::max()) const¶
Get all descendant sources of the source recursively.
This method traverses the sub-tree of all child sources of the source. The traversal is accomplished via breadth first and can be limited in depth. On each node or source a filter is applied. If the filter returns true the respective source will be added to the result list. By default a filter is used that accepts all sources.
- Parameters
filter – A filter function.
max_depth – The maximum depth of traversal.
- Returns
A vector containing the matching descendant sources.
-
Source createSource(const std::string &name, const std::string &type)¶
Create a new root source.
- Parameters
name – The name of the source to create.
type – The type of the source.
- Returns
The created source object.
-
inline bool deleteSource(const std::string &name_or_id)¶
Delete a root source and all its child sources from the source.
- Parameters
name_or_id – The name or id of the source to remove.
- Returns
True if the source was deleted, false otherwise.
-
bool deleteSource(const Source &source)¶
Delete a root source and all its child sources from the source.
- Parameters
source – The Source to delete.
- Returns
True if the source was deleted, false otherwise.
-
nix::Source parentSource() const¶
Returns the parent Source of this Source. Method performs a search, may thus not be the most efficient way.
-
std::vector<nix::DataArray> referringDataArrays() const¶
Returns all DataArrays that refer to this Source.
- Returns
std::vector of DataArrays.
-
std::vector<nix::Tag> referringTags() const¶
Returns all Tags that refer to this Source.
- Returns
std::vector of Tags.
Friends
- friend NIXAPI friend std::ostream & operator<< (std::ostream &out, const Source &ent)
Output operator.
-
Source()¶