ModelServices Class Reference
[Services]

Provides access for storing and managing data. More...

#include <ModelServices.h>

Inheritance diagram for ModelServices:

Inheritance graph

List of all members.

Public Member Functions

virtual DataDescriptorcreateDataDescriptor (const std::string &name, const std::string &type, DataElement *pParent) const =0
virtual DataDescriptorcreateDataDescriptor (const std::string &name, const std::string &type, const std::vector< std::string > &parent) const =0
virtual void destroyDataDescriptor (DataDescriptor *pDescriptor) const =0
virtual ImportDescriptorcreateImportDescriptor (const std::string &name, const std::string &type, DataElement *pParent, bool bImported=true) const =0
virtual ImportDescriptorcreateImportDescriptor (const std::string &name, const std::string &type, const std::vector< std::string > &parent, bool bImported=true) const =0
virtual ImportDescriptorcreateImportDescriptor (DataDescriptor *pDescriptor, bool bImported=true) const =0
virtual void destroyImportDescriptor (ImportDescriptor *pImportDescriptor) const =0
virtual bool addElementType (const std::string &elementType)=0
virtual bool hasElementType (const std::string &elementType) const =0
virtual const std::vector
< std::string > & 
getValidElementTypes () const =0
virtual std::vector
< DataElement * > 
createElements (const std::vector< DataDescriptor * > &descriptors)=0
virtual DataElementcreateElement (const DataDescriptor *pDescriptor)=0
virtual DataElementcreateElement (const std::string &name, const std::string &type, DataElement *pParent)=0
virtual DataElementgetElement (const std::string &name, const std::string &type, const DataElement *pParent) const =0
virtual DataElementgetElement (const std::vector< std::string > &designator, const std::string &type) const =0
virtual std::vector
< DataElement * > 
getElements (const std::string &type) const =0
virtual std::vector
< DataElement * > 
getElements (const DataElement *pParent, const std::string &type) const =0
virtual std::vector
< DataElement * > 
getElements (const std::string &filename, const std::string &type) const =0
virtual std::vector< std::string > getElementNames (const std::string &type) const =0
virtual std::vector< std::string > getElementNames (const DataElement *pParent, const std::string &type) const =0
virtual std::vector< std::string > getElementNames (const std::string &filename, const std::string &type) const =0
virtual bool setElementName (DataElement *pElement, const std::string &name)=0
virtual bool setElementParent (DataElement *pElement, DataElement *pParent)=0
virtual bool removeElement (const DataElement *pElement)=0
virtual bool destroyElement (DataElement *pElement)=0
virtual void clear ()=0
virtual char * getMemoryBlock (size_t size)=0
virtual void deleteMemoryBlock (char *memory)=0
virtual bool isKindOfElement (const std::string &className, const std::string &elementName) const =0
virtual void getElementTypes (const std::string &className, std::vector< std::string > &classList) const =0
virtual bool isKindOfDataDescriptor (const std::string &className, const std::string &descriptorName) const =0
virtual void getDataDescriptorTypes (const std::string &className, std::vector< std::string > &classList) const =0
virtual bool isKindOfFileDescriptor (const std::string &className, const std::string &descriptorName) const =0
virtual void getFileDescriptorTypes (const std::string &className, std::vector< std::string > &classList) const =0

Static Public Member Functions

static const std::string & signalElementCreated ()
static const std::string & signalElementDestroyed ()
static const std::string & signalElementReparented ()
static double getDataValue (EncodingType type, const void *pData, int iIndex)
static double getDataValue (EncodingType type, const void *pData, ComplexComponent component, int iIndex)
template<class T>
static void getDataValue (const T *pData, ComplexComponent component, int iIndex, double &dValue)
static unsigned char getDataValue (const unsigned char &data, ComplexComponent component)
static signed char getDataValue (const signed char &data, ComplexComponent component)
static unsigned short getDataValue (const unsigned short &data, ComplexComponent component)
static signed short getDataValue (const signed short &data, ComplexComponent component)
static double getDataValue (const IntegerComplex &data, ComplexComponent component)
static unsigned int getDataValue (const unsigned int &data, ComplexComponent component)
static signed int getDataValue (const signed int &data, ComplexComponent component)
static float getDataValue (const float &data, ComplexComponent component)
static double getDataValue (const FloatComplex &data, ComplexComponent component)
static double getDataValue (const double &data, ComplexComponent component)

