Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
OfObjectFactory Class Reference
Inheritance diagram for OfObjectFactory:
EventObject CoreCustomData CoreBaseObject CoreBaseType

Classes

class  Hierarchy
 
struct  Keyable
 

Public Member Functions

 OfObjectFactory (OfApp &application, const CoreVector< CoreString > &module_path)
 
void init_vars ()
 
void init_root_context ()
 
OfAppget_application () const
 
bool load (ParserFile &file, OfSerialOptions &options, unsigned int &loaded_object_count, unsigned int &loaded_context_count, AppProgressBar *progress_bar)
 
OfContextHandle get_build ()
 
OfConstContextHandle get_build () const
 
OfContextHandle get_root ()
 
OfConstContextHandle get_root () const
 
CoreVector< OfContext * > get_roots () const
 
OfContextHandle get_project ()
 
OfConstContextHandle get_project () const
 
OfContextHandle get_default ()
 
OfConstContextHandle get_default () const
 
OfContextHandle get_scene_assembly_container ()
 
OfConstContextHandle get_scene_assembly_container () const
 
OfConstContextHandle get_external_root () const
 
OfContextHandle get_external_root ()
 
OfConstContextHandle get_tools_root () const
 
OfContextHandle get_tools_root ()
 
OfConstContextHandle get_widgets_root () const
 
OfContextHandle get_widgets_root ()
 
OfContextHandle get_context (const CoreString &full_name) const
 
OfContextHandle context_exists (const CoreString &full_name) const
 
OfObjectHandle add_generic_object (const CoreString &object_name, const int &object_flags=OfObject::FLAG_NONE)
 
CoreVector< CoreStringget_shared_types (const CoreBasicArray< OfAttrHandle > &attr_handles)
 Get the list of types that are commonly accepted by all the incoming attributes. This list can end up to be empty.
 
CoreVector< CoreStringget_shared_types (const CoreBasicArray< CoreVector< CoreString > > &types_lists)
 Get the list of types that are commonly accepted by all the incoming type lists. This list can end up to be empty.
 
bool is_kindof (const CoreString &type_name, const CoreString &other_type_name)
 Return if type_name is a subtype of other_type_name.
 
OfObjectHandle add_object (const CoreString &object_name, const CoreString &class_name, const int &flags=OfObject::FLAG_NONE)
 
OfObjectHandle add_instance (const OfObject &source, const CoreString &name="", const int &flags=OfObject::FLAG_NONE)
 
OfObjectHandle get_object (const CoreString &object_name) const
 
OfObjectHandle object_exists (const CoreString &object_name) const
 
unsigned int get_object_count () const
 
void remove_object (const CoreString &object_name)
 
void remove_object (OfObject &object)
 
void remove_all_objects ()
 
OfEnumadd_enum (const CoreString &name, const unsigned int &invalid_value=0)
 
OfEnumget_enum (const CoreString &name) const
 
OfEnumenum_exists (const CoreString &name) const
 
const unsigned int & get_enum_count () const
 
OfEnumget_enum (const unsigned int &index) const
 
void remove_enum (const CoreString &name)
 
void remove_enum (const unsigned int &index)
 
void remove_all_enums ()
 
void reset ()
 reset the factory to its starting setup
 
void rename_object (OfObjectHandle object, const CoreString &new_name)
 
void rename_object (const CoreString &object, const CoreString &new_name)
 
OfAttrHandle find_attribute (const CoreString &path) const
 find an attribute by specifying its path
 
OfAttrHandle find_attribute (const CoreString &path, unsigned int &value_index) const
 find an attribute by specifying its path
 
OfAttrHandle find_attribute (const CoreString &path, bool &index_specified, unsigned int &value_index) const
 find an attribute by specifying its path
 
OfAttrHandle find_attribute (const CoreString &path, unsigned int &value_index, bool &is_array) const
 find an attribute by specifying its path
 
