ValueMap Class Reference

Related Scripting Object: ValueMap

Represents a special container to hold key-value pairs, similar to an associative array. More...

#include <xsi_valuemap.h>

Inheritance diagram for ValueMap:

SIObject CBase List of all members.

Public Member Functions

  ValueMap ()
  ~ValueMap ()
  ValueMap (const CRef &in_ref)
  ValueMap (const ValueMap &in_obj)
bool  IsA (siClassID in_ClassID) const
siClassID  GetClassID () const
ValueMap operator= (const ValueMap &in_obj)
ValueMap operator= (const CRef &in_ref)
CValue  Get (const CString &in_name) const
CStatus  GetAll (CValueArray &out_names, CValueArray &out_values) const
CStatus  Remove (const CString &in_name)
CStatus  Set (const CString &in_name, const CValue &in_value)

Detailed Description

Represents a special container to hold key-value pairs, similar to an associative array.

A value map is set of name-value pairs defined for a ShaderDef, a ShaderParamDef, a ShaderArrayParamDef, or a MetaShaderRendererDef. This is the equivalent of a dictionary or associative array.

Tip:
There is no GetCount function implemented on this object, but you can use the ValueMap::GetAll function which returns the list of names and the list of values defined in this ValueMap.
See also:
ShaderDef::GetAttributes, ShaderParamDef::GetAttributes, ShaderArrayParamDef::GetItemInitialValues, MetaShaderRendererDef::GetRendererOptions, Color Sampler example
Since:
9.0 (2011)


Constructor & Destructor Documentation

ValueMap (  ) 

Default constructor.

~ValueMap (  ) 

Default destructor.

ValueMap ( const CRef in_ref  ) 

Constructor.

Parameters:
in_ref  constant reference object.

ValueMap ( const ValueMap in_obj  ) 

Copy constructor.

Parameters:
in_obj  constant class object.


Member Function Documentation

bool IsA ( siClassID  in_ClassID  )  const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassID  class type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID (  )  const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from SIObject.

ValueMap& operator= ( const ValueMap in_obj  ) 

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_obj  constant class object.
Returns:
The new ValueMap object.

ValueMap& operator= ( const CRef in_ref  ) 

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_ref  constant class object.
Returns:
The new ValueMap object.

Reimplemented from SIObject.

CValue Get ( const CString in_name  )  const

Returns the value that matches the specified name.

Warning:
If the value is undefined, this method throws an error. You can work around this limitation by accessing the names and values array using the same index.
Parameters:
in_name  the name of the value to retrieve.
Returns:
the value matching the specified name
See also:
ValueMap::Set, ValueMap::GetAll
Since:
9.0 (2011)

CStatus GetAll ( CValueArray out_names,
CValueArray out_values  
) const

Returns the lists of all names and all values defined in this ValueMap in two separate output arrays.

Parameters:
out_names  array of names
out_values  array of values
Returns:
Success/failure
See also:
ValueMap::Set, ValueMap::Get, ValueMap::Remove
Since:
9.0 (2011)

CStatus Remove ( const CString in_name  ) 

Removes the value that matches the specified name. If no item matches that name, nothing happens.

Parameters:
in_name  The name of the value to remove.
Returns:
Success/failure
See also:
ValueMap::GetAll
Since:
9.0 (2011)

CStatus Set ( const CString in_name,
const CValue in_value  
)

Sets the value that matches the specified name. If no entry exists matching this name, it automatically adds the name-value pair. If an entry matching that name already exists, the value is updated.

Parameters:
in_name  The name of the value to set.
in_value  The value to set.
Returns:
Success/failure
See also:
ValueMap::Get, ValueMap::GetAll
Since:
9.0 (2011)


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