Protected Member Functions

virtual ~ModelServices ()

Related Functions

(Note that these are not member functions.)

template<typename Destination, typename Source>
Destination model_cast (Source pSourcePtr)


Detailed Description

Provides access for storing and managing data.

This interface allows for creation and manipulation of data, including access to a session within the application. Data is stored in elements that contain descriptor classes to provide information related to the data.

Each element is stored internally according to a key that is comprised of a name, type, and a parent element. The combination of these three identifiers must be unique when creating a new element, renaming an existing element, or reparenting an existing element.

The parent element allows for different elements of different types to be associated with each other. For example, a common parent/child pair is an AoiElement element that has a RasterElement parent to indicate that the area of interest relates to a specific data set.

If an element has a non-NULL parent element, the element will be destroyed when its parent is destroyed.

This subclass of Subject will notify upon the following conditions:

Definition at line 55 of file ModelServices.h.


Constructor & Destructor Documentation

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

This will be cleaned up during application close.

Plug-ins do not need to destroy it.

Definition at line 1044 of file ModelServices.h.


Member Function Documentation

static const std::string& ModelServices::signalElementCreated (  )  [static]

Emitted with boost::any<DataElement*> when a DataElement is created.

Definition at line 61 of file ModelServices.h.

static const std::string& ModelServices::signalElementDestroyed (  )  [static]

Emitted with boost::any<DataElement*> when a DataElement is destroyed.

Definition at line 66 of file ModelServices.h.

static const std::string& ModelServices::signalElementReparented (  )  [static]

Emitted with boost::any<DataElement*> when the parent of a DataElement changes.

Definition at line 72 of file ModelServices.h.

virtual DataDescriptor* ModelServices::createDataDescriptor ( const std::string &  name,
const std::string &  type,
DataElement pParent 
) const [pure virtual]

Creates an empty data descriptor.

This method creates an empty data descriptor that can be populated so that a data element can be created. The memory for the data is allocated by the studio but owned by the plug-in, so plug-in must destroy the data descriptor by calling the destroyDataDescriptor() method.

Parameters:
name The name for the data element.
type The type of the data element, which is used to determine the kind of element to create when createElement() is called. To create a data element from the returned data descriptor, the type string must be one of the valid element types returned from getValidElementTypes(). For raster data types, a RasterDataDescriptor is created. For all other types, a DataDescriptor is created.
pParent An optional parent element to which the new element will be associated. Passing in NULL indicates that the new element is not associated with another element. If the parent is non-NULL, the returned element is automatically destroyed when the parent element is destroyed. The new DataDescriptor inherits the parent's classification unless the parent is NULL, in which case the classification will be set to the system's highest level of classification.
Returns:
Returns a pointer to the newly created data descriptor.
See also:
createElement()

virtual DataDescriptor* ModelServices::createDataDescriptor ( const std::string &  name,
const std::string &  type,
const std::vector< std::string > &  parent 
) const [pure virtual]

Creates an empty data descriptor.

This method creates a DataDescriptor with a parent specified as a vector of strings. It should not be called if the parent data element already exists. It is to be used when the parent has not yet been created. Since the parent should not exist, the classification will be set to the highest level of the system. It is the responsibility of the caller to set the proper classification settings.

Parameters:
name The name for the data element.
type The type of the data element, which is used to determine the kind of element to create when createElement() is called. To create a data element from the returned data descriptor, the type string must be one of the valid element types returned from getValidElementTypes(). For raster data types, a RasterDataDescriptor is created. For all other types, a DataDescriptor is created.
parent A parent element to which the new element will be associated. This parent is specified as a vector of names of elements. The first name in the vector is the top-level element, the next name is a child of that element, and so on. Passing an empty vector will create a top-level element.
Returns:
Returns a pointer to the newly created data descriptor.
See also:
createElement()

