VR-Link API Documentation for HLA 1.3
Public Member Functions | Protected Attributes

A Flyweight class for manipulating objects and their hierarchy The DtEnvironment wraps a DtEnvValuSP value and provides common queries, algorithms, and operations for the hierarchy. More...

+ Collaboration diagram for DtEnvironment:

List of all members.

Public Member Functions

 DtEnvironment ()
 Constructor, that creates a default named list called "root".
 DtEnvironment (const DtString &name)
 Constructor, that creates an named environment.
 DtEnvironment (DtEnvValueSP root)
 Constructor, that uses an existing object as its root.
virtual ~DtEnvironment ()
 Destructor.
void sync ()
 Synchronize environment Synchronize all objects with their DtEnvObjectSync sync object.
void sync (DtEnvValueSP value)
 Synchronize the value and all its sub-objects with their DtEnvObjectSync sync object.
DtEnvValueSP root () const
 Get accessor for the environment's root object.
void setRoot (DtEnvValueSP root)
 Set accessor for the environment's root object.
void rootToParent ()
 Moves the root up one level.
DtEnvValueSP getTopParent ()
 Returns the top parent of the root, object WILL not be in environment, or will be root.
DtEnvValueSP getTopParent (DtEnvValueSP value)
 Returns the top parent of the value, object MAY not be in environment.
void reparent (DtEnvValueSP value, DtEnvValueSP parent)
 Moves a child value from its current location to a new location.
DtEnvValueSP addNativeValue (DtNativeValueSP nativeValue, DtEnvValueSP parent)
DtEnvValueSP getNativeValue (DtEnvValueSP parent) const
DtEnvValueSP addAttribute (const DtString &name, const DtString &value)
DtEnvValueSP addAttribute (const DtString &name, const DtString &value, DtEnvValueSP parent)
DtEnvValueSP addNamedList (const DtString &name)
DtEnvValueSP addNamedList (const DtString &name, DtEnvValueSP parent)
DtEnvValueSP getAttribute (const DtString &name)
DtEnvValueSP getAttribute (const DtString &name, DtEnvValueSP parent)
void getNamedListsByName (const DtString &objectName, std::list< DtEnvValueSP > &list)
void getObjectsByName (const DtString &objectName, std::list< DtEnvValueSP > &list)
void getObjectsByType (const DtString &objectType, std::list< DtEnvValueSP > &list)
void getNamedListsByName (const DtString &objectName, std::list< DtEnvValueSP > &list, DtEnvValueSP parent)
void getObjectsByName (const DtString &objectName, std::list< DtEnvValueSP > &list, DtEnvValueSP parent)
void getObjectsByType (const DtString &objectType, std::list< DtEnvValueSP > &list, DtEnvValueSP parent)
DtEnvValueSP getNamedList (const DtString &name) const
DtEnvValueSP getNamedList (const DtString &name, DtEnvValueSP root) const
DtEnvValueSP getObject (const DtString &name, const DtString &type) const
 Lookup an object based on it's name and type.
DtEnvValueSP getObject (const DtString &name, const DtString &type, DtEnvValueSP root) const
DtEnvObjectSyncgetObjectSync (const DtString &name, const DtString &type) const
 Lookup an object and return its sync object.
DtEnvObjectSyncgetObjectSync (const DtString &name, const DtString &type, DtEnvValueSP root) const
 Lookup an object and return its sync object.
DtEnvValueSP copy (DtEnvValueSP original)
 Create a copy an object into the environment.
DtEnvValueSP copy (DtEnvValueSP original, DtEnvValueSP parent)
 Create copy an object and add it to the specified parent; Copy duplicates the value and any attributes or sub-objects.
void remove (DtEnvValueSP value)
 Remove an object from the environment.
bool contains (DtEnvValueSP value)
 The function determines if the value is in the current environment Follows the values parent to see if it matches the environment root.
int level (DtEnvValueSP value)
 The function calculates the level of the value in the environment.
void print (std::ostream &output, const DtString &indent, bool printComments=true) const
 The function prints the environment to the output stream.
void print (std::ostream &output, DtEnvValueSP root, const DtString &indent, bool printComments=true) const
 The function prints the environment to the output stream.
DtEnvValueSP addComment (const DtString &comment, DtEnvValueSP parent)
 Adds a comment to the object.
DtEnvValueSP addComment (const DtString &comment)
 Adds a comment to the object.
DtEnvValueSP addObject (const DtString &objectType)
 Add an object to the environment.
DtEnvValueSP addObject (const DtString &objectType, DtEnvValueSP parent)
 Add an object to the environment.
DtEnvValueSP addObject (const DtString &objectName, const DtString &objectType)
 Add an object to the environment.
DtEnvValueSP addObject (const DtString &objectName, const DtString &objectType, DtEnvValueSP parent)
 Add an object to the environment.

Protected Attributes

DtEnvValueSP myRoot
 The root of the environment.

Detailed Description

A Flyweight class for manipulating objects and their hierarchy The DtEnvironment wraps a DtEnvValuSP value and provides common queries, algorithms, and operations for the hierarchy.


Constructor & Destructor Documentation

Constructor, that creates a default named list called "root".

DtEnvironment::DtEnvironment ( const DtString name) [explicit]

Constructor, that creates an named environment.

Constructor, that uses an existing object as its root.

Parameters:
Input
rootAn existing value to be used as the
virtual DtEnvironment::~DtEnvironment ( ) [virtual]

Destructor.


Member Function Documentation

DtEnvValueSP DtEnvironment::addAttribute ( const DtString name,
const DtString value 
)
DtEnvValueSP DtEnvironment::addAttribute ( const DtString name,
const DtString value,
DtEnvValueSP  parent 
)
DtEnvValueSP DtEnvironment::addComment ( const DtString comment,
DtEnvValueSP  parent 
)

Adds a comment to the object.

Parameters:
Input
commentA string that is a comment of the parent.
parentThe value the comment is added to.
Returns:
Returns a smart pointer to the comment object.

Adds a comment to the object.

Parameters:
Input
commentA string that is a comment of the parent.
parentThe value the comment is added to.
Returns:
Returns a smart pointer to the comment object.

Add an object to the environment.

Input

Parameters:
objectTypeThe type of object to add.
parentThe parent of the object to add.
objectNameThe name of the object to add.
Returns:
Returns a smart point to the object.
DtEnvValueSP DtEnvironment::addObject ( const DtString objectType,
DtEnvValueSP  parent 
)

Add an object to the environment.

Input

Parameters:
objectTypeThe type of object to add.
parentThe parent of the object to add.
objectNameThe name of the object to add.
Returns:
Returns a smart point to the object.
DtEnvValueSP DtEnvironment::addObject ( const DtString objectName,
const DtString objectType 
)

Add an object to the environment.

Input

Parameters:
objectTypeThe type of object to add.
parentThe parent of the object to add.
objectNameThe name of the object to add.
Returns:
Returns a smart point to the object.
DtEnvValueSP DtEnvironment::addObject ( const DtString objectName,
const DtString objectType,
DtEnvValueSP  parent 
)

Add an object to the environment.

Input

Parameters:
objectTypeThe type of object to add.
parentThe parent of the object to add.
objectNameThe name of the object to add.
Returns:
Returns a smart point to the object.

The function determines if the value is in the current environment Follows the values parent to see if it matches the environment root.

Parameters:
Input
valueThe value to check.
Returns:
Returns if the value is in the environment, i.e. a child of the environment root.
Return values:
trueThe Value was in the environment.
falseThe Value was NOT in the environment.

Create a copy an object into the environment.

Copy duplicates the value and any attributes or sub-objects. The copy is added to the environment's root. All duplicated objects are unbound, regardless of whether the original was bound to a sync object.

Parameters:
Input
originalThe original object to be copied, it will not be modified.
Returns:
Returns a pointer to the copy.
Return values:
0A copy was unable to be created.

