All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Signals | Public Member Functions
Qtilities::Core::Interfaces::IObjectManager Class Reference

Interface used to communicate with the object manager, directly accessable through the OBJECT_MANAGER macro. More...

#include <IObjectManager.h>

Inheritance diagram for Qtilities::Core::Interfaces::IObjectManager:
Inheritance graph
[legend]

List of all members.

Public Types

enum  PropertyTypes {
  NoProperties = 0, MultiContextProperties = 1, SharedProperties = 2, QtilitiesInternalProperties = 4,
  NonQtilitiesProperties = 8
}
 Possible property types. More...

Signals

void metaTypeActiveObjectsChanged (QList< QPointer< QObject > > objects, const QString &meta_type)
 Signal which is emitted when the setMetaTypeActiveObjects() is finished.
void newObjectAdded (QObject *obj)
 Signal which is emitted when a new object is added to the global object pool.
void objectRemoved (QObject *obj)
 Signal which is emitted when an object is removed from the global object pool.

Public Member Functions

virtual QStringList allFactoryNames () const =0
 Provides a list with the names of all the factories registered in the object manager.
virtual QList< QPointer
< QObject > > 
metaTypeActiveObjects (const QString &meta_type) const =0
 Returns the active object(s) for a specific meta type. If the meta type does not exist, an empty list is returned.
virtual bool moveSubjects (QList< QObject * > objects, int source_observer_id, int destination_observer_id, QString *error_msg=0, bool silent=false)=0
 A function which moves a list of objects from one observer to another observer.
virtual bool moveSubjects (QList< QPointer< QObject > > objects, int source_observer_id, int destination_observer_i, QString *error_msg=0, bool silent=false)=0
 Move subjects by providing the objects as a list with smart pointers.
virtual ObserverobjectPool ()=0
 Function which returns a reference to the global object pool.
virtual ObserverobserverReference (int id) const =0
 Gets the reference to an observer.
virtual IFactoryProviderreferenceIFactoryProvider (const QString &factory_name) const =0
 Provides a reference to the factory interface for a specific factory.
virtual QList< QObject * > registeredInterfaces (const QString &iface) const =0
 Returns all objects in the global object pool which implements the specified interface.
virtual void registerFactoryInterface (FactoryInterface< QObject > *factory_interface, FactoryItemID iface_tag)=0
 Registers a factory interface inside the Qtilities factory.
virtual bool registerIFactoryProvider (IFactoryProvider *obj)=0
 Registers a factory interface in the object manager.
virtual void registerObject (QObject *obj, QtilitiesCategory category=QtilitiesCategory())=0
 Registers an object to be included in the global object pool.
virtual int registerObserver (Observer *observer)=0
 Registers an observer in the observer manager.
virtual void removeObject (QObject *obj)=0
 Removes an object to from the global object pool.
virtual void setMetaTypeActiveObjects (QList< QObject * > objects, const QString &meta_type)=0
 Updates the active object(s) for a specific meta type.
virtual void setMetaTypeActiveObjects (QList< QPointer< QObject > > objects, const QString &meta_type)=0
 Update the active object(s) for a specific meta type by providing a list of smart pointers to the objects.
virtual QStringList tagsForFactory (const QString &factory_name) const =0
 Provides a list of all the tags registered in a specific factory.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IFactoryProvider
virtual QtilitiesCategory categoryForTag (const QString &factory_name, const QString &factory_tag, bool *ok=0) const =0
 Provides the category of the specified tag.
virtual QObject * createInstance (const InstanceFactoryInfo &ifactory_data)=0
 Constructs an instance in a specified factory and return it.
virtual QStringList providedFactories () const =0
 Provides the names of all the factories exposed through this interface.
virtual QStringList providedFactoryTags (const QString &factory_name, const QtilitiesCategory &category_filter=QtilitiesCategory(), bool *ok=0) const =0
 Provides the tags in a specific factory.
virtual QMap< QString,
QtilitiesCategory
tagCategoryMap (const QString &factory_name, bool *ok=0) const =0
 Provides the full tag and category map for the given factory.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
virtual QObject * objectBase ()=0
 Returns the QObject* base of the interface.
virtual const QObject * objectBase () const =0
 Returns a const QObject* base of the interface.
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.

Detailed Description

Interface used to communicate with the object manager, directly accessable through the OBJECT_MANAGER macro.


Member Enumeration Documentation

Possible property types.

Enumerator:
NoProperties 

No properties.

MultiContextProperties 

Multi context properties.

See also:
MultiContextProperty
SharedProperties 

Shared properties.

See also:
SharedProperty
QtilitiesInternalProperties 

Internal Qtilities properties properties.

See also:
SharedProperty
NonQtilitiesProperties 

Normal QVariant properties added to objects using QObject::setProperty().


Member Function Documentation

virtual QList<QPointer<QObject> > Qtilities::Core::Interfaces::IObjectManager::metaTypeActiveObjects ( const QString &  meta_type) const
pure virtual

Returns the active object(s) for a specific meta type. If the meta type does not exist, an empty list is returned.

For more information about see the Global object activity management section of the Object Management article.

See also:
setMetaTypeActiveObjects(), metaTypeActiveObjectsChanged()

Implemented in Qtilities::Core::ObjectManager.

virtual bool Qtilities::Core::Interfaces::IObjectManager::moveSubjects ( QList< QObject * >  objects,
int  source_observer_id,
int  destination_observer_id,
QString *  error_msg = 0,
bool  silent = false 
)
pure virtual

A function which moves a list of objects from one observer to another observer.