OfOutputHandle find_output_plug (const CoreString &path, unsigned int &plug_index) const
 find an output plug by specifying its path
 
void find_attribute_by_rule (CoreVector< OfAttr * > &retrieved_attrs, const CoreString &matching_rule, const bool &consider_embedded) const
 find a vector of attribute by specifying rule applied on the root context
 
void find_attribute_by_rule (CoreVector< OfAttr * > &retrieved_attrs, const CoreString &matching_rule, const OfContext &base_context, const bool &consider_embedded) const
 find a vector of attribute by specifying rule
 
bool is_attribute_matching_rule (const CoreString &prefix, const OfAttr *attribute, const CoreString &matching_rule) const
 checks if specified attribute and its parent object matches specified rule or not
 
bool is_attribute_matching_rule (const CoreString &prefix, const CoreString &object_full_name, const CoreString &attribute_name, const CoreString &matching_rule) const
 checks if specified attribute and its parent object matches specified rule or not
 
void get_objects (const CoreString &class_name, CoreArray< OfObjectHandle > &objects, const int &mask, const bool &inclusive=false) const
 
void get_all_objects (const CoreString &class_name, CoreArray< OfObjectHandle > &objects, const int &mask, const bool &inclusive=false) const
 
void get_objects (const CoreString &class_name, CoreArray< OfObjectHandle > &objects, const CoreBitFieldHelper &flags=OfItem::enabled_but_private_flags_mask) const
 
void get_all_objects (const CoreString &class_name, CoreArray< OfObjectHandle > &objects, const CoreBitFieldHelper &flags=OfItem::enabled_but_private_flags_mask) const
 
void get_objects (CoreArray< OfObjectHandle > &objects, const CoreBitFieldHelper &flags=OfItem::enabled_flags_mask) const
 
void get_all_objects (CoreArray< OfObjectHandle > &objects, const CoreBitFieldHelper &flags=OfItem::enabled_flags_mask) const
 
void get_items (const CoreBasicArray< CoreString > &items_names, CoreVector< OfItemHandle > &items)
 
void get_items (const CoreBasicArray< CoreString > &items_names, CoreArray< OfItemHandle > &items)
 
void get_all_objects (const CoreBasicArray< CoreString > &items_names, CoreSet< OfObjectHandle > &objects) const
 
OfItemHandle get_item (const CoreString &full_name) const
 get an item by specifying its full name
 
OfItemHandle item_exists (const CoreString &full_name) const
 get an item by specifying its full name
 
void remove_item (const CoreString &full_name)
 remove an item by specifying its full name
 
void remove_items (const CoreBasicArray< CoreString > &full_names, AppProgressBar *bar=0)
 
void remove_items (const CoreBasicArray< OfItemHandle > &items, AppProgressBar *bar=0)
 
OfContextget_common_context (const CoreVector< OfItemHandle > &items) const
 return the lowest common context shared by the given items
 
OfContextget_common_context (const CoreVector< OfContext * > &contexts) const
 return the lowest common context shared by the given contexts
 
OfContextget_common_context (const CoreVector< OfObjectHandle > &objects) const
 return the lowest common context shared by the given objects
 
OfClassFactoryget_classes () const
 
OfVarsget_vars () const
 
OfContextget_last_event_context () const
 
OfObjectHandle get_last_event_object () const
 
OfEnumget_last_event_enum () const
 
ResourceManager * get_resource_manager () const
 
void set_resource_manager (ResourceManager *manager)
 
OfTimeget_time () const
 
void on_application_evaluation_interrupted (OfApp &sender, const EventInfo &event, void *data)
 
void flush ()
 
const CoreVector
< OfObjectFactory::Keyable > & 
get_keyables () const
 
void set_key_to_keyables ()
 
void accept_keyables (const bool &flag)
 
unsigned int get_command_count () const
 
void add_command (Command_callback callback, OfCommandData *data, bool delete_data_after_use=true)
 
void remove_commands (Command_callback callback, OfCommandData *data)
 