virtual void ModelServices::destroyDataDescriptor ( DataDescriptor pDescriptor  )  const [pure virtual]

Destroys a data descriptor.

This destroys a data descriptor that was created with the createDataDescriptor() method.

Parameters:
pDescriptor The data descriptor to destroy.

virtual ImportDescriptor* ModelServices::createImportDescriptor ( const std::string &  name,
const std::string &  type,
DataElement pParent,
bool  bImported = true 
) const [pure virtual]

Creates an import descriptor.

This method creates an import descriptor that contains a data descriptor that can be populated so that a data element can be imported. Ownership of the import descriptor is transferred to the caller, so the destroyImportDescriptor() method should be called to destroy the object. The import descriptor maintains ownership of the created data descriptor.

Parameters:
name The name for the data element.
type The type of the data element, which is used to determine the kind of element to create when createElement() is called. To create a data element from the returned data descriptor, the type string must be one of the valid element types returned from getValidElementTypes(). For raster data types, a RasterDataDescriptor is created. For all other types, a DataDescriptor is created.
pParent An optional parent element to which the new element will be associated. Passing in NULL indicates that the new element is not associated with another element. If the parent is non-NULL, the returned element is automatically destroyed when the parent element is destroyed. The created data descriptor in the new import descriptor inherits the parent's classification unless the parent is NULL, in which case the classification will be set to the system's highest level of classification.
bImported Set this parameter to true to import the element or to false to not create the data element on import.
Returns:
Returns a pointer to the newly created import descriptor.
See also:
createImportDescriptor(DataDescriptor*, bool) const

virtual ImportDescriptor* ModelServices::createImportDescriptor ( const std::string &  name,
const std::string &  type,
const std::vector< std::string > &  parent,
bool  bImported = true 
) const [pure virtual]

Creates an import descriptor.

This method creates an import descriptor whose parent is specified as a vector of names. It should not be called if the parent data element already exists. It is to be used when the parent has not yet been created, e.g., in an importer to display the hierarchy of data elements to be imported in the import options widget. Since the parent should not exist, the classification will be set to the highest level of the system. It is the responsibility of the caller to set the proper classification settings.

Parameters:
name The name for the data element.
type The type of the data element, which is used to determine the kind of element to create when createElement() is called. To create a data element from the returned data descriptor, the type string must be one of the valid element types returned from getValidElementTypes(). For raster data types, a RasterDataDescriptor is created. For all other types, a DataDescriptor is created.
parent A parent element to which the new element will be associated. This parent is specified as a vector of names of elements. The first name in the vector is the top-level element, the next name is a child of that element, and so on. Passing an empty vector will create a top-level element.
bImported Set this parameter to true to import the element or to false to not create the data element on import.
Returns:
Returns a pointer to the newly created import descriptor.
See also:
createImportDescriptor(DataDescriptor*, bool) const, createDataDescriptor(const std::string& name, const std::string& type, const std::vector<std::string> &parent) const

virtual ImportDescriptor* ModelServices::createImportDescriptor ( DataDescriptor pDescriptor,
bool  bImported = true 
) const [pure virtual]

Creates an import descriptor.

This method creates an import descriptor that contains a given data descriptor so that a data element can be imported. Ownership of the import descriptor is transferred to the caller, so the destroyImportDescriptor() method should be called to destroy the object. Ownership of the given data descriptor is transferred to the created import descriptor.

Parameters:
pDescriptor The data descriptor with which to create the data element on import.
bImported Set this parameter to true to create the data element and load the data on import or to false to not create the data element on import.
Returns:
Returns a pointer to the newly created import descriptor.
See also:
createImportDescriptor(const std::string&, const std::string&, DataElement*, bool) const

virtual void ModelServices::destroyImportDescriptor ( ImportDescriptor pImportDescriptor  )  const [pure virtual]

Destroys an import descriptor.

This destroys an import descriptor that was created with the createImportDescriptor() method.

Parameters:
pImportDescriptor The import descriptor to destroy.

virtual bool ModelServices::addElementType ( const std::string &  elementType  )  [pure virtual]

Adds a new element type to the list of valid types.

