#include <object.h>
Public Member Functions | |
void | registerMediator (const char *UPnPClass, cMediatorInterface *Mediator) |
void | unregisterMediator (const char *UPnPClass, bool freeMediator=true) |
cUPnPClassObject * | createObject (const char *UPnPClass, const char *Title, bool Restricted=true) |
cUPnPClassObject * | getObject (cUPnPObjectID ID) |
int | saveObject (cUPnPClassObject *Object) |
int | deleteObject (cUPnPClassObject *Object) |
int | clearObject (cUPnPClassObject *Object) |
Static Public Member Functions | |
static cUPnPObjectFactory * | getInstance () |
This factory can create, delete, clear or save UPnP objects. It uses mediators to communicate with the persistance database to load or persist the objects.
If a new type of object shall be stored in the database an according mediator is needed, which knows the internal database structure. It must implement the cMediatorInterface class to work with this factory.
int cUPnPObjectFactory::clearObject | ( | cUPnPClassObject * | Object | ) |
Clears the object
This clears the object, i.e. all its children will be removed and deleted from the database
<0
, in case of an error0
, otherwise Object | the object to be cleared |
cUPnPClassObject * cUPnPObjectFactory::createObject | ( | const char * | UPnPClass, | |
const char * | Title, | |||
bool | Restricted = true | |||
) |
Creates an object
This creates a new UPnP object with the specific title and the restriction.
Title | the title of that object | |
Restricted | the restriction of the object |
UPnPClass | the class of the new object |
int cUPnPObjectFactory::deleteObject | ( | cUPnPClassObject * | Object | ) |
Deletes the object
This deletes the object in the database by removing all its children and then deleting the contents from the database
<0
, in case of an error0
, otherwise Object | the object to be deleted |
cUPnPObjectFactory * cUPnPObjectFactory::getInstance | ( | ) | [static] |
Return the instance of the factory
This returns the instance of the factory. When the media database is initialized successfully, it usally has all known mediators already registered.
cUPnPClassObject * cUPnPObjectFactory::getObject | ( | cUPnPObjectID | ID | ) |
Get an object
Retrieves a UPnP object from the database and stores its information in the object. The object is obtained via its object ID.
ID | the object ID |
void cUPnPObjectFactory::registerMediator | ( | const char * | UPnPClass, | |
cMediatorInterface * | Mediator | |||
) |
Register a mediator
This registers a new mediator by the associated class. The mediator must implement the cMediatorInterface class to be used with this factory.
UPnPClass | the class of which the mediator is associated to | |
Mediator | the mediator itself |
int cUPnPObjectFactory::saveObject | ( | cUPnPClassObject * | Object | ) |
Saves the object
This saves the object in the database by updating the values in the database with those in the object.
<0
, in case of an error0
, otherwise Object | the object to be saved |
void cUPnPObjectFactory::unregisterMediator | ( | const char * | UPnPClass, | |
bool | freeMediator = true | |||
) |
Unregisters a mediator
This unregisters a mediator if it is not needed anylonger. If the optional parameter freeMediator
is set, the object instance will be free'd after removing it from the list.
UPnPClass | the class of the associated mediator | |
freeMediator | flag to indicate if the mediator shall be free'd after removing |