void begin_protection_change ()
 
void end_protection_change ()
 
bool is_object_protected (const OfObject &object) const
 
void protect_objects (const CoreSet< OfObject * > &objects, const bool &protection_flag) const
 
const char * get_version_tag () const
 
bool get_copy_buffer (CoreString &copy_buffer, const CoreBasicArray< CoreString > &items_names, OfSerialOptions *options=nullptr, bool attach_resources=true)
 
bool get_copy_buffer_with_external_dependencies (CoreString &copy_buffer, const CoreBasicArray< CoreString > &items_names, OfSerialOptions &options, bool export_mode=false)
 
bool paste_copy_buffer (const CoreString &copy_buffer, OfContext &target_context, CoreVector< OfItemHandle > &created_items)
 
void get_statistics (SysStatistic &stats) const
 
void register_protection_callback (OfEndProtectionCallback cbk, void *data=0)
 add a callback that gets called when object protection ended
 
void unregister_protection_callback (OfEndProtectionCallback cbk, void *data=0)
 remove a registered callback
 
bool is_visible_item (const OfObject &item) const
 
bool is_visible_item (const OfContext &item) const
 
void get_items_dependencies (const CoreBasicArray< OfItemHandle > &objects, CoreVector< OfItemHandle > &output_items, const bool &recursive=false) const
 
void get_items_inputs (const CoreBasicArray< OfItemHandle > &objects, CoreVector< OfItemHandle > &output_items, const bool &recursive=false) const
 
void get_items_outputs (const CoreBasicArray< OfItemHandle > &objects, CoreVector< OfItemHandle > &output_items, const bool &recursive=false) const
 
void get_items_instances (const CoreBasicArray< OfItemHandle > &items, CoreVector< OfItemHandle > &output_items, const bool &recursive=false) const
 
void get_items_sources (const CoreBasicArray< OfItemHandle > &items, CoreVector< OfItemHandle > &output_items, const bool &recursive=false) const
 
void set_deserialize_mode (const bool &state)
 
bool is_deserialize_mode () const
 
void register_hierarchy (const CoreString &root_name, Hierarchy *hierarchy)
 
void unregister_hierarchy (const CoreString &root_name)
 
Hierarchyget_hierarchy (const CoreString &full_name) const
 
- Public Member Functions inherited from EventObject
 EventObject ()
 Constructor.
 
 EventObject (const EventObject &src)
 Copy Constructor.
 
virtual ~EventObject () override
 Destructor.
 
void connect (EventObject &sender, const CoreString &event_id, EventInfoMethod event_cb, void *data=0)
 Connects this to an object to listen to a specific event.
 
void connect (EventObject &sender, EventInfoMethod event_cb, void *data=0)
 Connects this to an object to listen any of its events.
 
bool disconnect (EventObject &sender, const CoreString &event_id, EventInfoMethod event_cb, void *data=0)
 
bool disconnect_all (EventObject &sender)
 Disconnects from all objects sender was listening on.
 
void disconnect_all ()
 Disconnects from all objects we were listening on.
 
void remove_all_connection ()
 Disconnects object from other objects it is listening to, and also disconnects all objects listening to it.
 
void raise_event (const CoreString &event_id) const
 sends an event
 
void raise_event (const EventInfo &event_info) const
 sends an event
 
bool is_connected (EventObject &sender, const CoreString &event_id, void *data)
 
void set_mute (const bool &mute)
 Asks for object muting. This will increase or decrease the muting counter. Unmuting may not be immediat since it will happen only when counter reaches 0.
 
bool is_mute () const
 Returns if object is muted.
 
CoreArray< EventObject * > get_senders () const
 
unsigned int get_sender_count () const
 
unsigned int get_receiver_count () const
 
virtual size_t get_memory_size () const override
 
void connect (EventObject &sender, const CoreString &event_id, EventMethod event_cb, void *data=0)
 Connects this to an object to listen to a specific event.
 
