Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
ComponentCollection Class Reference

This class defines a collection of components. Each component has its own set of properties (as defined in the interface) and an ID. The ID is the index of the component as returned by the object. The ID is different from the index of the component in the collection. More...

Inheritance diagram for ComponentCollection:
CoreBaseType

Public Member Functions

 ComponentCollection (const ComponentFactory &factory)
 Create a empty component collection defined with the Null interface.
 
 ComponentCollection (const ComponentInterface &iface, const unsigned int &size=0)
 Create a component collection for the specified interface with a component size.
 
 ComponentCollection (const ComponentCollection &src)
 
void set_count (const unsigned int &size)
 Resize the internal buffer of properties.
 
void clear (const unsigned int &new_capacity=0)
 Clear of component data.
 
void remove_all ()
 Clear of component data without deallocating internal data.
 
const unsigned int & get_count () const
 Return the number of components in the collection.
 
bool is_empty () const
 Return true if the collection is empty.
 
const CoreVariantget_value (const CoreString &property_name) const
 Get the value of the specified component property of the first component.
 
const CoreVariantget_value (const unsigned int &component_idx, const CoreString &property_name) const
 Get the value of the specified component property.
 
void set_value (const unsigned int &component_idx, const CoreString &property_name, const CoreVariant &value)
 Set the value of the specified component property.
 
void set_value (const CoreString &property_name, const CoreVariant &value)
 Set the value of the specified component property of the first component.
 
const CoreVariantget_value (const unsigned int &property_idx) const
 Get the value of the specified component property of the first component.
 
const CoreVariantget_value (const unsigned int &component_idx, const unsigned int &property_idx) const
 Get the value of the specified component property.
 
void set_value (const unsigned int &component_idx, const unsigned int &property_idx, const CoreVariant &value)
 Get the value of the specified component property.
 
void set_value (const unsigned int &property_idx, const CoreVariant &value)
 Get the value of the specified component property of the first component.
 
ComponentProxy get_proxy (const unsigned int &component_idx) const
 Get implementation associated with the component.
 
bool set_implementation (const unsigned int &component_idx, CoreBaseObject &instance, const ComponentSchema &schema)
 Set the implementation of the associated component.
 
bool set_implementation (const unsigned int &component_idx, CoreBaseObject &instance, const ComponentInterface &iface)
 Set the implementation of the associated component.
 
void set_interface (const ComponentInterface &iface)
 Set a new interface.
 
const ComponentInterfaceget_interface () const
 Return the interface of the component collection.
 
const ComponentFactoryget_factory () const
 Return the component factory associated to the interface.
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreBaseType
static const CoreClassInfoclass_info ()
 Get the type descriptor of this instance.
 

Detailed Description

This class defines a collection of components. Each component has its own set of properties (as defined in the interface) and an ID. The ID is the index of the component as returned by the object. The ID is different from the index of the component in the collection.

Constructor & Destructor Documentation

ComponentCollection::ComponentCollection ( const ComponentFactory factory)

Create a empty component collection defined with the Null interface.

Parameters
[in]factoryComponentFactory
ComponentCollection::ComponentCollection ( const ComponentInterface iface,
const unsigned int &  size = 0 
)

Create a component collection for the specified interface with a component size.

Parameters
[in]ifaceinterface
[in]sizenumber of components

Member Function Documentation

void ComponentCollection::clear ( const unsigned int &  new_capacity = 0)

Clear of component data.

new_capacity capacity of the collection (pre-allocate data)

ComponentProxy ComponentCollection::get_proxy ( const unsigned int &  component_idx) const

Get implementation associated with the component.

Note
This method isn't boundary safe. You must ensure component_idx and property_idx are within boundaries
Parameters
[in]component_idxindex of the component
Returns
The component implementation.
const CoreVariant& ComponentCollection::get_value ( const CoreString property_name) const
inline

Get the value of the specified component property of the first component.

Note
This method is a helper in the event you work with a single component.
Parameters
[in]property_namename of the property
Returns
The property specified value.
const CoreVariant& ComponentCollection::get_value ( const unsigned int &  component_idx,
const CoreString property_name 
) const
inline

Get the value of the specified component property.

Note
This method isn't boundary safe. You must ensure component_idx is within boundaries and property_name must exists.
Parameters
[in]component_idxindex of the component
[in]property_namename of the property
Returns
The property specified value.
const CoreVariant& ComponentCollection::get_value ( const unsigned int &  property_idx) const
inline

Get the value of the specified component property of the first component.

Note
This method is a helper in the event you work with a single component.
Parameters
[in]property_idxindex of the property as defined in the interface
Returns
The property value.
const CoreVariant& ComponentCollection::get_value ( const unsigned int &  component_idx,
const unsigned int &  property_idx 
) const
inline

Get the value of the specified component property.

Note
This method isn't boundary safe. You must ensure component_idx and property_idx are within boundaries
Parameters
[in]component_idxindex of the component
[in]property_idxindex of the property as defined in the interface
Returns
The property value.
void ComponentCollection::set_count ( const unsigned int &  size)

Resize the internal buffer of properties.

Note
This clear all data that was previously set
Parameters
[in]sizenumber of components
bool ComponentCollection::set_implementation ( const unsigned int &  component_idx,
CoreBaseObject instance,
const ComponentSchema schema 
)

Set the implementation of the associated component.

Note
This method isn't boundary safe. You must ensure component_idx and property_idx are within boundaries. This method must be used only while implementing a ComponentImplementation
Parameters
[in]component_idxindex of the component
[in]instanceof the object
[in]schemaof the component
Returns
true if a suitable implementation exists for the pair of the class instance/schema.
bool ComponentCollection::set_implementation ( const unsigned int &  component_idx,
CoreBaseObject instance,
const ComponentInterface iface 
)

Set the implementation of the associated component.

Note
This method isn't boundary safe. You must ensure component_idx and property_idx are within boundaries. This method must be used only while implementing a ComponentImplementation
Parameters
[in]component_idxindex of the component
[in]instanceof the object
[in]ifaceinterface of the component
Returns
true if a suitable implementation exists for the pair of the class instance/interface.
void ComponentCollection::set_interface ( const ComponentInterface iface)

Set a new interface.

Note
This method clear all existing data
void ComponentCollection::set_value ( const unsigned int &  component_idx,
const CoreString property_name,
const CoreVariant value 
)
inline

Set the value of the specified component property.

Note
This method isn't boundary safe. You must ensure component_idx is within boundaries and property_name must exists.
Parameters
[in]component_idxindex of the component
[in]property_namename of the property
[in]valuevalue to set
void ComponentCollection::set_value ( const CoreString property_name,
const CoreVariant value 
)
inline

Set the value of the specified component property of the first component.

Note
This method is a helper in the event you work with a single component.
Parameters
[in]property_namename of the property
[in]valuevalue to set
void ComponentCollection::set_value ( const unsigned int &  component_idx,
const unsigned int &  property_idx,
const CoreVariant value 
)
inline

Get the value of the specified component property.

Note
This method isn't boundary safe. You must ensure component_idx and property_idx are within boundaries
Parameters
[in]component_idxindex of the component
[in]property_idxindex of the property as defined in the interface
[in]valuevalue to set
Returns
The property value.
void ComponentCollection::set_value ( const unsigned int &  property_idx,
const CoreVariant value 
)
inline

Get the value of the specified component property of the first component.

Note
This method is a helper in the event you work with a single component.
Parameters
[in]property_idxindex of the property as defined in the interface
[in]valuevalue to set
Returns
The property value.