FiReS
0.2.0
FiReS - Filter, Retrieval and Search
|
A class to represent objects that can be used in fires. More...
#include <Object.h>
Public Member Functions | |
Object () | |
Default constructor. | |
Object (const Object &object) | |
Copy constructor. | |
virtual | ~Object () |
Destructor. | |
void | registerProperty (const std::string &label, const Property &property) |
Register a property to this object. More... | |
bool | unregisterProperty (const std::string &label) |
Unregister a property of this object. More... | |
Property & | getProperty (const std::string &label) |
Get a property of this object. More... | |
const Property & | getProperty (const std::string &label) const |
Get a property of this object as const. More... | |
template<class ValueType > | |
ValueType | getPropertyValue (const std::string &propertyLabel, const ValueType defaultValue) const |
Get a property value of this object. More... | |
template<class ValueType > | |
ValueType | getPropertyValue (const std::string &propertyLabel) const |
Get a property value of this object. More... | |
Property & | operator[] (const std::string &label) |
Get a property of this object. More... | |
bool | setProperty (const std::string &label, const Property &property) |
Set a property of this object. More... | |
bool | hasProperty (const std::string &label) const |
Queries if a property has been registered in this object. More... | |
void | clearProperties (void) |
Clears the properties of this object (no memory freeing) | |
ObjectProperties & | properties (void) |
Get all properties. More... | |
const ObjectProperties & | properties (void) const |
Get all properties as const. More... | |
std::string & | label (void) |
Get a reference to the label of the object. More... | |
const std::string & | label (void) const |
Get the label of the object as const. More... | |
void | serialize (std::ostream &stream, bool minimizeStream=true, const std::string &linePrefix="") const |
Serialize this object properties. More... | |
void | deserialize (std::istream &stream) |
Reads and loads this object properties stream containing JSON from which data will be loaded. | |
void | deserialize (const boost::property_tree::ptree &root) |
Reads and loads this object properties boost JSON root object from which data will be loaded. | |
Operators | |
Object & | operator= (const Object &other) |
Protected Attributes | |
ObjectProperties | _properties |
Set of properties of this object. | |
std::string | _label |
Label of this object. | |
A class to represent objects that can be used in fires.
This class provides access to object properties and properties
Property& fires::Object::getProperty | ( | const std::string & | label | ) |
Get a property of this object.
label | label string to retrieve the property |
const Property& fires::Object::getProperty | ( | const std::string & | label | ) | const |
Get a property of this object as const.
label | label string to retrieve the property |
|
inline |
|
inline |
bool fires::Object::hasProperty | ( | const std::string & | label | ) | const |
Queries if a property has been registered in this object.
label | label string to retrieve the property |
std::string& fires::Object::label | ( | void | ) |
Get a reference to the label of the object.
const std::string& fires::Object::label | ( | void | ) | const |
Get the label of the object as const.
Property& fires::Object::operator[] | ( | const std::string & | label | ) |
Get a property of this object.
label | label string to retrieve the property |
ObjectProperties& fires::Object::properties | ( | void | ) |
Get all properties.
const ObjectProperties& fires::Object::properties | ( | void | ) | const |
Get all properties as const.
void fires::Object::registerProperty | ( | const std::string & | label, |
const Property & | property | ||
) |
Register a property to this object.
label | label string for the property |
property | property to be added |
Referenced by fires::PropertyManager::registerProperty().
void fires::Object::serialize | ( | std::ostream & | stream, |
bool | minimizeStream = true , |
||
const std::string & | linePrefix = "" |
||
) | const |
Serialize this object properties.
stream | to write the object |
linePrefix | prefix at the start of every line |
bool fires::Object::setProperty | ( | const std::string & | label, |
const Property & | property | ||
) |
Set a property of this object.
label | label string to retrieve the property |
property | property to be setted |
bool fires::Object::unregisterProperty | ( | const std::string & | label | ) |
Unregister a property of this object.
label | label of the property to be deleted |