Signature Class Reference

Signature with identifying attributes. More...

#include <Signature.h>

Inheritance diagram for Signature:

Inheritance graph

List of all members.

Public Member Functions

virtual const DataVariantgetData (const std::string &name) const =0
template<typename T>
void setData (const std::string &name, const T &data)
virtual void adoptData (const std::string &name, DataVariant &data)=0
virtual const UnitsgetUnits (const std::string &name) const =0
virtual std::set< std::string > getDataNames () const =0
virtual std::set< std::string > getUnitNames () const =0

Static Public Member Functions

static const std::string & signalDataChanged ()

Protected Member Functions

virtual ~Signature ()


Detailed Description

Signature with identifying attributes.

A signature is an object that essentially consists of a map of data sets, along with a map of optional Units objects. Each data set is referred to as a component of the signature. The unique name associated with each data set is called its component name and is the key for the map of data sets. The optional Units object associated with a data set is stored in a map using the data set component name as the key.

This subclass of Subject will notify upon the following conditions:

See also:
DataElement, Units

Definition at line 37 of file Signature.h.


Constructor & Destructor Documentation

virtual Signature::~Signature (  )  [protected, virtual]

This should be destroyed by calling ModelServices::destroyElement.

Definition at line 169 of file Signature.h.


Member Function Documentation

static const std::string& Signature::signalDataChanged (  )  [static]

Emitted with any<std::pair<string,DataVariant> > when an attribute is added or changed.

Definition at line 43 of file Signature.h.

virtual const DataVariant& Signature::getData ( const std::string &  name  )  const [pure virtual]

Gets a data set from the signature.

This method returns a data set from the signature in the form of a DataVariant.

Parameters:
name The name of the data set, as provided when the data set was added to the Signature.
Returns:
A DataVariant containing the requested data set. If no data set exists in the signature with the specified name, it will return an invalid DataVariant.
See also:
DataVariant::isValid()

template<typename T>
void Signature::setData ( const std::string &  name,
const T &  data 
)

Adds a data set to the signature.

This method adds a data set to the signature. A deep copy of the value will be performed. If a data set already exists in the Signature with the name specified, it will be replaced with the new value.

This method is preferred to adoptData() unless you are passing an already constructed DataVariant in which case, adoptData() will be faster because it avoids a deep copy.

Parameters:
name The name of the data set to be added to the signature.
data The data set to be added to the Signature. For example:
 bool populateSignature(Signature *pSig, 
                        const vector<double> &wavelengths,
                        const vector<double> &reflectances)
 {
    if (pSig == NULL) return false;
    pSig->setData("wavelengths", wavelengths);
    pSig->setData("reflectances", reflectances);
    return true;
 }

Subject Notifications:
This method will notify signalDataChanged with any<std::pair<string,DataVariant> > after the data set is added to the Signature.

Definition at line 99 of file Signature.h.

virtual void Signature::adoptData ( const std::string &  name,
DataVariant data 
) [pure virtual]

Adds a data set to the signature.

This method adds a data set to the signature. A deep copy of the value will be performed. If a data set already exists in the Signature with the name specified, it will be replaced with the new value.

This method should not be used; generally setData() is preferred. This method and setData() have identical performance characteristics and setData() is easier to call. This method is faster than setData() though if you have an already constructed DataVariant and is preferred to setData() in this case.

Parameters:
name The name of the data set to be added to the signature.
data The data set to be added to the Signature. On return, this will contain the value previously stored. If the value did not previously exist, then this will contain an invalid DataVariant.
Subject Notifications:
This method will notify signalDataChanged with any<std::pair<string,DataVariant> > after the data set is added to the Signature.

virtual const Units* Signature::getUnits ( const std::string &  name  )  const [pure virtual]

A convenience method that returns the Units object returned from calling SignatureDataDescriptor::getUnits.

Parameters:
name The component name of the Units object to get from the signature.
Returns:
A pointer to the Units object with the specified component name. NULL will be returned if no Units object exists with the specified name.
Note:
This pointer should not be stored. It may become invalid at a later time.

virtual std::set<std::string> Signature::getDataNames (  )  const [pure virtual]

Gets the names associated with data in this Signature.

Returns:
set of names

virtual std::set<std::string> Signature::getUnitNames (  )  const [pure virtual]

Gets the names associated with units in this Signature.

Returns:
set of names


Software Development Kit - Opticks 4.9.0 Build 16218