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

This class defines manages interfaces (ComponentFactory) and schema (ComponentSchema). More...

Inheritance diagram for ComponentFactory:
CoreBaseType

Public Types

enum  ComponentStatus {
  STATUS_OK,
  STATUS_SYNTAX_ERROR,
  STATUS_NOT_FOUND_ERROR,
  STATUS_BOUND_ERROR,
  STATUS_INDEX_ERROR,
  STATUS_IMPLEMENTATION_ERROR,
  STATUS_ITEM_NOT_FOUND_ERROR,
  STATUS_COUNT
}
 Enumeration defining return status of ComponentFactory::get_components. More...
 

Public Member Functions

const ComponentInterfacefind_interface (const CoreString &name) const
 Find the specified interface if it exists.
 
const ComponentInterfaceget_interface (const CoreString &name) const
 Return the specified interface.
 
const unsigned int & get_interface_count () const
 Return the number of interfaces.
 
CoreArray< ComponentInterface * > get_interfaces () const
 Return all existing interfaces.
 
ComponentInterfaceadd_interface (const CoreString &name, const CoreString &doc="")
 Create a new empty interface with the specified name.
 
ComponentInterfaceadd_interface (const CoreBasicArray< const ComponentInterface * > &ifaces, const CoreString &name, const CoreString &doc="")
 Create a new interface with the specified name.
 
bool set_implementation (const ComponentInterface &iface, const CoreClassInfo &class_info, ComponentImplementation *impl)
 Set the implementation for a specific class to the specified interface. Unlike implementation set in ComponentSchema these implementation are called outside the context of schemas.
 
ComponentProxy get_proxy (const ComponentInterface &iface, CoreBaseObject &instance) const
 Get the implementation for a specific class to this interface.
 
ComponentProxy get_proxy (const ComponentInterface &iface, const CoreBaseObject &instance) const
 
const ComponentSchemafind_schema (const CoreString &name) const
 Find the specified interface if it exists.
 
const ComponentSchemaget_schema (const CoreString &name) const
 Return the specified interface.
 
const unsigned int & get_schema_count () const
 Return the number of interfaces.
 
ComponentSchemaadd_schema (const ComponentInterface &iface, const CoreString &name, const CoreString &doc="")
 Create a new schema.
 
bool set_implementation (const ComponentSchema &schema, const CoreClassInfo &class_info, ComponentImplementation *impl)
 Set the implementation for a specific class to the interface of the specified schema.
 
ComponentProxy get_proxy (const ComponentSchema &schema, CoreBaseObject &instance) const
 Get the implementation for a specific class to a specific schema.
 
ComponentProxy get_proxy (const ComponentInterface &iface, CoreBaseObject &instance, const CoreClassInfo &class_info) const
 
bool has_implementation (const ComponentInterface &itf, const CoreClassInfo &class_info)
 Return the specified components from the component path.
 
void get_class_interfaces (const CoreClassInfo &class_info, CoreVector< const ComponentInterface * > &ifaces) const
 
bool get_class_has_interface (const CoreClassInfo &class_info, const ComponentInterface *iface)
 
void get_class_schemas (const CoreClassInfo &class_info, CoreVector< const ComponentSchema * > &schemas) const
 
bool get_class_has_schema (const CoreClassInfo &class_info, const ComponentSchema *schema)
 
void notify_dirtiness (const ComponentImplementation *implementation) const
 
void notify_dirtiness (const CoreClassInfo &class_info, const char *interfaceName)
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 

Static Public Member Functions

static const char * get_status_name (const ComponentStatus &status)
 Return the status as string.
 
static const char * get_status_message (const ComponentStatus &status)
 Return return status message.
 
- Static Public Member Functions inherited from CoreBaseType
static const CoreClassInfoclass_info ()
 Get the type descriptor of this instance.
 

Friends

class ComponentSchema
 
class ComponentInterface
 

Detailed Description

This class defines manages interfaces (ComponentFactory) and schema (ComponentSchema).

Member Enumeration Documentation

Enumeration defining return status of ComponentFactory::get_components.

Enumerator:
STATUS_OK 

No Error has occurred.

STATUS_SYNTAX_ERROR 

Syntax error. Please check the specified component path.

STATUS_NOT_FOUND_ERROR 

Could not find the specified path. Make sure the specified path is valid.

STATUS_BOUND_ERROR 

Index out of bounds.

STATUS_INDEX_ERROR 

Index is invalid.

STATUS_IMPLEMENTATION_ERROR 

No implementation for the specified instance.

STATUS_ITEM_NOT_FOUND_ERROR 

The specified item wasn't found.

STATUS_COUNT 

Number of return status.

Member Function Documentation

ComponentInterface* ComponentFactory::add_interface ( const CoreString name,
const CoreString doc = "" 
)
inline

Create a new empty interface with the specified name.

Note
If the interface already exists, a null pointer is returned.
Parameters
[in]nameof the interface.
[in]docbrief documentation.
Returns
The newly created interface if it doesn't exist, otherwise returns 0.
ComponentInterface * ComponentFactory::add_interface ( const CoreBasicArray< const ComponentInterface * > &  ifaces,
const CoreString name,
const CoreString doc = "" 
)

Create a new interface with the specified name.

Note
If the interface already exists, a null pointer is returned.
When specifying parent interfaces, properties can't be shadowed if the are from different types.
Parameters
[in]ifacesparent interfaces.
[in]nameof the interface.
Returns
The newly created interface if it doesn't exist, otherwise returns 0.
ComponentSchema * ComponentFactory::add_schema ( const ComponentInterface iface,
const CoreString name,
const CoreString doc = "" 
)

Create a new schema.

iface interface of the schema. name name of the schema. doc name of the schema.

Returns
The newly created schema.
const ComponentInterface * ComponentFactory::find_interface ( const CoreString name) const

Find the specified interface if it exists.

Parameters
[in]nameof the interface.
Returns
The requested interface if it exists, otherwise returns 0.
const ComponentSchema * ComponentFactory::find_schema ( const CoreString name) const

Find the specified interface if it exists.

Parameters
[in]nameof the interface.
Returns
The requested interface if it exists, otherwise returns 0.
const ComponentInterface* ComponentFactory::get_interface ( const CoreString name) const
inline

Return the specified interface.

Parameters
[in]nameof the interface.
Returns
The requested interface if it exists, otherwise returns 0.
ComponentProxy ComponentFactory::get_proxy ( const ComponentInterface iface,
CoreBaseObject instance 
) const

Get the implementation for a specific class to this interface.

Parameters
[in]ifaceInterface to get the implementation from
[in]instanceinstance of a class for which an implementation of the interface is defined.
Returns
The implementation proxy. Check ComponentProxy::get_implementation to check if the implementation exists.
ComponentProxy ComponentFactory::get_proxy ( const ComponentSchema schema,
CoreBaseObject instance 
) const

Get the implementation for a specific class to a specific schema.

Parameters
[in]schemaSchema to get the implementation from
[in]instanceinstance of a class for which an implementation of the schema is defined.
Returns
The implementation proxy if successful, null otherwise. Check ComponentProxy::get_implementation to check if the implementation exists.
const ComponentSchema* ComponentFactory::get_schema ( const CoreString name) const
inline

Return the specified interface.

Parameters
[in]nameof the interface.
Returns
The requested interface if it exists, otherwise returns 0.
const char * ComponentFactory::get_status_message ( const ComponentStatus status)
static

Return return status message.

Parameters
[in]statusstatus
const char * ComponentFactory::get_status_name ( const ComponentStatus status)
static

Return the status as string.

Parameters
[in]statusstatus
bool ComponentFactory::has_implementation ( const ComponentInterface itf,
const CoreClassInfo class_info 
)

Return the specified components from the component path.

Parameters
[in]component_pathpath to the component(s).
[in]instanceroot instance of schema hierarchy.
[out]componentsrequested component if successful.
Returns
STATUS_OK if succeeded, otherwise return an error.
Note
The syntax of component_path must follow this rule: schema_name[component_idx].sub_schema_name[component_idx]...
bool ComponentFactory::set_implementation ( const ComponentInterface iface,
const CoreClassInfo class_info,
ComponentImplementation impl 
)

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

Parameters
[in]ifaceinterface that will get the implementation
[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 and interface.
bool ComponentFactory::set_implementation ( const ComponentSchema schema,
const CoreClassInfo class_info,
ComponentImplementation impl 
)

Set the implementation for a specific class to the interface of the specified schema.

Parameters
[in]schemaSchema that will get the implementation
[in]class_infoCoreClassInfo for which the implementation of the schema 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 and schema.