This method adds a new element type to the list of valid types and also adds the new type as a valid plug-in arg type in PlugInManagerServices.

New element types are added to distinguish between multiple custom data types stored in an Any element. A new plug-in arg type is automatically registered with PlugInManagerServices, and when creating an arg with the new element type, the arg value must be set to the Any element and not the AnyData object contained in the Any element.

Warning:
If the new element type is going to be used as the type in a PlugInArg, this method should be called before setting the arg type in Executable::getInputSpecification() or Executable::getOutputSpecification().
Parameters:
elementType The new element type.
Returns:
Returns true if the element type was successfully added to the valid types list. Returns false if the element type already exists in the list, or if an empty string is passed in.
See also:
getValidElementTypes()

virtual bool ModelServices::hasElementType ( const std::string &  elementType  )  const [pure virtual]

Queries whether a given type is a valid element type.

Parameters:
elementType The type to query whether it is a valid element type.
Returns:
Returns true if the given type is a valid element type; otherwise returns false.
See also:
getValidElementTypes()

virtual const std::vector<std::string>& ModelServices::getValidElementTypes (  )  const [pure virtual]

Returns the valid element types.

This method returns the names of each recognized element type. Custom element types can be added to the list by calling the addElementType() method. When a element with a custom type is created, an Any element is created.

The default element types are as follows:

Returns:
A vector of strings specifying the name of each valid element type.

virtual std::vector<DataElement*> ModelServices::createElements ( const std::vector< DataDescriptor * > &  descriptors  )  [pure virtual]

Creates multiple data elements as a batch, ensuring proper parentage.

This method creates a data element for each DataDescriptor. When created, each element will have the parentage specified in the DataDescriptor. The group will be created in an order that guarantees a new element's parent exists before it is created as long as that parent exists before the call to createElements() or is part of the group of new elements. If a new element requests a parent that does not already exist and is not in the vector of DataDescriptors, that element will not be created.

Parameters:
descriptors A vector of DataDescriptors describing the elements to be created.
Returns:
A vector of the new elements. If one or more elements can not be created, this method will not fail fast. A partial error can be detected by comparing the size of the return value with the size of descriptors. Only successfully created elements will be returned. If an element can not be created and has children in descriptors, those children will also fail to be created.
See also:
createElement(const DataDescriptor*)

virtual DataElement* ModelServices::createElement ( const DataDescriptor pDescriptor  )  [pure virtual]

Creates an empty data element with no data.

This method creates an element based on the given data descriptor. The type in the data descriptor must be one of the valid element types returned from getValidElementTypes().

The memory for the element is created and maintained by the studio. A deep copy of the given data descriptor is made so the calling object should destroy the data descriptor after calling this method. The new element inherits the classification settings of the passed in data descriptor.

Parameters:
pDescriptor The data descriptor from which to create the data element. The type in the data descriptor is used to determine the kind of element to create and must be one of the types returned from getValidElementTypes(). If a valid custom type is specified, an Any element is created. This method does nothing if NULL is passed in.
Returns:
This method returns a pointer to the newly created data element. NULL is returned in the following conditions:
  • The type in the data descriptor is not a valid element type returned from getValidElementTypes().
  • The parent element specified by the parent designator in the data descriptor (see DataDescriptor::getParentDesignator()) does not exist.
  • The element could not be created (i.e. the element already exists).
  • The element type is RasterElement with a processing location of IN_MEMORY and the required amount of memory could not be allocated.
Warning:
For data element type RasterElement with a processing location of ON_DISK or ON_DISK_READ_ONLY , this method will return a non-NULL pointer even if the temporary file required for the element can't be created. This behavior is necessary to prevent performance problems with importers. If you use this method to create an ON_DISK or ON_DISK_READ_ONLY raster element, a NULL check on the return from this method will not insure that the returned data element is usable. A better way is to check the return from a call to RasterElement::createDefaultPager() which will return false if the associated temporary file can not be created. For an even simpler approach, use RasterUtilities::createRasterElement() instead of this method to create the data element. RasterUtilities::createRasterElement() will return NULL if either the memory can't be allocated or the temporary file can't be created.
Subject Notifications:
This method will notify signalElementCreated() with boost::any<DataElement*>.
See also:
createElement(const std::string&, const std::string&, DataElement*), RasterUtilities::createRasterElement()