void connect (EventObject &sender, EventMethod event_cb, void *data=0)
 Connects this to an object to listen any of its events.
 
bool disconnect (EventObject &sender, const CoreString &event_id, EventMethod event_cb, void *data=0)
 Disconnects this from an object for a specific event.
 
- Public Member Functions inherited from CoreCustomData
 CoreCustomData (const CoreCustomData &src)
 
void add_custom_data (void *key, const bool &data)
 
void add_custom_data (void *key, const int &data)
 
void add_custom_data (void *key, const unsigned int &data)
 
void add_custom_data (void *key, const char *data)
 
void add_custom_data (void *key, const CoreString &data)
 
void add_custom_data (void *key, const double &data)
 
void add_custom_data (void *key, void *data)
 
void remove_custom_data (void *key)
 
void remove_all_custom_data ()
 
void set_custom_data (void *key, const bool &data)
 
void set_custom_data (void *key, const int &data)
 
void set_custom_data (void *key, const unsigned int &data)
 
void set_custom_data (void *key, const double &data)
 
void set_custom_data (void *key, const char *data)
 
void set_custom_data (void *key, const CoreString &data)
 
void set_custom_data (void *key, void *data)
 
void get_custom_data (void *key, bool &data) const
 
void get_custom_data (void *key, int &data) const
 
void get_custom_data (void *key, unsigned int &data) const
 
void get_custom_data (void *key, double &data) const
 
void get_custom_data (void *key, CoreString &data) const
 
void get_custom_data (void *key, void *&data) const
 
- Public Member Functions inherited from CoreBaseObject
bool is_kindof (const CoreBaseObject &object) const
 
CoreString get_class_info_name () const
 
const unsigned long & get_class_info_id () const
 
virtual bool is_kindof (const CoreClassInfo &cinfo) const
 
virtual const CoreClassInfoget_class_info () 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
 

Static Public Member Functions

static const CoreStringget_build_name ()
 
static const CoreStringget_project_name ()
 
static const CoreStringget_default_name ()
 
static const CoreStringget_scene_assembly_container_name ()
 
static const CoreStringget_external_root_name ()
 
static const CoreStringget_tools_root_name ()
 
static const CoreStringget_widgets_root_name ()
 
static void get_items_names (const CoreBasicArray< OfItemHandle > &items, CoreVector< CoreString > &items_names)
 
static const double & get_version ()
 
static void register_directives (OfApp &app)
 
static CoreString get_project_name (const CoreString &build_name)
 
- Static Public Member Functions inherited from EventObject
static void connect (EventObject &sender, const CoreString &event_id, EventObject &receiver, EventInfoMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, EventObject &receiver, EventInfoMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, const CoreString &event_id, EventInfoFunction event_cb, void *data=0)
 Connects to an object to listen to a specific event.
 
static void connect (EventObject &sender, EventInfoFunction event_cb, void *data=0)
 Connects to an object to listen any of its events.
 
static bool disconnect (EventObject &sender, const CoreString &event_id, EventInfoFunction event_cb, void *data=0)
 
static void raise_event (EventObject &sender, const CoreString &event_id)
 Sends an event.
 
static void raise_event (EventObject &sender, const EventInfo &event_info)
 Sends an event.
 
static void connect (EventObject &sender, const CoreString &event_id, EventFunction event_cb, void *data=0)
 Connects to an object to listen to a specific event.
 
static void connect (EventObject &sender, EventFunction event_cb, void *data=0)
 Connects to an object to listen any of its events.
 
static void connect (EventObject &sender, const CoreString &event_id, EventObject &receiver, EventMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, EventObject &receiver, EventMethod event_cb, void *data=0)
 Static version of the above function.
 
static bool disconnect (EventObject &sender, const CoreString &event_id, EventFunction event_cb, void *data=0)
 Disconnects this from an object for a specific event.
 
