DataDirector API
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DDD_AssetBase Class Referenceabstract

A virtual interface class for all DataDirector assets. More...

#include <DDD_AssetBase.h>

Inheritance diagram for DDD_AssetBase:
DDD_AttributeContainer DDD_Base DDD_LogFacade DDD_RSOAsset DDD_StructuredMemoryAsset

Public Member Functions

 DDD_AssetBase (DDD_AssetContainer *container)
 
virtual ~DDD_AssetBase ()
 
const char * DataDirectorVersion ()
 
DDD_AttributeBaseGetAttribute (const char *attributeName)
 
DDD_AttributeBaseGetAttribute (int index)
 
const char * GetAttributeNames ()
 
DDD_AssetContainerGetContainer ()
 
int NumberOfConnections ()
 
int NumberOfAttributes ()
 
virtual void AddDynamicAttribute (DDD_AttributeBase *attrib)
 
virtual void RefreshAttributesList ()
 
bool AddAssetObserver (DDD_AssetObserver *observer)
 
bool RemoveAssetObserver (DDD_AssetObserver *observer)
 
virtual const char * Description ()=0
 
virtual bool Live ()=0
 
virtual const char * ClassName ()=0
 
virtual void Start ()
 
virtual void Stop ()
 
virtual void Pause ()
 
virtual void Resume ()
 
virtual void Calculate (double time)=0
 
void RevertAttributes ()
 
virtual DDD_AttributeBaseFindAttributeLocalScope (const std::string &name, void *userData)
 
virtual void ExecuteLuaScript (const char *script, void *userData)
 
virtual bool EvaluateLuaScript (const char *script, void *userData)
 
- Public Member Functions inherited from DDD_Base
 DDD_Base ()
 
virtual ~DDD_Base ()
 
const char * GetInstanceName () const
 
virtual void SetInstanceName (const char *name)
 
virtual void SetParams (const DDD_AttributeList &params)
 
virtual DDD_AttributeListGetParams ()
 

Static Public Member Functions

static bool IsAssetNameLegal (const std::string &assetName)
 
- Static Public Member Functions inherited from DDD_LogFacade
static void LogDebug (const char *format,...)
 
static void LogInfo (const char *format,...)
 
static void LogWarning (const char *format,...)
 
static void LogError (const char *format,...)
 

Protected Member Functions

void NotifyAttributeListAdded ()
 
void NotifyAttributeListDeleted ()
 
void CreateLua ()
 
void DestroyLua ()
 
virtual void PopulateAttributeList ()=0
 
virtual DDD_AttributeBaseGetDictionaryAttribute (const char *attributeName)=0
 
virtual void GenerateInstanceName (const DDD_AssetList &assetList)
 

Protected Attributes

DDD_AttributeList _attributes
 
bool _refreshAttributeList
 
DDD_AssetContainer_container
 
void * _luaState
 
AssetObserverList _assetObserverList
 
- Protected Attributes inherited from DDD_Base
std::string _instanceName
 
DDD_AttributeList _params
 

Detailed Description

A virtual interface class for all DataDirector assets.

Constructor & Destructor Documentation

Constructor

virtual ~DDD_AssetBase ( )
virtual

Destructor

Member Function Documentation

bool AddAssetObserver ( DDD_AssetObserver observer)

Adds an observer to this asset that will be notified whenever this asset changes

Parameters
observerThe observer to add. The observer to add must not already be observing this asset.
Returns
True if the observer was successfully added, false otherwise
Precondition
The observer to add must not already be observing this asset.
virtual void AddDynamicAttribute ( DDD_AttributeBase attrib)
virtual

Adds a dynamic attribute to the asset's _attributes structure. This is called by the framework.

virtual void Calculate ( double  time)
pure virtual

calculate to pump the asset

Implemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

virtual const char* ClassName ( )
pure virtual

Returns asset type (class) name

Implemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

void CreateLua ( )
protected

Create a LUA parser instance for use by this asset

const char* DataDirectorVersion ( )
Returns
Returns string identifying which version of DataDirector this asset was built against
virtual const char* Description ( )
pure virtual

Describes the Asset (for UI)

Implemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

void DestroyLua ( )
protected

Destroy the LUA parser instance for this asset

virtual bool EvaluateLuaScript ( const char *  script,
void *  userData 
)
virtual

Executes a LUA script and returns true if the script set the variable "DDD_Result" to true

Parameters
scriptA string containing the script
userDataUser data passed to the script by the invoking asset
Returns
true if the script set the variable "DDD_Result" to true
virtual void ExecuteLuaScript ( const char *  script,
void *  userData 
)
virtual

Executes a LUA script.

Parameters
scriptA string containing the script
userDataUser data passed to the script by the invoking asset
virtual DDD_AttributeBase* FindAttributeLocalScope ( const std::string &  name,
void *  userData 
)
inlinevirtual

