CdsObject Class Reference

Generic object in the Content Directory. More...

#include <cds_objects.h>

Inheritance diagram for CdsObject:
zmm::Object CdsContainer CdsItem CdsActiveItem CdsItemExternalURL CdsItemInternalURL

Public Member Functions

 CdsObject ()
 Constructor. Sets the default values.
void setID (int id)
 Set the object ID.
int getID ()
 Retrieve the object ID.
void setRefID (int refID)
 Set the reference object ID.
int getRefID ()
 Retrieve the reference object ID.
void setParentID (int parentID)
 Set the parent ID of the object.
int getParentID ()
 Retrieve the objects parent ID.
void setRestricted (bool restricted)
 Set the restricted flag.
bool isRestricted ()
 Query the restricted flag.
void setTitle (zmm::String title)
 Set the object title (dc:title).
zmm::String getTitle ()
 Retrieve the title.
void setClass (zmm::String upnpClass)
 set the upnp:class
zmm::String getClass ()
 Retrieve class.
void setLocation (zmm::String location)
 Set the physical location of the media (usually an absolute path).
zmm::String getLocation ()
 Retrieve media location.
void setVirtual (bool virt)
 Set the virtual flag.
bool isVirtual ()
 Query the virtual flag.
unsigned int getObjectType ()
 Query information on object type: item, container, etc.
int getSortPriority ()
 Retrive sort priority setting.
void setSortPriority (int sortPriority)
 Set the sort prioroty of an object.
unsigned int getFlags ()
 Get flags of an object.
unsigned int getFlag (unsigned int mask)
 Get a flag of an object.
void setFlags (unsigned int objectFlags)
 Set flags for the object.
void setFlag (unsigned int mask)
 Set a flag of the object.
void changeFlag (unsigned int mask, bool value)
 Set a flag of the object.
void clearFlag (unsigned int mask)
 Clears a flag of the object.
zmm::String getMetadata (zmm::String key)
 Query single metadata value.
zmm::Ref< DictionarygetMetadata ()
 Query entire metadata dictionary.
void setMetadata (zmm::Ref< Dictionary > metadata)
 Set entire metadata dictionary.
void setMetadata (zmm::String key, zmm::String value)
 Set a single metadata value.
void removeMetadata (zmm::String key)
 Removes metadata with the given key.
zmm::String getAuxData (zmm::String key)
 Query single auxdata value.
zmm::Ref< DictionarygetAuxData ()
 Query entire auxdata dictionary.
void setAuxData (zmm::String key, zmm::String value)
 Set a single auxdata value.
void setAuxData (zmm::Ref< Dictionary > auxdata)
 Set entire auxdata dictionary.
void removeAuxData (zmm::String key)
 Removes auxdata with the given key.
int getResourceCount ()
 Get number of resource tags.
zmm::Ref< zmm::Array
< CdsResource > > 
getResources ()
 Query resources.
void setResources (zmm::Ref< zmm::Array< CdsResource > > res)
 Set resources.
zmm::Ref< CdsResourcegetResource (int index)
 Query resource tag with the given index.
void addResource (zmm::Ref< CdsResource > resource)
 Add resource tag.
void insertResource (int index, zmm::Ref< CdsResource > resource)
 Insert resource tag at index.
virtual void copyTo (zmm::Ref< CdsObject > obj)
 Copies all object properties to another object.
virtual int equals (zmm::Ref< CdsObject > obj, bool exactly=false)
 Checks if current object is equal to obj.
int resourcesEqual (zmm::Ref< CdsObject > obj)
 Checks if current object has the same resources as obj.
virtual void validate ()
 Checks if the minimum required parameters for the object have been set and are valid.
void optimize ()
 Frees unnecessary memory.
virtual zmm::String getVirtualPath ()=0
 Returns the path to the object as it appears in the database tree.
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static zmm::Ref< CdsObjectcreateObject (unsigned int objectType)
static zmm::String mapObjectType (int objectType)
static int remapObjectType (zmm::String objectType)
static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Attributes

int id
 ID of the object in the content directory.
int refID
 ID of the referenced object.
int parentID
 ID of the object's parent.
zmm::String title
 dc:title
zmm::String upnpClass
 upnp:class