- Static Public Member Functions inherited from CoreCustomData
static void * get_custom_data_key (const CoreString &key)
 
- Static Public Member Functions inherited from CoreBaseObject
static const CoreClassInfoclass_info ()
 
template<class T >
static T * cast (CoreBaseObject *object)
 
template<class T >
static const T * cast (const CoreBaseObject *object)
 
- Static Public Member Functions inherited from CoreBaseType
static const CoreClassInfoclass_info ()
 Get the type descriptor of this instance.
 

Friends

class AppEvalManager
 
class CtxEval
 
class OfAttr
 
class OfAttrTable
 
class OfClass
 
class OfClassFactory
 
class OfContext
 
class OfEnum
 
class OfObject
 
class OfTime
 
class PasteItemsCmd
 

Additional Inherited Members

- Public Types inherited from EventObject
typedef void(* EventInfoFunction )(EventObject &, const EventInfo &, void *)
 event callback signature for free functions / static methods.
 
typedef void(EventObject::* EventInfoMethod )(EventObject &, const EventInfo &, void *)
 event callback signature for methods.
 
typedef void(* EventFunction )(EventObject &, const CoreString &, void *)
 
typedef void(EventObject::* EventMethod )(EventObject &, const CoreString &, void *)
 

Detailed Description

Factory class used to manipulate object, context and attribute in the object framework.

Member Function Documentation

OfAttrHandle OfObjectFactory::find_attribute ( const CoreString path) const

find an attribute by specifying its path

Parameters
paththe path to the attribute
Returns
0 if the attribute is not found
OfAttrHandle OfObjectFactory::find_attribute ( const CoreString path,
unsigned int &  value_index 
) const

find an attribute by specifying its path

Parameters
paththe path to the attribute
value_indexthe attribute value index extracted from the path
Returns
0 if the attribute is not found
OfAttrHandle OfObjectFactory::find_attribute ( const CoreString path,
bool &  index_specified,
unsigned int &  value_index 
) const

find an attribute by specifying its path

Parameters
paththe path to the attribute
value_indexthe attribute value index extracted from the path
index_specifiedis setted to true if the attribute value index can have been extracted from the path
Returns
0 if the attribute is not found
OfAttrHandle OfObjectFactory::find_attribute ( const CoreString path,
unsigned int &  value_index,
bool &  is_array 
) const

find an attribute by specifying its path

Parameters
paththe path to the attribute
value_indexthe attribute value index extracted from the path
is_arraytell whether the attribute is an array or not
Returns
0 if the attribute is not found
void OfObjectFactory::find_attribute_by_rule ( CoreVector< OfAttr * > &  retrieved_attrs,
const CoreString matching_rule,
const bool &  consider_embedded 
) const

find a vector of attribute by specifying rule applied on the root context

Parameters
theresult of the search as a vector of attribute
therule to filter objects and attribute
specifiesto consider or not embedded objects
void OfObjectFactory::find_attribute_by_rule ( CoreVector< OfAttr * > &  retrieved_attrs,
const CoreString matching_rule,
const OfContext base_context,
const bool &  consider_embedded 
) const

find a vector of attribute by specifying rule

Parameters
theresult of the search as a vector of attribute
therule to filter objects and attribute
thebase context where to start searching if rule is relative
specifiesto consider or not embedded objects
OfOutputHandle OfObjectFactory::find_output_plug ( const CoreString path,
unsigned int &  plug_index 
) const

find an output plug by specifying its path

Parameters
paththe path to the plug
plug_indexthe plug index if found
Returns
0 if the plug is not found
OfContext & OfObjectFactory::get_common_context ( const CoreVector< OfItemHandle > &  items) const

return the lowest common context shared by the given items

Returns
root context if no item is specified
OfContext & OfObjectFactory::get_common_context ( const CoreVector< OfContext * > &  contexts) const

return the lowest common context shared by the given contexts

Returns
root context if no context is specified
OfContext & OfObjectFactory::get_common_context ( const CoreVector< OfObjectHandle > &  objects) const