This function will attempt to move subjects from one observer context to another. If any of the subjects cannot be attached, it will be skipped and attempt to move the next subject in the list. If any of the subjects could not be attached, the function will return false. If all subjects was moved successfully the function will return true.

Parameters:
objectsThe objects which must be moved.
source_observer_idThe source observer ID.
destination_observer_idThe destination observer ID.
error_msgWhen valid it will be populated with any error messages produced during the move operation.
silentWhen true the subjects must be moved without showing any dialogs.
Returns:
True if all objects were moved successfully, false if some of the objects failed.

Implemented in Qtilities::Core::ObjectManager.

virtual bool Qtilities::Core::Interfaces::IObjectManager::moveSubjects ( QList< QPointer< QObject > >  objects,
int  source_observer_id,
int  destination_observer_i,
QString *  error_msg = 0,
bool  silent = false 
)
pure virtual

Move subjects by providing the objects as a list with smart pointers.

This function will attempt to move subjects from one observer context to another. If any of the subjects cannot be attached, it will be skipped and attempt to move the next subject in the list. If any of the subjects could not be attached, the function will return false. If all subjects was moved successfully the function will return true.

Parameters:
objectsThe objects which must be moved.
source_observer_idThe source observer ID.
destination_observer_idThe destination observer ID.
error_msgWhen valid it will be populated with any error messages produced during the move operation.
silentWhen true the subjects must be moved without showing any dialogs.
Returns:
True if all objects were moved successfully, false if some of the objects failed.

Implemented in Qtilities::Core::ObjectManager.

virtual Observer* Qtilities::Core::Interfaces::IObjectManager::objectPool ( )
pure virtual

Function which returns a reference to the global object pool.

Care should be taken when using the object pool observer. You should for example not delete all the subjects in the pool unless you know what you are doing.

It is recommended to use registerObject() and registeredInterfaces() instead of the object pool directly, unless you require the use of additional functions on the object pool, like displaying it using an ObserverWidget.

Note:
The global object pool is in a processing cycle by default. Thus if you want to display it, you need to call endProcessingCycle() on it and refreshViewsLayout().

Implemented in Qtilities::Core::ObjectManager.

virtual Observer* Qtilities::Core::Interfaces::IObjectManager::observerReference ( int  id) const
pure virtual

Gets the reference to an observer.

Parameters:
idThe observer id of the observer for which the reference must be fetched.
Returns:
The observer with the specified id. If the id is invalid 0 is returned.

Implemented in Qtilities::Core::ObjectManager.

virtual IFactoryProvider* Qtilities::Core::Interfaces::IObjectManager::referenceIFactoryProvider ( const QString &  factory_name) const
pure virtual

Provides a reference to the factory interface for a specific factory.

This function returns the IFactoryProvider interface which contains the specified factory.

Implemented in Qtilities::Core::ObjectManager.

virtual QList<QObject*> Qtilities::Core::Interfaces::IObjectManager::registeredInterfaces ( const QString &  iface) const
pure virtual

Returns all objects in the global object pool which implements the specified interface.

For example:

// Get a list of all the project items in the object pool, that is objects
// implementing the IProjectItem interface:
QList<QObject*> projectItemObjects = OBJECT_MANAGER->registeredInterfaces("com.Qtilities.ProjectManagement.IProjectItem/1.0");
QList<IProjectItem*> projectItems;
// Cast all items:
for (int i = 0; i < projectItemObjects.count(); i++) {
IProjectItem* part = qobject_cast<IProjectItem*> (projectItemObjects.at(i));
if (part)
projectItems.append(part);
}

Implemented in Qtilities::Core::ObjectManager.

virtual bool Qtilities::Core::Interfaces::IObjectManager::registerIFactoryProvider ( IFactoryProvider obj)
pure virtual

Registers a factory interface in the object manager.

The object manager keeps track of all IFactoryProvider interfaces registered using this function. It is then possible to access the IFactoryProvider interface for a specific factory using the referenceIFactoryProvider() function.

The way that the object manager keeps track of factories and their respective IFactoryProvider interfaces is done in such a way that factory names exposed by IFactoryProvider must be unique for all IFactoryProvider interfaces registered using this function.

If a duplicate factory name is found, an error is printed and this function returns false.

Implemented in Qtilities::Core::ObjectManager.

virtual void Qtilities::Core::Interfaces::IObjectManager::registerObject ( QObject *  obj,
QtilitiesCategory  category = QtilitiesCategory() 
)
pure virtual

Registers an object to be included in the global object pool.

Parameters:
categoryThe category under which the object must be registered. This parameter can be left out in most cases, however it is usefull when visualizing the global object pool using the Qtilities::Plugins::Debug plugin for example.
Returns:
The integer value returned will be the object's unique ID in the global object pool.

Implemented in Qtilities::Core::ObjectManager.

virtual void Qtilities::Core::Interfaces::IObjectManager::removeObject ( QObject *  obj)
pure virtual

Removes an object to from the global object pool.

This function will detach the object from the global object pool observer. It will not however delete the object, it will just detach it.

Implemented in Qtilities::Core::ObjectManager.

virtual void Qtilities::Core::Interfaces::IObjectManager::setMetaTypeActiveObjects ( QList< QObject * >  objects,
const QString &  meta_type 
)
pure virtual

Updates the active object(s) for a specific meta type.

For more information about see the Global object activity management section of the Object Management article.

See also:
metaTypeActiveObjects(), metaTypeActiveObjectsChanged()

Implemented in Qtilities::Core::ObjectManager.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé