Clarisse 4.0 SP9 SDK  4.0.0.0.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Friends | List of all members
ComponentInterface Class Reference

This class defines a component interface. More...

Inheritance diagram for ComponentInterface:
CoreBaseObject CoreBaseType

Public Types

enum  { INVALID_INDEX = 0xFFFFFFFF }
 

Public Member Functions

bool is_kindof (const CoreString &name) const
 Return true if the interface are related.
 
bool is_kindof (const ComponentInterface &iface) const
 
const CoreBasicArray< const
ComponentInterface * > & 
get_interfaces () const
 Return parent interfaces.
 
const unsigned int & get_id () const
 Return the id of the schema.
 
const CoreStringget_name () const
 Return the name of the interface.
 
const CoreStringget_doc () const
 Return the documentation of the interface.
 
bool add_property (const CoreString &name, const ComponentProperty::Type &type, const CoreString &doc="")
 Add a new property with the specified name and type.
 
bool set_implementation (const CoreClassInfo &class_info, ComponentImplementation *impl)
 Set the implementation for a specific class to this interface. Unlike implementation set in ComponentSchema these implementation are called outside the context of schemas.
 
ComponentProxy get_proxy (CoreBaseObject &instance) const
 Get the implementation for a specific class to this interface.
 
ComponentProxy get_proxy (CoreBaseObject &instance, const CoreClassInfo &class_info) const
 
unsigned int find_property (const CoreString &name, const unsigned int &idx=0) const
 Return the index of the property.
 
const ComponentPropertyget_property (const unsigned int &idx) const
 Return the property at the specified index.
 
const ComponentPropertyget_property (const CoreString &name) const
 Return the first property named with the specified name.
 
const CoreVector
< ComponentProperty > & 
get_properties () const
 Return the properties defined in the interface.
 
const ComponentFactoryget_factory () const
 Return the component factory.
 
- Public Member Functions inherited from CoreBaseObject
bool is_kindof (const CoreBaseObject &object) const
 
virtual size_t get_memory_size () const
 
CoreString get_class_info_name () const
 
CoreString get_class_interface () const
 
const unsigned long & get_class_info_id () const
 
bool is_kindof (const CoreClassInfo &cinfo) const
 
virtual const CoreClassInfoget_class_info () const
 
bool operator== (const CoreBaseObject &obj) const
 
template<class T >
T * cast ()
 
template<class T >
const T * cast () const
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 
bool operator== (const CoreBaseType &obj) const
 

Friends

class ComponentFactory
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreBaseObject
static const CoreClassInfoclass_info ()
 
static bool ___class_destructor__ (void *instance, const bool &is_array)
 
template<class T >
static T * cast (CoreBaseObject *object)
 
template<class T >
static const T * cast (const CoreBaseObject *object)
 

Detailed Description

This class defines a component interface.

Note
The interface "Null" and "Item" are always defined.

Member Function Documentation

bool ComponentInterface::add_property ( const CoreString name,
const ComponentProperty::Type type,
const CoreString doc = "" 
)

Add a new property with the specified name and type.

Parameters
[in]namename of the property
[in]typetype of the property
[in]docbrief documentation of the property
Note
It is not recommended to declare multiple properties sharing identical names within the same interface.
unsigned int ComponentInterface::find_property ( const CoreString name,
const unsigned int &  idx = 0 
) const

Return the index of the property.

Parameters
[in]namename of the property
[in]idxstarting index (useful if you need to iterate over properties sharing the same name).
Returns
The index of the property if found, otherwise return -1.
const ComponentProperty& ComponentInterface::get_property ( const unsigned int &  idx) const
inline

Return the property at the specified index.

Parameters
[in]idxindex of the property
const ComponentProperty& ComponentInterface::get_property ( const CoreString name) const
inline

Return the first property named with the specified name.

Parameters
[in]namename of the property
ComponentProxy ComponentInterface::get_proxy ( CoreBaseObject instance) const

Get the implementation for a specific class to this interface.

Parameters
[in]instanceinstance of a class for which an implementation of the interface is defined.
Returns
The implementation proxy if successful, null otherwise. Check ComponentProxy::get_implementation to check if the implementation exists.
bool ComponentInterface::set_implementation ( const CoreClassInfo class_info,
ComponentImplementation impl 
)

Set the implementation for a specific class to this interface. Unlike implementation set in ComponentSchema these implementation are called outside the context of schemas.

Parameters
[in]class_infoCoreClassInfo for which the implementation of the interface will be defined.
[in]implPointer to a new instance providing an implementation to the interface for the specific class to get data in and out.
Returns
true if successful. If the method returns false then an implementation have been already defined for the specified class_info.