virtual DataElement* ModelServices::createElement ( const std::string &  name,
const std::string &  type,
DataElement pParent 
) [pure virtual]

Creates an empty data element with no data.

This is a convenience method that creates a data element without needing to first create a data descriptor and then destroy the data descriptor after the element is created. It is typically used to create simple data elements such as AOIs and GCP lists. The new element inherits the classification settings of the parent element unless the parent is NULL, in which case the new element's classification will be set to the system's highest level.

Parameters:
name The string name for the data element to create.
type The string name corresponding to the type of the data element to create. The types must be one of the valid element types returned from getValidElementTypes(). If a valid custom type is passed in, an Any element is created.
pParent The parent element of the element to create. Passing in NULL indicates that the element is not associated with another element. If the parent is non-NULL, the returned element is automatically destroyed when the parent element is destroyed.
Returns:
This method returns a pointer to the newly created data element. NULL is returned if the given type is not a valid element type returned from getValidElementTypes() or if the element could not be created (i.e. the element already exists).
Subject Notifications:
This method will notify signalElementCreated with any<DataElement*>.
See also:
createElement(const DataDescriptor*)

virtual DataElement* ModelServices::getElement ( const std::string &  name,
const std::string &  type,
const DataElement pParent 
) const [pure virtual]

Retrieves a data element.

Parameters:
name The string name for the data element to retrieve.
type The string name corresponding to the type of the data element to retrieve. If this is an empty string, an element of any type is retrieved.
pParent The parent element of the element to get. Passing in NULL indicates that the element is not associated with another element.
Returns:
This method returns a pointer to the data element with the given parameters. If no element is found where all of the parameters match, NULL is returned.
See also:
model_cast()

virtual DataElement* ModelServices::getElement ( const std::vector< std::string > &  designator,
const std::string &  type 
) const [pure virtual]

Retrieves a data element.

Parameters:
designator The element designator for the data element to retrieve.
type The string name corresponding to the type of the data element to retrieve. If this is an empty string, an element of any type is retrieved.
Returns:
This method returns a pointer to the data element with the given parameters. If no element is found where all of the parameters match, NULL is returned.
See also:
model_cast(), DataElement::getParentDesignator()

virtual std::vector<DataElement*> ModelServices::getElements ( const std::string &  type  )  const [pure virtual]

Retrieves elements of a given type.

Parameters:
type The string name corresponding to the element type to retrieve. If an empty string is passed in, all elements in the model are retrieved.
Returns:
A vector containing pointers to the data elements of the given type.
See also:
getElements(const DataElement*, const std::string&) const, getElements(const std::string&, const std::string&) const

virtual std::vector<DataElement*> ModelServices::getElements ( const DataElement pParent,
const std::string &  type 
) const [pure virtual]

Retrieves elements with a given parent.

Parameters:
pParent The parent element for which all child elements should be retrieved. Passing in NULL retrieves all top-level elements.
type An optional type string for retreiving elements of a particular type from the given parent. If an empty string is passed in, all elements with the given parent are retrieved.
Returns:
A vector containing pointers to the data elements with the given parent.
See also:
getElements(const std::string&) const, getElements(const std::string&, const std::string&) const

virtual std::vector<DataElement*> ModelServices::getElements ( const std::string &  filename,
const std::string &  type 
) const [pure virtual]

Retrieves elements with a given file.

Parameters:
filename The filename for which all elements with the same filename should be retrieved. Passing in an empty string retrieves all elements that have no associated file.
type An optional type string for retreiving elements of a particular type within the given file. If an empty string is passed in, all elements within the given file are retrieved.
Returns:
A vector containing pointers to the data elements within the given file.
See also:
getElements(const std::string&) const, getElements(const DataElement*, const std::string&) const

virtual std::vector<std::string> ModelServices::getElementNames ( const std::string &  type  )  const [pure virtual]

Retrieves the names of elements of a given type.