zmm::String location
 Physical location of the media.
int virt
 virtual object flag
unsigned int objectType
 type of the object: item, container, etc.
unsigned int objectFlags
 field which can hold various flags for the object
int sortPriority
 flag that allows to sort objects within a container
zmm::Ref< Dictionarymetadata
zmm::Ref< Dictionaryauxdata
zmm::Ref< zmm::Array
< CdsResource > > 
resources
mt_atomic_t _ref_count
pthread_mutex_t mutex

Friends

int CdsObjectTitleComparator (void *arg1, void *arg2)

Detailed Description

Generic object in the Content Directory.

Definition at line 77 of file cds_objects.h.


Constructor & Destructor Documentation

CdsObject::CdsObject (  ) 

Constructor. Sets the default values.

Definition at line 44 of file cds_objects.cc.

References auxdata, INVALID_OBJECT_ID, metadata, OBJECT_FLAG_RESTRICTED, objectFlags, parentID, refID, resources, sortPriority, and virt.


Member Function Documentation

void CdsObject::addResource ( zmm::Ref< CdsResource resource  )  [inline]

Add resource tag.

Definition at line 260 of file cds_objects.h.

References resources.

void CdsObject::changeFlag ( unsigned int  mask,
bool  value 
) [inline]

Set a flag of the object.

Definition at line 199 of file cds_objects.h.

References clearFlag(), and setFlag().

Referenced by setRestricted(), and CdsContainer::setSearchable().

void CdsObject::clearFlag ( unsigned int  mask  )  [inline]

Clears a flag of the object.

Definition at line 202 of file cds_objects.h.

References objectFlags.

Referenced by changeFlag().

void CdsObject::copyTo ( zmm::Ref< CdsObject obj  )  [virtual]

Copies all object properties to another object.

Parameters:
obj target object (clone)

Definition at line 57 of file cds_objects.cc.

References auxdata, location, metadata, objectFlags, parentID, refID, resources, sortPriority, title, upnpClass, and virt.

Ref< CdsObject > CdsObject::createObject ( unsigned int  objectType  )  [static]
int CdsObject::equals ( zmm::Ref< CdsObject obj,
bool  exactly = false 
) [virtual]

Checks if current object is equal to obj.

Parameters:
obj object to check against
exactly tells to check really everything or only the "public" version

The difference between setting this flag to true or false is following: exactly=true checks all fields, also internal ones, exactly=false checks only the fields that will be visible in DIDL-Lite

Definition at line 73 of file cds_objects.cc.

References auxdata, isRestricted(), location, metadata, objectFlags, parentID, resourcesEqual(), sortPriority, title, upnpClass, and virt.

Referenced by CdsContainer::equals(), and CdsItem::equals().

zmm::Ref<Dictionary> CdsObject::getAuxData (  )  [inline]

Query entire auxdata dictionary.

Definition at line 229 of file cds_objects.h.

References auxdata.

zmm::String CdsObject::getAuxData ( zmm::String  key  )  [inline]

Query single auxdata value.

Definition at line 225 of file cds_objects.h.

References auxdata.

zmm::String CdsObject::getClass (  )  [inline]

Retrieve class.

Definition at line 163 of file cds_objects.h.

References upnpClass.

unsigned int CdsObject::getFlag ( unsigned int  mask  )  [inline]

Get a flag of an object.

Definition at line 190 of file cds_objects.h.

References objectFlags.

Referenced by isRestricted(), and CdsContainer::isSearchable().

unsigned int CdsObject::getFlags (  )  [inline]

Get flags of an object.

Definition at line 187 of file cds_objects.h.

References objectFlags.

int CdsObject::getID (  )  [inline]

Retrieve the object ID.

ID is the object ID that is used by the UPnP Content Directory service.

Definition at line 127 of file cds_objects.h.

References id.

Referenced by CdsContainer::getVirtualPath().

zmm::String CdsObject::getLocation (  )  [inline]

Retrieve media location.

Definition at line 169 of file cds_objects.h.

References location.

Referenced by CdsContainer::getVirtualPath().

zmm::Ref<Dictionary> CdsObject::getMetadata (  )  [inline]

Query entire metadata dictionary.

Definition at line 209 of file cds_objects.h.

References metadata.