Searches this assets for the attribute. Not pure virtual. Child classes can override if they need to provide their own specialized local scoping of attribute names

Parameters
nameThe fully qualified name of the attribute to find (e.g. assetName.attribName)
userDataData to be used by asset for local scoping of attribute names
Returns
Returns a pointer to the attribute or NULL if not found
virtual void GenerateInstanceName ( const DDD_AssetList assetList)
protectedvirtual

Generates unique asset instance name

Parameters
assetListList of assets used to check uniqueness of name
Postcondition
_instanceName will have a unique identifier string

Reimplemented in DDD_RSOAsset.

DDD_AttributeBase* GetAttribute ( const char *  attributeName)
Returns
Returns a pointer the attribute with the given name. This will first search the _attributes list for the object. If an attribute is found there, it will be returned. Otherwise if no matching attribute is found there, then the asset's internal dictionary will be searched. NULL is returned if no matching attribute is found.
Parameters
nameThe name of the attribute to find
DDD_AttributeBase* GetAttribute ( int  index)
Returns
Returns a pointer the attribute with the given index. It returns NULL if the index is out of range
Parameters
nameThe name of the attribute to find
const char* GetAttributeNames ( )
Returns
Returns a string listing attribute names (from the _attributes list), delimited by a ";"
DDD_AssetContainer* GetContainer ( )
inline
Returns
A pointer to this asset's container
virtual DDD_AttributeBase* GetDictionaryAttribute ( const char *  attributeName)
protectedpure virtual

Gets an attribute from the assets internal dictionary and add it to the list of published attributes for the asset.

Parameters
attributeNameThe name of the attribute to get
Returns
A pointer to the attribute or NULL if it doesn't exist.

Implemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

static bool IsAssetNameLegal ( const std::string &  assetName)
static

Checks for illegal characters in asset name

Parameters
Theasset name to check
Returns
True if the asset name is legal
virtual bool Live ( )
pure virtual

Is this asset currently running?

Implemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

void NotifyAttributeListAdded ( )
protected

Notifies all observers of this asset that its attribute list has been deleted

void NotifyAttributeListDeleted ( )
protected

Notifies all observers of this asset that its attribute list has been added or readded

int NumberOfAttributes ( )
Returns
Returns the total number of attributes in the _attributes list for this asset This is not necessarily the total number of attributes supported by the asset, but just the total number of attributes that have been requested by the data director.
int NumberOfConnections ( )
Returns
Returns number of times each of its attributes are referenced in connections
virtual void Pause ( )
virtual

Pause asset. Do cleanup that should happen when the asset is paused.

Reimplemented in DDD_StructuredMemoryAsset.

virtual void PopulateAttributeList ( )
protectedpure virtual

Poll asset, put all "discovered" assets into _attributList

Precondition
_attributeList is empty
Postcondition
_attributeList will contain the list of attributes discovered from the asset

Implemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

virtual void RefreshAttributesList ( )
virtual

Called every time the editor needs an update on the current attributes. Some Assets can change their Attribute lists dynamically. By default, it simply populates them the first time and leaves it. Assets with dynamically changing lists of attributes may reallocate their attribute list

bool RemoveAssetObserver ( DDD_AssetObserver observer)

Removes an observer from the observer list

Parameters
observerThe observer to remove.
Returns
True if the observer was found and removed, false if it wasn't found
virtual void Resume ( )
virtual

Resume asset. Do allocations, initializations that should happen when the asset is resumed

Reimplemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

void RevertAttributes ( )

Reverts all of the attributes in this list that are marked with the "Revertable" flag

virtual void Start ( )
virtual

Start asset. Do allocations, initializations that should only happen once.

Reimplemented in DDD_RSOAsset, and DDD_StructuredMemoryAsset.

virtual void Stop ( )
virtual

Stop asset. Do deallocations, cleanups that should only happen once.

Reimplemented in DDD_StructuredMemoryAsset.

Member Data Documentation

AssetObserverList _assetObserverList
protected

The list of observers to notify when this asset changes

DDD_AttributeList _attributes
protected

This list contains all attributes that have been requested of this asset, not necessarily all of the attributes the asset supports. In the DataDirector editor this list is populated by PopulateAttributeList and generally contains all of the supported attributes of the asset. At runtime this list will typically contain the names of attributes that are connected.

DDD_AssetContainer* _container
protected

Container that owns this asset. Allows this asset to access siblings.

void* _luaState
protected

Stores the context for the LUA script engine

bool _refreshAttributeList
protected

Flag indicating whether or not the attribute list needs to be refreshed. This is intended only for use by the DataDirector Producer GUI for updating GUI elements and is not used in the runtime.


The documentation for this class was generated from the following file: