Properties

class Properties

Manage custom properties (sites, bonds, etc), typically for use in plugins. There is a performance cost associated with accessing the properties by name. But accessing the values by index should be done carefully.

Public Functions

void add(const std::string name, const double value)

Add a new value/name combination.

void add_or_set(const std::string name, const double value)

Add a new value and name, or set its value if name exists.

void set(const std::string name, const double value)

Set the value of property name.

double value(const std::string name) const

Return property value by name.

bool value(const std::string name, double *value) const

Return true if property name exists, and its value.

bool value(const std::string name, double *value, int *index) const

Return true if property name exists, and its value and index.

bool has(const std::string name) const

Return true if property name exists.

void check() const

Check that the property values and names are consistent.

const std::vector<std::string> &names() const

Return all property names.

const std::vector<double> &values() const

Return all property values.

void set_value(const int index, const double value)

Set value of property by index.

std::string str() const

Return the properties as a human readable string.

int num() const

Return the number of properties.

bool is_equal(const Properties &properties, const double tolerance) const

Return true if the properties are equivalent within tolerance.

bool is_equal(const Properties &properties) const

Same as above, but with a default tolerance of NEAR_ZERO.

class PropertiedEntity

Subclassed by feasst::Bond, feasst::Group, feasst::ModelParams, feasst::Particle, feasst::Site

Public Functions

virtual void add_property(const std::string name, const double value)

Add a new property.

void add_or_set_property(const std::string name, const double value)

Add a property, or set its value if name already exists.

void set_property(const std::string name, const double value)

Set the value of an existing property.

const Properties &properties() const

Return properties.

double property(const std::string name) const

Return the property value by name.

bool has_property(const std::string name) const

Return true if entity has property of name.

void set_property(const int index, const double value)

Set value of property by index.

void set_properties(const Properties &properties)

Set the properties.