Create copy an object and add it to the specified parent; Copy duplicates the value and any attributes or sub-objects.

The copy is added to the supplied parent. All duplicated objects are unbound, regardless of whether the original was bound to a sync object.

Parameters:
Input
originalThe original object to be copied, it will not be modified
parentThe parent object which the copy will be added to.
Returns:
Returns a pointer to the copy.
Return values:
0A copy was unable to be created.
DtEnvValueSP DtEnvironment::getNamedList ( const DtString name,
DtEnvValueSP  root 
) const
void DtEnvironment::getNamedListsByName ( const DtString objectName,
std::list< DtEnvValueSP > &  list 
)
void DtEnvironment::getNamedListsByName ( const DtString objectName,
std::list< DtEnvValueSP > &  list,
DtEnvValueSP  parent 
)
DtEnvValueSP DtEnvironment::getObject ( const DtString name,
const DtString type 
) const

Lookup an object based on it's name and type.

DtEnvValueSP DtEnvironment::getObject ( const DtString name,
const DtString type,
DtEnvValueSP  root 
) const
void DtEnvironment::getObjectsByName ( const DtString objectName,
std::list< DtEnvValueSP > &  list 
)
void DtEnvironment::getObjectsByName ( const DtString objectName,
std::list< DtEnvValueSP > &  list,
DtEnvValueSP  parent 
)
void DtEnvironment::getObjectsByType ( const DtString objectType,
std::list< DtEnvValueSP > &  list 
)
void DtEnvironment::getObjectsByType ( const DtString objectType,
std::list< DtEnvValueSP > &  list,
DtEnvValueSP  parent 
)
DtEnvObjectSync* DtEnvironment::getObjectSync ( const DtString name,
const DtString type 
) const

Lookup an object and return its sync object.

return Returns a pointer to an DtEnvObjectSync object. retval 0 Either the object does not exist, or the object does not have a sync object.

DtEnvObjectSync* DtEnvironment::getObjectSync ( const DtString name,
const DtString type,
DtEnvValueSP  root 
) const

Lookup an object and return its sync object.

return Returns a pointer to an DtEnvObjectSync object. retval 0 Either the object does not exist, or the object does not have a sync object.

Returns the top parent of the root, object WILL not be in environment, or will be root.

Returns the top parent of the value, object MAY not be in environment.

The function calculates the level of the value in the environment.

Follows the values to the parent and counts the number of parents until the environment's root.

Parameters:
Input
valueThe value to check.
Returns:
Returns the number of generations between the object and the root.
Return values:
0The value is the environment root.
1The value is the child of the environment root.
2The value is the grandchild of the root.
-1The value is not in the environment.
void DtEnvironment::print ( std::ostream &  output,
const DtString indent,
bool  printComments = true 
) const

The function prints the environment to the output stream.

void DtEnvironment::print ( std::ostream &  output,
DtEnvValueSP  root,
const DtString indent,
bool  printComments = true 
) const

The function prints the environment to the output stream.

Remove an object from the environment.

Removes the value from it's parent. If no additional references to the value exist, it will be deallocated.

Parameters:
Input
originalThe original object to be removed.
void DtEnvironment::reparent ( DtEnvValueSP  value,
DtEnvValueSP  parent 
)

Moves a child value from its current location to a new location.

Parameters:
valueThe value to reparent.
parentThe value's new parent

Get accessor for the environment's root object.

Moves the root up one level.

If the root is already a top root, the function does not modify the root.

Set accessor for the environment's root object.

Changes the root of the environment. Equivalent of constructing an new environment with the root.

Synchronize environment Synchronize all objects with their DtEnvObjectSync sync object.

Potentially slow due to large amounts of serialization to strings.

Synchronize the value and all its sub-objects with their DtEnvObjectSync sync object.

Potentially slow due to large amounts of serialization to strings.

Parameters:
Input
valueThe value to sync.

Member Data Documentation

The root of the environment.


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

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)