Parameters:
type The string name corresponding to the element type for which to retrieve the names. If an empty string is passed in, the names of all elements in the model are retrieved.
Returns:
A vector containing the names of the data elements of the given type.
See also:
getElementNames(const DataElement*, const std::string&) const, getElementNames(const std::string&, const std::string&) const

virtual std::vector<std::string> ModelServices::getElementNames ( const DataElement pParent,
const std::string &  type 
) const [pure virtual]

Retrieves the names of elements with a given parent.

Parameters:
pParent The parent element for which the names of all child elements should be retrieved. Passing in NULL retrieves the names of all top-level elements.
type An optional type string for retreiving the names of elements of a particular type from the given parent. If an empty string is passed in, the names of all elements with the given parent are retrieved.
Returns:
A vector containing the names of the data elements with the given parent.
See also:
getElementNames(const std::string&) const, getElementNames(const std::string&, const std::string&) const

virtual std::vector<std::string> ModelServices::getElementNames ( const std::string &  filename,
const std::string &  type 
) const [pure virtual]

Retrieves the names of elements with a given file.

Parameters:
filename The filename for which the names of all elements with the same filename should be retrieved. Passing in an empty string retrieves the name of all elements that have no associated file.
type An optional type string for retreiving the names of elements of a particular type within the given file. If an empty string is passed in, the names of all elements within the given file are retrieved.
Returns:
A vector containing the names of the data elements with the given file.
See also:
getElementNames(const std::string&) const, getElementNames(const DataElement*, const std::string&) const

virtual bool ModelServices::setElementName ( DataElement pElement,
const std::string &  name 
) [pure virtual]

Renames a data element.

Parameters:
pElement The existing element in the session to rename. This method does nothing if NULL is passed in.
name The new name for the element. If an empty string is passed in, the element is not renamed.
Returns:
True if the rename was successful, false otherwise. This operation will fail if a DataElement already exists with the new name, type, and parent as this element.

virtual bool ModelServices::setElementParent ( DataElement pElement,
DataElement pParent 
) [pure virtual]

Reparents a data element.

The classification settings of the reparented element will not be changed, i.e., they will not be set to the new parent's settings.

Parameters:
pElement The existing element in the session to reparent. This method does nothing if NULL is passed in.
pParent The new parent for the element.
Returns:
Returns true if the reparent was successful, otherwise returns false. This operation will fail if the given parent element already contains a child element with the same name and type as the given element.
Subject Notifications:
This method will notify signalElementReparented() with boost::any<DataElement*> if the element is successfully reparented.

virtual bool ModelServices::removeElement ( const DataElement pElement  )  [pure virtual]

Removes a data element from the session.

This method removes a data element from the session but does not delete it. To remove and delete the element, call the destroyElement() method instead.

Parameters:
pElement The data element to be removed.
Returns:
Returns true if element was successfully removed; otherwise returns false.

virtual bool ModelServices::destroyElement ( DataElement pElement  )  [pure virtual]

Removes a data element from the session and deletes it.

This method removes a data element from the session and deletes it and all of its child elements. To remove the element without deleting it and its children, call the removeElement() method instead.

Parameters:
pElement The element to remove and delete, along with its child elements. This method does nothing if NULL is passed in.
Returns:
Returns true if the element was successfully removed and deleted; otherwise returns false.
Subject Notifications:
This method will notify signalElementDestroyed with any<DataElement*>. The DataElement pointer is still valid at the time of notification.

virtual void ModelServices::clear (  )  [pure virtual]

Removes and destroys all elements in the session.

Subject Notifications:
This method will notify signalElementDestroyed with any<DataElement*> for each element destroyed. The DataElement pointer is still valid at the time of notification.

virtual char* ModelServices::getMemoryBlock ( size_t  size  )  [pure virtual]

Allocates a large block of memory.

This method allocates a contiguous block of memory of a given size and returns a pointer to the memory block. This method can be used to create space for a dataset in the studio's memory space that it can be accessed when a plug-in has been unloaded.

NOTE: On a 64-bit platform, the maximum available bytes to allocate is 2^64, which is well over 18 million GB. On a 32-bit platform, the maximum available bytes to allocate is 4 GB.

