cUPnPObjectFactory Class Reference

#include <object.h>

Collaboration diagram for cUPnPObjectFactory:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void registerMediator (const char *UPnPClass, cMediatorInterface *Mediator)
void unregisterMediator (const char *UPnPClass, bool freeMediator=true)
cUPnPClassObjectcreateObject (const char *UPnPClass, const char *Title, bool Restricted=true)
cUPnPClassObjectgetObject (cUPnPObjectID ID)
int saveObject (cUPnPClassObject *Object)
int deleteObject (cUPnPClassObject *Object)
int clearObject (cUPnPClassObject *Object)

Static Public Member Functions

static cUPnPObjectFactorygetInstance ()


Detailed Description

The object factory

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.


Member Function Documentation

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

Returns:
returns
  • <0, in case of an error
  • 0, otherwise
Parameters:
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.

Returns:
the newly created object
Parameters:
Title the title of that object
Restricted the restriction of the object

Parameters:
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

Returns:
returns
  • <0, in case of an error
  • 0, otherwise
Parameters:
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.

Returns:
the instance of the factory

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.

Returns:
the object, found in the database
Parameters:
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.

Parameters:
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.

Returns:
returns
  • <0, in case of an error
  • 0, otherwise
Parameters:
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.

Parameters:
UPnPClass the class of the associated mediator
freeMediator flag to indicate if the mediator shall be free'd after removing


The documentation for this class was generated from the following files:

Generated on Sun Nov 8 15:44:09 2009 for UPnP/DLNA plugin for VDR by  doxygen 1.5.8