VOS::Property Class Reference
[libmetaobject_property]
#include <vos/metaobjects/property/property.hh>
Inheritance diagram for VOS::Property:

Detailed Description
Property stores data of any type and size.
Definition at line 43 of file property.hh.
Public Member Functions
- virtual int getLength ()=0
- virtual void read (std::string &target)=0
- virtual void read (std::string &target, int start, int length)=0
- virtual std::string read ()=0
- virtual std::string read (int start, int length)=0
- virtual void write (int start, const std::string &newdata)=0
- virtual void replace (const std::string &newdata, const std::string &newtype="?")=0
- virtual const std::string getDataType ()=0
- virtual void setPriority (Message::Priority p)
- virtual Message::Priority getPriority ()
- virtual void addPropertyListener (PropertyListener *pl, bool refresh=true)=0
- virtual void removePropertyListener (PropertyListener *pl)=0
- void writeToFile (const std::string &filename, int offset=0, int length=-1)
- void readFromFile (const std::string &filename, const std::string &type="")
- virtual const std::string getVOSType ()=0
- Return MetaObject type, "property".
- Return MetaObject type, "property".
- virtual void doSaveState (MessageBlock &output, std::set< std::string > &types, bool portable)
- virtual void cacheProperty (bool b)
- void replace (const char *format, size_t maxlen,...)
- void replace (const char *format, const char *type, size_t maxlen,...)
- void replace (const char *str)
- void read (const char *format,...)
- void replace (bool b)
- void replace (int i)
- void replace (float x)
- void replace (float x, float y)
- void replace (float x, float y, float z)
- void replace (float x, float y, float z, float r)
- void replace (double x)
- void replace (double x, double y)
- void replace (double x, double y, double z)
- void replace (double x, double y, double z, double r)
- void read (int &i)
- void read (bool &i)
- void read (double &x)
- void read (double &x, double &y)
- void read (double &x, double &y, double &z)
- void read (double &x, double &y, double &z, double &r)
- void read (float &x)
- void read (float &x, float &y)
- void read (float &x, float &y, float &z)
- void read (float &x, float &y, float &z, float &r)
- void read (std::vector< float > &vec)
- void read (std::vector< int > &vec)
- void replace (std::vector< float > &vec)
- void replace (std::vector< int > &vec)
Static Public Member Functions
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &on, const std::string &propname, const std::string &type, const char *fmt, size_t maxlen,...)
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &on, const std::string &propname, const std::string &type, const std::string &pac, const char *fmt, size_t maxlen,...)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &on, const std::string &propname, const char *fmt,...)
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &on, const std::string &propname, const std::string &propval, const std::string &valtype, const std::string &pac="", bool letErrorThrough=false)
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &base, const std::string &propname, bool b, const std::string &pac="")
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &base, const std::string &propname, int i, const std::string &pac="")
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &base, const std::string &propname, double x, const std::string &pac="")
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &base, const std::string &propname, double x, double y, const std::string &pac="")
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &base, const std::string &name, int x, int y, const std::string &pac="")
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &base, const std::string &propname, double x, double y, double z, const std::string &pac="")
- static VUtil::vRef< ParentChildRelation > setProperty (Vobject &base, const std::string &propname, double x, double y, double z, double r, const std::string &pac="")
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, std::string &data, std::string &datatype)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, int &i)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, bool &i)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, double &x)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, double &x, double &y)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, double &x, double &y, double &z)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, double &x, double &y, double &z, double &r)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, float &x)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, float &x, float &y)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &name, int &x, int &y)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, float &x, float &y, float &z)
- static VUtil::vRef< ParentChildRelation > getProperty (Vobject &base, const std::string &propname, float &x, float &y, float &z, float &r)
Protected Member Functions
- Property (VobjectBase *superobject)
Constructor & Destructor Documentation
| VOS::Property::Property | ( | VobjectBase * | superobject | ) | [protected] |
Member Function Documentation
| virtual void VOS::Property::addPropertyListener | ( | PropertyListener * | pl, | |
| bool | refresh = true | |||
| ) | [pure virtual] |
Add a new property listener to this property.
This listener's methods will be called when the property is modified.
- See also:
- PropertyListener
- Parameters:
-
pl The new property listener. If it is also a RefCounted object, references will be acquired correctly. refresh ?? If supplied, determines whether listener is immediately notified ??
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| virtual void VOS::Property::cacheProperty | ( | bool | b | ) | [virtual] |
Specify if this property should be cached locally.
Only meaningful for remote properties. This means that we become a listener of the remote property and receive updates. Calls to read() will be serviced using the cached values for the property and will not go out to the network.
- Parameters:
-
b If true, use cache. If false, the property will not be cached (unless it is being listened to by another part of the program.)
| virtual void VOS::Property::doSaveState | ( | MessageBlock & | output, | |
| std::set< std::string > & | types, | |||
| bool | portable | |||
| ) | [virtual] |
This is where you put type-handler specific save state code.
- Parameters:
-
output The messageblock to append your messages to types The types for the object that should be output as part of this save state. Some save state handlers may want to modify this. portable If true, generate a "portable" state. This means that all the data required to restore state should be embedded in the message. If false, fully recreating the state may rely on external resources such as files or databases.
- See also:
- Vobject::saveState
Reimplemented from VOS::MetaObject.
| virtual const std::string VOS::Property::getDataType | ( | ) | [pure virtual] |
Return type of decoded data (usually a MIME type).
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| virtual int VOS::Property::getLength | ( | ) | [pure virtual] |
Get length (bytes) of decoded data.
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| virtual Message::Priority VOS::Property::getPriority | ( | ) | [inline, virtual] |
Definition at line 243 of file property.hh.
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| float & | x, | |||
| float & | y, | |||
| float & | z, | |||
| float & | r | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| float & | x, | |||
| float & | y, | |||
| float & | z | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | name, | |||
| int & | x, | |||
| int & | y | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| float & | x, | |||
| float & | y | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| float & | x | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double & | x, | |||
| double & | y, | |||
| double & | z, | |||
| double & | r | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double & | x, | |||
| double & | y, | |||
| double & | z | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double & | x, | |||
| double & | y | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double & | x | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| bool & | i | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| int & | i | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| std::string & | data, | |||
| std::string & | datatype | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::getProperty | ( | Vobject & | on, | |
| const std::string & | propname, | |||
| const char * | fmt, | |||
| ... | ||||
| ) | [static] |
| virtual const std::string VOS::Property::getVOSType | ( | ) | [pure virtual] |
Return MetaObject type, "property".
Reimplemented from VOS::MetaObject.
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| void VOS::Property::read | ( | std::vector< int > & | vec | ) |
| void VOS::Property::read | ( | std::vector< float > & | vec | ) |
| void VOS::Property::read | ( | float & | x, | |
| float & | y, | |||
| float & | z, | |||
| float & | r | |||
| ) |
| void VOS::Property::read | ( | float & | x, | |
| float & | y, | |||
| float & | z | |||
| ) |
| void VOS::Property::read | ( | float & | x, | |
| float & | y | |||
| ) |
| void VOS::Property::read | ( | float & | x | ) |
| void VOS::Property::read | ( | double & | x, | |
| double & | y, | |||
| double & | z, | |||
| double & | r | |||
| ) |
| void VOS::Property::read | ( | double & | x, | |
| double & | y, | |||
| double & | z | |||
| ) |
| void VOS::Property::read | ( | double & | x, | |
| double & | y | |||
| ) |
| void VOS::Property::read | ( | double & | x | ) |
| void VOS::Property::read | ( | bool & | i | ) |
| void VOS::Property::read | ( | int & | i | ) |
| void VOS::Property::read | ( | const char * | format, | |
| ... | ||||
| ) |
| virtual std::string VOS::Property::read | ( | int | start, | |
| int | length | |||
| ) | [pure virtual] |
Return substring of decoded data, possibly performing decode if necesary.
- See also:
- read(std::string, int int)
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| virtual std::string VOS::Property::read | ( | ) | [pure virtual] |
Return decoded data, possibly performing decode if necesary.
- See also:
- read(std::string, int int)
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| virtual void VOS::Property::read | ( | std::string & | target, | |
| int | start, | |||
| int | length | |||
| ) | [pure virtual] |
Read a substring of decoded data into target, possibly performing decode if necesary.
- Parameters:
-
target Place data in this string start Byte offset to start reading length Number of bytes to read. If this parameter is -1, read until the end of the data.
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| virtual void VOS::Property::read | ( | std::string & | target | ) | [pure virtual] |
Read decoded data into target, possibly performing decode if necesary.
- See also:
- read(std::string, int, int)
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| void VOS::Property::readFromFile | ( | const std::string & | filename, | |
| const std::string & | type = "" | |||
| ) |
Read data from file into this property.
- Parameters:
-
filename Name of file to read from. type New datatype for this property. If empty ("") or omitted, then the existing datatype will be used.
- Exceptions:
-
runtime_error On error opening or reading from file.
| virtual void VOS::Property::removePropertyListener | ( | PropertyListener * | pl | ) | [pure virtual] |
Remove the property listener 'pl' from this property.
- Parameters:
-
pl Listener to remove. If it is also a RefCounted object, references will be released correctly.
Implemented in VOS::BasicLocalProperty, and VOS::RemoteProperty.
| void VOS::Property::replace | ( | std::vector< int > & | vec | ) |
| void VOS::Property::replace | ( | std::vector< float > & | vec | ) |
| void VOS::Property::replace | ( | double | x, | |
| double | y, | |||
| double | z, | |||
| double | r | |||
| ) |
| void VOS::Property::replace | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) |
| void VOS::Property::replace | ( | double | x, | |
| double | y | |||
| ) |
| void VOS::Property::replace | ( | double | x | ) |
| void VOS::Property::replace | ( | float | x, | |
| float | y, | |||
| float | z, | |||
| float | r | |||
| ) |
| void VOS::Property::replace | ( | float | x, | |
| float | y, | |||
| float | z | |||
| ) |
| void VOS::Property::replace | ( | float | x, | |
| float | y | |||
| ) |
| void VOS::Property::replace | ( | float | x | ) |
| void VOS::Property::replace | ( | int | i | ) |
| void VOS::Property::replace | ( | bool | b | ) |
| void VOS::Property::replace | ( | const char * | str | ) |
| void VOS::Property::replace | ( | const char * | format, | |
| const char * | type, | |||
| size_t | maxlen, | |||
| ... | ||||
| ) |
| void VOS::Property::replace | ( | const char * | format, | |
| size_t | maxlen, | |||
| ... | ||||
| ) |
Set/get this property, converting from/to non-string types.
For information on formatted replace and read see snprintf and scanf in the standard C library.
| virtual void VOS::Property::replace | ( | const std::string & | newdata, | |
| const std::string & | newtype = "?" | |||
| ) | [pure virtual] |
Completely change the value and type of data stored in this property.
- Parameters:
-
newdata New data. newtype The type of the new datatype. If no type identifier was supplied, the previous one is kept. NOTE: the initial datatype (set by the constructor) is "?" which is (or should be) an invalid value for any application.
Implemented in VOS::BasicLocalProperty, VOS::LocalProperty, and VOS::RemoteProperty.
| virtual void VOS::Property::setPriority | ( | Message::Priority | p | ) | [inline, virtual] |
Definition at line 242 of file property.hh.
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double | x, | |||
| double | y, | |||
| double | z, | |||
| double | r, | |||
| const std::string & | pac = "" | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double | x, | |||
| double | y, | |||
| double | z, | |||
| const std::string & | pac = "" | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | base, | |
| const std::string & | name, | |||
| int | x, | |||
| int | y, | |||
| const std::string & | pac = "" | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double | x, | |||
| double | y, | |||
| const std::string & | pac = "" | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| double | x, | |||
| const std::string & | pac = "" | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| int | i, | |||
| const std::string & | pac = "" | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | base, | |
| const std::string & | propname, | |||
| bool | b, | |||
| const std::string & | pac = "" | |||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | on, | |
| const std::string & | propname, | |||
| const std::string & | propval, | |||
| const std::string & | valtype, | |||
| const std::string & | pac = "", |
|||
| bool | letErrorThrough = false | |||
| ) | [static] |
Reimplemented in VOS::BasicLocalProperty.
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | on, | |
| const std::string & | propname, | |||
| const std::string & | type, | |||
| const std::string & | pac, | |||
| const char * | fmt, | |||
| size_t | maxlen, | |||
| ... | ||||
| ) | [static] |
| static VUtil::vRef<ParentChildRelation> VOS::Property::setProperty | ( | Vobject & | on, | |
| const std::string & | propname, | |||
| const std::string & | type, | |||
| const char * | fmt, | |||
| size_t | maxlen, | |||
| ... | ||||
| ) | [static] |
Set/Get a subproperty on an object, returning relation between object and property.
For information on formatted setProperty and getProperty see snprintf and scanf in the standard C library.
- Parameters:
-
on Object to set a subproperty on propname Name of the property to set type Datatype of the new value. fmt Format string (printf()-style) maxlen Maximum buffer size for formatting property value and replacing (using snprintf()).
- Returns:
- object expressing relation between the object and the property
| virtual void VOS::Property::write | ( | int | start, | |
| const std::string & | newdata | |||
| ) | [pure virtual] |
Write newdata into property value, starting at byte position start.
Implemented in VOS::BasicLocalProperty, VOS::LocalProperty, and VOS::RemoteProperty.
| void VOS::Property::writeToFile | ( | const std::string & | filename, | |
| int | offset = 0, |
|||
| int | length = -1 | |||
| ) |
Write property value to a file.
If offset and length are supplied, write substring.
- Parameters:
-
filename Name of file to open and write to. Any previous contents will be replaced. offset If supplied, beginning of substring to write from property value. length If supplied, length of substring to write from property value.
- Exceptions:
-
runtime_error if there is an error opening or writing to the file.
The documentation for this class was generated from the following file:
- /home/tetron/hack/vos/libs/vos/vos/property.hh