Parameters:
size The size in bytes of the requested memory block.
Returns:
A pointer to the new memory block. NULL is returned if a contiguous block of memory of the given size cannot be allocated. On Windows systems, NULL may be returned even if the amount of free memory is greater than size if the location of any system DLLs fragments the memory space so that a contiguous block is not available.
See also:
deleteMemoryBlock()

virtual void ModelServices::deleteMemoryBlock ( char *  memory  )  [pure virtual]

Deletes a block of memory allocated by the studio.

This method is used to delete a block of memory created by the getMemoryBlock() method.

Parameters:
memory A pointer to the memory block to be deleted.

static double ModelServices::getDataValue ( EncodingType  type,
const void *  pData,
int  iIndex 
) [static]

This static method retrieves an individual data value from a block of memory.

Parameters:
type The data type of the memory block.
pData A pointer to the block of memory from which to get the data value.
iIndex The index into the memory block for the data value.
Returns:
The data value. A value of 0.0 is returned if the given type is not recognized.

Definition at line 725 of file ModelServices.h.

static double ModelServices::getDataValue ( EncodingType  type,
const void *  pData,
ComplexComponent  component,
int  iIndex 
) [static]

This static method retrieves an individual data value from a block of memory.

Parameters:
type The data type of the memory block.
pData A pointer to the block of memory from which to get the data value.
component For complex data, this specifies the component of the complex data that should be returned. For non-complex data, this value is ignored.
iIndex The index into the memory block for the data value.
Returns:
The data value. A value of 0.0 is returned if the given type is not recognized.
See also:
ComplexComponent

Definition at line 750 of file ModelServices.h.

template<class T>
static void ModelServices::getDataValue ( const T *  pData,
ComplexComponent  component,
int  iIndex,
double &  dValue 
) [static]

Retrieves an individual data value from a block of memory independent of the data type.

This static method provides the same functionality as the corresponding virtual method, but can be used inside of other template methods. This can provide a significant performance improvement if getting numerous data values.

Parameters:
pData A pointer to the block of memory from which to get the data value.
component For complex data, this specifies the component of the complex data that should be returned. For non-complex data, this value is ignored.
iIndex The index into the memory block for the data value.
dValue Populated with the data value.

Definition at line 779 of file ModelServices.h.