return the lowest common context shared by the given objects

Returns
root context if no object is specified
OfObjectFactory::Hierarchy * OfObjectFactory::get_hierarchy ( const CoreString full_name) const

If the given item path corresponds to a defined hierarchy path, it returns a structure of this hierarchy

Parameters
full_nameThe item path
OfItemHandle OfObjectFactory::get_item ( const CoreString full_name) const

get an item by specifying its full name

Returns
0 if the item is not found
CoreString OfObjectFactory::get_project_name ( const CoreString build_name)
static

returns the corresponding project full name given the build full name of an item

CoreVector< CoreString > OfObjectFactory::get_shared_types ( const CoreBasicArray< OfAttrHandle > &  attr_handles)

Get the list of types that are commonly accepted by all the incoming attributes. This list can end up to be empty.

Parameters
[in]attributehandles of the related attributes
Returns
a vector containing 0 or n types which are common to all incoming attribute handles
CoreVector< CoreString > OfObjectFactory::get_shared_types ( const CoreBasicArray< CoreVector< CoreString > > &  types_lists)

Get the list of types that are commonly accepted by all the incoming type lists. This list can end up to be empty.

Parameters
[in]attributehandles of the related attributes
Returns
a vector containing 0 or n types which are common to all incoming attribute handles
const char * OfObjectFactory::get_version_tag ( ) const

Get the file version tag associated to the current running license flavor.

Returns
the version tag string, or nullptr if flavir is invalid.
bool OfObjectFactory::is_attribute_matching_rule ( const CoreString prefix,
const OfAttr attribute,
const CoreString matching_rule 
) const

checks if specified attribute and its parent object matches specified rule or not

Parameters
fora relative rule, need to provide the name prefix the rule is relative to
theattribute to check
therule to test the attribute with
Returns
returns true if the attribute matches specified rule, false otherwise
bool OfObjectFactory::is_attribute_matching_rule ( const CoreString prefix,
const CoreString object_full_name,
const CoreString attribute_name,
const CoreString matching_rule 
) const

checks if specified attribute and its parent object matches specified rule or not

Parameters
fora relative rule, need to provide the name prefix the rule is relative to
thefull name of the parent object
thename of the attribute to check
therule to test the attribute with
Returns
returns true if the attribute matches specified rule, false otherwise
OfItemHandle OfObjectFactory::item_exists ( const CoreString full_name) const

get an item by specifying its full name

Returns
0 if the item is not found
void OfObjectFactory::register_hierarchy ( const CoreString root_name,
Hierarchy hierarchy 
)

Register a new hierarchy on this factory

Parameters
root_nameThe name of the hierarchy root (example : "project:/")
callbackCallback return a structure of the hierarchy (see : OfObjectFactory::Hierarchy)
void OfObjectFactory::register_protection_callback ( OfEndProtectionCallback  cbk,
void *  data = 0 
)

add a callback that gets called when object protection ended

Parameters
cbkfunction callback to be called
dataoptionnal data passed to the callback
Note
this method should be exclusively used by experienced users. This method isn't thread safe!
void OfObjectFactory::remove_item ( const CoreString full_name)

remove an item by specifying its full name

Note
does nothing if the item is not found
void OfObjectFactory::reset ( void  )

reset the factory to its starting setup

Note
this method is used by 'New Project'
void OfObjectFactory::unregister_hierarchy ( const CoreString root_name)

Remove a hierarchy that was registered on this factory

Parameters
root_nameThe name of the hierarchy root (example : "project:/")
void OfObjectFactory::unregister_protection_callback ( OfEndProtectionCallback  cbk,
void *  data = 0 
)

remove a registered callback

Parameters
cbkfunction callback that was registered
dataoptionnal data that was passed when the callback was registered
Note
this method should be exclusively used by experienced users. In the event there were multiple registrations of a same callback, only the first occurence is removed. This method isn't thread safe!