zmm::String CdsObject::getMetadata ( zmm::String  key  )  [inline]

Query single metadata value.

Definition at line 205 of file cds_objects.h.

References metadata.

unsigned int CdsObject::getObjectType (  )  [inline]

Query information on object type: item, container, etc.

Definition at line 178 of file cds_objects.h.

References objectType.

int CdsObject::getParentID (  )  [inline]

Retrieve the objects parent ID.

Definition at line 145 of file cds_objects.h.

References parentID.

Referenced by CdsItem::getVirtualPath().

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

int CdsObject::getRefID (  )  [inline]

Retrieve the reference object ID.

This is the reference ID that is used by the UPnP Content Directory service. It also links the reference and the original objects in the database.

Definition at line 139 of file cds_objects.h.

References refID.

zmm::Ref<CdsResource> CdsObject::getResource ( int  index  )  [inline]

Query resource tag with the given index.

Definition at line 256 of file cds_objects.h.

References resources.

int CdsObject::getResourceCount (  )  [inline]

Get number of resource tags.

Definition at line 245 of file cds_objects.h.

References resources.

zmm::Ref<zmm::Array<CdsResource> > CdsObject::getResources (  )  [inline]

Query resources.

Definition at line 248 of file cds_objects.h.

References resources.

int CdsObject::getSortPriority (  )  [inline]

Retrive sort priority setting.

Definition at line 181 of file cds_objects.h.

References sortPriority.

zmm::String CdsObject::getTitle (  )  [inline]

Retrieve the title.

Definition at line 157 of file cds_objects.h.

References title.

Referenced by CdsItem::getVirtualPath().

virtual zmm::String CdsObject::getVirtualPath (  )  [pure virtual]

Returns the path to the object as it appears in the database tree.

Implemented in CdsItem, and CdsContainer.

void CdsObject::insertResource ( int  index,
zmm::Ref< CdsResource resource 
) [inline]

Insert resource tag at index.

Definition at line 264 of file cds_objects.h.

References resources.

bool CdsObject::isRestricted (  )  [inline]

Query the restricted flag.

Definition at line 151 of file cds_objects.h.

References getFlag(), and OBJECT_FLAG_RESTRICTED.

Referenced by equals().

bool CdsObject::isVirtual (  )  [inline]

Query the virtual flag.

Definition at line 175 of file cds_objects.h.

References virt.

Referenced by CdsContainer::getVirtualPath().

String CdsObject::mapObjectType ( int  objectType  )  [static]
void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

void CdsObject::optimize (  ) 

Frees unnecessary memory.

Definition at line 315 of file cds_objects.cc.

References auxdata, metadata, and resources.

void Object::release (  )  [inherited]
int CdsObject::remapObjectType ( zmm::String  objectType  )  [static]
void CdsObject::removeAuxData ( zmm::String  key  )  [inline]

Removes auxdata with the given key.

Definition at line 240 of file cds_objects.h.

References auxdata.

void CdsObject::removeMetadata ( zmm::String  key  )  [inline]

Removes metadata with the given key.

Definition at line 220 of file cds_objects.h.

References metadata.

int CdsObject::resourcesEqual ( zmm::Ref< CdsObject obj  ) 

Checks if current object has the same resources as obj.

Parameters:
obj object to check against

Definition at line 101 of file cds_objects.cc.

References resources.

Referenced by equals().

void Object::retain (  )  [inherited]
void CdsObject::setAuxData ( zmm::Ref< Dictionary auxdata  )  [inline]

Set entire auxdata dictionary.

Definition at line 236 of file cds_objects.h.

void CdsObject::setAuxData ( zmm::String  key,
zmm::String  value 
) [inline]

Set a single auxdata value.

Definition at line 232 of file cds_objects.h.

References auxdata.

void CdsObject::setClass ( zmm::String  upnpClass  )  [inline]

set the upnp:class

Definition at line 160 of file cds_objects.h.

void CdsObject::setFlag ( unsigned int  mask  )  [inline]

Set a flag of the object.

Definition at line 196 of file cds_objects.h.

References objectFlags.

Referenced by changeFlag().

void CdsObject::setFlags ( unsigned int  objectFlags  )  [inline]

Set flags for the object.