static unsigned char ModelServices::getDataValue ( const unsigned char &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 797 of file ModelServices.h.

static signed char ModelServices::getDataValue ( const signed char &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 812 of file ModelServices.h.

static unsigned short ModelServices::getDataValue ( const unsigned short &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 827 of file ModelServices.h.

static signed short ModelServices::getDataValue ( const signed short &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 842 of file ModelServices.h.

static double ModelServices::getDataValue ( const IntegerComplex data,
ComplexComponent  component 
) [static]

Returns a data value according to a given complex data component.

Parameters:
data The data value from which to extract the complex component value.
component For complex data, this specifies the component of the complex data whose value should be returned.
Returns:
The data value corresponding to the given complex data component.

Definition at line 858 of file ModelServices.h.

static unsigned int ModelServices::getDataValue ( const unsigned int &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 873 of file ModelServices.h.

static signed int ModelServices::getDataValue ( const signed int &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 888 of file ModelServices.h.

static float ModelServices::getDataValue ( const float &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 903 of file ModelServices.h.

static double ModelServices::getDataValue ( const FloatComplex data,
ComplexComponent  component 
) [static]

Returns a data value according to a given complex data component.

Parameters:
data The data value from which to extract the complex component value.
component For complex data, this specifies the component of the complex data whose value should be returned.
Returns:
The data value corresponding to the given complex data component.

Definition at line 919 of file ModelServices.h.

static double ModelServices::getDataValue ( const double &  data,
ComplexComponent  component 
) [static]

Provided for convenience for template methods, this method simply returns the given value.

Parameters:
data The data value from which to extract the complex component value.
component This value is ignored since the given data value is non-complex.
Returns:
The given data value.

Definition at line 934 of file ModelServices.h.

virtual bool ModelServices::isKindOfElement ( const std::string &  className,
const std::string &  elementName 
) const [pure virtual]

Queries a element to see if it is a kind of another element.

This method check type compatibility between two data elements. This functionality is different than TypeAwareObject::isKindOf() in that only DataElement-derived classes are checked.

Parameters:
className The name of the DataElement-derived class to query.
elementName The DataElement-derived class name to check type compatibility.
Returns:
Returns true if the given element name is a kind of the given class name, otherwise false.

virtual void ModelServices::getElementTypes ( const std::string &  className,
std::vector< std::string > &  classList 
) const [pure virtual]

Returns a list of inherited data element class names for a given class name.

This method populates a vector with the class names of all inherited DataElement class types. The given class name is used as the initial class for populating the vector. For example, passing in "RasterElement" as a class name populates a vector with the "RasterElement" and "DataElement" strings.

Parameters:
className The data element class name for which to get all inherited element types.
classList This vector is populated with the class names of all inherited data element classes and the given class name.

virtual bool ModelServices::isKindOfDataDescriptor ( const std::string &  className,
const std::string &  descriptorName 
) const [pure virtual]

Queries a data descriptor to see if it is a kind of another data descriptor.

This method check type compatibility between two data descriptors. This functionality is different than TypeAwareObject::isKindOf() in that only DataDescriptor-derived classes are checked.

Parameters:
className The name of the DataDescriptor-derived class to query.
descriptorName The DataDescriptor-derived class name to check type compatibility.
Returns:
Returns true if the given data descriptor name is a kind of the given class name, otherwise false.

virtual void ModelServices::getDataDescriptorTypes ( const std::string &  className,
std::vector< std::string > &  classList 
) const [pure virtual]

Returns a list of inherited data descriptor class names for a given class name.

This method populates a vector with the class names of all inherited DataDescriptor class types. The given class name is used as the initial class for populating the vector. For example, passing in "RasterDataDescriptor" as a class name populates a vector with the "RasterDataDescriptor" and "DataDescriptor" strings.

Parameters:
className The data descriptor class name for which to get all inherited descriptor types.
classList This vector is populated with the class names of all inherited data descriptor classes and the given class name.

virtual bool ModelServices::isKindOfFileDescriptor ( const std::string &  className,
const std::string &  descriptorName 
) const [pure virtual]

Queries a file descriptor to see if it is a kind of another file descriptor.

This method check type compatibility between two file descriptors. This functionality is different than TypeAwareObject::isKindOf() in that only FileDescriptor-derived classes are checked.

Parameters:
className The name of the FileDescriptor-derived class to query.
descriptorName The FileDescriptor-derived class name to check type compatibility.
Returns:
Returns true if the given file descriptor name is a kind of the given class name, otherwise false.

virtual void ModelServices::getFileDescriptorTypes ( const std::string &  className,
std::vector< std::string > &  classList 
) const [pure virtual]

Returns a list of inherited file descriptor class names for a given class name.

This method populates a vector with the class names of all inherited FileDescriptor class types. The given class name is used as the initial class for populating the vector. For example, passing in "RasterFileDescriptor" as a class name populates a vector with the "RasterFileDescriptor" and "FileDescriptor", strings.

Parameters:
className The file descriptor class name for which to get all inherited descriptor types.
classList This vector is populated with the class names of all inherited file descriptor classes and the given class name.


Friends And Related Function Documentation

template<typename Destination, typename Source>
Destination model_cast ( Source  pSourcePtr  )  [related]

Converts a pointer of one type to a pointer of another type.

This cast is provided as a convenience to directly cast from a DataElement as returned by ModelServices::getElement() to the custom AnyData object stored in an Any element. If the requested type is registered with ModelServices::addElementType() and stored in an Any element, this cast returns a pointer to the custom data type; otherwise this cast is simply a wrapper around a dynamic_cast.

Parameters:
pSourcePtr The pointer to convert to a pointer of the requested type.
Returns:
A pointer of the requested type. NULL is returned if the given pointer cannot be dynamic_cast to the requested type or if the given Any element pointer does not contain data of the requested type.
See also:
DataElement::isKindOf()

Definition at line 1070 of file ModelServices.h.


Software Development Kit - Opticks 4.9.0 Build 16218