Gyoto
|
Container for the value of a Property. More...
#include <GyotoValue.h>
Public Member Functions | |
Value () | |
Constructor. | |
~Value () | |
Destructor. | |
Value & | operator= (Value const &) |
Assignement operator. | |
Value (double) | |
Construct/cast from double. | |
operator double () const | |
Cast to double. | |
Value (bool) | |
Construct/cast from boolean. | |
operator bool () const | |
Cast to bool. | |
Value (long) | |
Construct/cast from long. | |
operator long () const | |
Cast to long. | |
Value (unsigned long) | |
Construct/cast from unsigned long. | |
operator unsigned long () const | |
Cast to unsigned long. | |
Value (std::string) | |
Construct/cast from string. | |
operator std::string () const | |
Cast to string. | |
Value (std::vector< double >) | |
Construct/cast from vector of doubles. | |
operator std::vector< double > () const | |
Cast to vector of doubles. | |
Value (std::vector< unsigned long >) | |
Construct/cast from vector of unsigned long values. | |
operator std::vector< unsigned long > () const | |
Cast to vector of unsigned long values. | |
Value (Gyoto::SmartPointer< Gyoto::Metric::Generic >) | |
Cast from Metric object. | |
operator Gyoto::SmartPointer< Gyoto::Metric::Generic > () const | |
Cast to Metric object. | |
Value (Gyoto::SmartPointer< Gyoto::Astrobj::Generic >) | |
Cast from Astrobj. | |
operator Gyoto::SmartPointer< Gyoto::Astrobj::Generic > () const | |
Cast to Astrobj. | |
Value (Gyoto::SmartPointer< Gyoto::Spectrum::Generic >) | |
Cast from Spectrum. | |
operator Gyoto::SmartPointer< Gyoto::Spectrum::Generic > () const | |
Cast to Spectrum. | |
Value (Gyoto::SmartPointer< Gyoto::Spectrometer::Generic >) | |
Cast from Spectrometer. | |
operator Gyoto::SmartPointer< Gyoto::Spectrometer::Generic > () const | |
Cast to Spectrometer. | |
Value (Gyoto::SmartPointer< Gyoto::Screen >) | |
Cast from Screen. | |
operator Gyoto::SmartPointer< Gyoto::Screen > () const | |
Cast to Screen. | |
Public Attributes | |
int | type |
Type of this instance. | |
Private Attributes | |
double | Double |
A double value. | |
bool | Bool |
A boolean value. | |
long | Long |
A long value. | |
unsigned long | ULong |
An unsigned long (a.k.a. size_t) | |
size_t | SizeT |
A size_t (only if distinct from unsigned long) | |
std::string | String |
A string value. | |
std::vector< double > | VDouble |
A vector of double values. | |
std::vector< unsigned long > | VULong |
A vector of unsigned long values. | |
Gyoto::SmartPointer< Gyoto::Metric::Generic > | Metric |
A Metric object. | |
Gyoto::SmartPointer< Gyoto::Astrobj::Generic > | Astrobj |
An Astrobj Object. | |
Gyoto::SmartPointer< Gyoto::Spectrum::Generic > | Spectrum |
A Spectrum object. | |
Gyoto::SmartPointer< Gyoto::Spectrometer::Generic > | Spectrometer |
A Spectrometer object. | |
Gyoto::SmartPointer< Gyoto::Screen > | Screen |
A Screen object. | |
Container for the value of a Property.
The Value class is very similar to the C union type (although not as memory efficient): it can hold several type of values, but only one at a time. Care must be taken to ensure only the member that was set is retrieved. The purpose of the Value class is to be used together with the Property class: code determines dynamicaly the type of a Property, reads the corresponding value appropriateley (e.g. from XML or from the Yorick prompt), stores the value in a Value instance, and sets the Property using the Object::set() method. Likewise, the Object::get() method returns a Gyoto::Value. Property::type must be used to determine which member of the Value is meaningful.
Casting between Value and the various data type it can hold is normally automatic, but the members can also be accessed explicitly make code more easy to read and less ambiguous.