Any Class Reference

Provides custom data storage. More...

#include <Any.h>

Inheritance diagram for Any:

Inheritance graph

List of all members.

Public Member Functions

virtual void setData (AnyData *pData)=0
virtual AnyDatagetData ()=0
virtual const AnyDatagetData () const =0

Protected Member Functions

virtual ~Any ()


Detailed Description

Provides custom data storage.

The Any element provides storage for custom data types that are not inherently recognized by the data model. The element provides the means to set and get the custom data stored in the element via the AnyData class which serves as a common base class for all custom data objects.

The application provides one concrete subclass, DataVariantAnyData, that stores a single DataVariant value. If the plug-in module creating the DataVariantAnyData object will remain loaded for the lifetime of the Any element, the plug-in can create the object directly on the heap. If the plug-in module will be unloaded before the Any element is destroyed, the plug-in must create the DataVariantAnyData object from the ObjectFactory, which ensures that the Any element containing the object will be able to successfully delete it when the element is destroyed.

A plug-in can also create a subclass of AnyData to store custom data that cannot be set into a DataVariant, but the module containing that plug-in must remain loaded so that the Any element will be able to successfully delete the custom data when the element is destroyed.

This subclass of Subject will notify upon the following conditions:

See also:
DataElement

Definition at line 47 of file Any.h.


Constructor & Destructor Documentation

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

This should be destroyed by calling ModelServices::destroyElement().

Definition at line 92 of file Any.h.


Member Function Documentation

virtual void Any::setData ( AnyData pData  )  [pure virtual]

Sets the custom data managed by this element.

Ownership of the data is transferred to the element, so the calling object is not responsible for deleting the data. The element will delete the data when the element is destroyed.

Parameters:
pData A pointer to the custom data object.
Subject Notifications:
This method will notify Subject::signalModified with any<AnyData*>.

virtual AnyData* Any::getData (  )  [pure virtual]

Returns a pointer to the custom data.

The calling object must cast the data to the proper pointer type to further manipulate it.

Returns:
A pointer to the stored data. NULL is returned if no custom data has been set.

virtual const AnyData* Any::getData (  )  const [pure virtual]

Returns read-only access to the custom data.

The calling object must cast the data to the proper pointer type to further access it.

Returns:
A pointer to the stored data. The custom data represented by the returned pointer should not be modified. To modify the values, call the non-const version of getData(). NULL is returned if no custom data has been set.


Software Development Kit - Opticks 4.9.0 Build 16218