Class Property

Inheritance Relationships

Base Type

Class Documentation

class Property : public nix::base::Entity<base::IProperty>

Class representing an odML property entity.

In the odML model information is stored in the form of extended key-value pairs. A Property contains information that is valid for all Values stored in it. Its dataType provides information about the type of the stored Value entities (e.g. double or integer).

The unit is the unit of the stored values. Similar to the nix::Section entity

Public Functions

inline Property()

Constructor that creates an uninitialized Property.

Calling any method on an uninitialized property will throw a nix::UninitializedEntity exception. The following code illustrates how to check if a property is initialized:

Property e = ...;
if (e) {
    // e is initialised
} else {
    // e is uninitialized
}

inline Property(const Property &other)

Copy constructor.

Copying of all NIX front facing objects like Property is a rather cheap operation. Semantically this is equivalent to the creation of another reference to the original object.

Parameters

other – The property to copy.

inline Property(const std::shared_ptr<base::IProperty> &p_impl)

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

This constructor should only be used in the back-end.

inline Property(std::shared_ptr<base::IProperty> &&ptr)

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

This constructor should only be used in the back-end.

inline std::string name() const

Getter for the name of the property.

The name of an property serves as a human readable identifier. It is not obliged to be unique. However it is strongly recommended to use unique name inside one specific nix::Section.

Returns

string The name of the property.

void definition(const std::string &definition)

Setter for the definition of the property.

Parameters

definition – The definition of the property.

inline boost::optional<std::string> definition() const

Getter for the definition of the property.

The definition is an optional property that allows the user to add a freely assignable textual definition to the property.

Returns

The definition of the property.

inline void definition(const none_t t)

Deleter for the definition of the property.

inline DataType dataType() const

Returns the data type of the stored Values.

Returns

The data type.

inline void uncertainty(double uncertainty)

Set the uncertainty (e.g. the standard deviation) related to the stored values.

Parameters

uncertainty – The uncertainty

inline boost::optional<double> uncertainty() const

Returns the uncertainty (e.g . the standard deviation) of the stored value.

Returns

The uncertainty.

inline void uncertainty(const boost::none_t t)

Remove the uncertainty.

Parameters

t – None

void unit(const std::string &unit)

Set the unit for all stored values.

Parameters

unit – The unit for all values.

inline boost::optional<std::string> unit() const

Returns the unit for all stored values.

Returns

The unit for all values.

inline void unit(const boost::none_t t)

Remove the unit.

Parameters

t – None

inline void deleteValues()

Deletes all values from the property.

inline ndsize_t valueCount() const

Get the number of values of the property.

Returns

The number of values.

inline void values(const std::vector<Variant> &values)

Set the values of the property.

Parameters

values – The values to set.

inline std::vector<Variant> values(void) const

Get all values of the property.

Returns

The values of the property.

inline void values(const boost::none_t t)

Deletes all values from the property.

int compare(const Property &other) const

Compare two properties.

Parameters

other – The property to compare with.

Returns

> 0 if the property is larger that other, 0 if both are equal, and < 0 otherwise.

inline Property &operator=(const none_t &t)

Assignment operator for none.

inline Property &operator=(const Property &other)

Copy-assignment operator.

inline virtual ~Property()

Destructor.

Friends

friend NIXAPI friend std::ostream & operator<< (std::ostream &out, const Property &ent)

Output operator.