Definition at line 193 of file cds_objects.h.

void CdsObject::setID ( int  id  )  [inline]

Set the object ID.

ID is the object ID that is used by the UPnP Content Directory service.

Definition at line 122 of file cds_objects.h.

void CdsObject::setLocation ( zmm::String  location  )  [inline]

Set the physical location of the media (usually an absolute path).

Definition at line 166 of file cds_objects.h.

void CdsObject::setMetadata ( zmm::String  key,
zmm::String  value 
) [inline]

Set a single metadata value.

Definition at line 216 of file cds_objects.h.

References metadata.

void CdsObject::setMetadata ( zmm::Ref< Dictionary metadata  )  [inline]

Set entire metadata dictionary.

Definition at line 212 of file cds_objects.h.

void CdsObject::setParentID ( int  parentID  )  [inline]

Set the parent ID of the object.

Definition at line 142 of file cds_objects.h.

void CdsObject::setRefID ( int  refID  )  [inline]

Set the reference object ID.

This is the reference ID that is used by the UPnP Content Directory service. It also links the reference and the original objects in the database.

Definition at line 133 of file cds_objects.h.

void CdsObject::setResources ( zmm::Ref< zmm::Array< CdsResource > >  res  )  [inline]

Set resources.

Definition at line 252 of file cds_objects.h.

References resources.

void CdsObject::setRestricted ( bool  restricted  )  [inline]

Set the restricted flag.

Definition at line 148 of file cds_objects.h.

References changeFlag(), and OBJECT_FLAG_RESTRICTED.

void CdsObject::setSortPriority ( int  sortPriority  )  [inline]

Set the sort prioroty of an object.

Definition at line 184 of file cds_objects.h.

void CdsObject::setTitle ( zmm::String  title  )  [inline]

Set the object title (dc:title).

Definition at line 154 of file cds_objects.h.

void CdsObject::setVirtual ( bool  virt  )  [inline]

Set the virtual flag.

Definition at line 172 of file cds_objects.h.

void CdsObject::validate (  )  [virtual]

Checks if the minimum required parameters for the object have been set and are valid.

Reimplemented in CdsItem, CdsActiveItem, CdsItemExternalURL, CdsItemInternalURL, and CdsContainer.

Definition at line 115 of file cds_objects.cc.

References _, _Exception, string_ok(), title, and upnpClass.


Friends And Related Function Documentation

int CdsObjectTitleComparator ( void *  arg1,
void *  arg2 
) [friend]

Todo:
get rid of getTitle() to avod unnecessary reference counting ops

Definition at line 322 of file cds_objects.cc.


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]

Definition at line 111 of file cds_objects.h.

Referenced by CdsObject(), copyTo(), equals(), getAuxData(), optimize(), removeAuxData(), and setAuxData().

int CdsObject::id [protected]

ID of the object in the content directory.

Definition at line 81 of file cds_objects.h.

Referenced by getID().

pthread_mutex_t zmm::Object::mutex [protected, inherited]
unsigned int CdsObject::objectFlags [protected]

field which can hold various flags for the object

Definition at line 105 of file cds_objects.h.

Referenced by CdsObject(), clearFlag(), copyTo(), equals(), getFlag(), getFlags(), and setFlag().

unsigned int CdsObject::objectType [protected]
int CdsObject::parentID [protected]

ID of the object's parent.

Definition at line 87 of file cds_objects.h.

Referenced by CdsObject(), copyTo(), equals(), and getParentID().

int CdsObject::refID [protected]

ID of the referenced object.

Definition at line 84 of file cds_objects.h.

Referenced by CdsObject(), copyTo(), and getRefID().

int CdsObject::sortPriority [protected]

flag that allows to sort objects within a container

Definition at line 108 of file cds_objects.h.

Referenced by CdsObject(), copyTo(), equals(), and getSortPriority().

dc:title

Definition at line 90 of file cds_objects.h.

Referenced by copyTo(), equals(), getTitle(), and validate().

int CdsObject::virt [protected]

virtual object flag

Definition at line 99 of file cds_objects.h.

Referenced by CdsObject(), copyTo(), equals(), and isVirtual().


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

Generated on Fri Mar 26 20:16:56 2010 for MediaTomb by  doxygen 1.6.1