Arxx::ItemFactory Class Reference

#include <ItemFactory.h>

Inheritance diagram for Arxx::ItemFactory:

Inheritance graph
[legend]
List of all members.

Detailed Description

An abstract definition of an item factory.

This class serves as an abstract entity to create Arxx::Item objects. It is not necessary to create items via an item factory. On the contrary it is quite possible to create them using new or as stack objects but whenever a library creates an item (for example while loading a library file) it will use an item factory.

Note:
A difficult issue is connected with the ItemFactory. Since ItemFactories are meant to be for constructing and destructing items it is quite obvious that the ItemFactory used to create an item has to be existent when the time comes to delete it. Therefore the lifespan of the Item must be contained in the lifespan of the ItemFactory. This requires you to make sure that an ItemFactory is only destructed when there are no items referring to it anymore. If need arises a functionality to support some kind of reference counting will be implemented inside this abstract base class but until then you have to do this yourself.


Public Member Functions

 ItemFactory (void)
 The default constructor.
virtual ~ItemFactory (void)
 The deconstructor.
virtual Arxx::ItempNewItem (Arxx::u4byte u4UniqueID=Arxx::g_u4InvalidID)=0
 Creates a new item.
virtual Arxx::ItempNewItem (Arxx::Archive &Archive, Arxx::u4byte u4UniqueID=Arxx::g_u4InvalidID)=0
 Creates a new item.
virtual void vDeleteItem (Arxx::Item *pItem)=0
 Destroys an item.


Constructor & Destructor Documentation

Arxx::ItemFactory::ItemFactory ( void   ) 

The default constructor.

This default constructor is only here for debugging and documentation purposes. It serves no functionality.

Arxx::ItemFactory::~ItemFactory ( void   )  [virtual]

The deconstructor.

This default deconstructor is only here for debugging and documentation purposes. It serves no functionality.


Member Function Documentation

virtual Arxx::Item* Arxx::ItemFactory::pNewItem ( Arxx::Archive Archive,
Arxx::u4byte  u4UniqueID = Arxx::g_u4InvalidID 
) [pure virtual]

Creates a new item.

This function is called whenever there is need for a new item. It is required to return the address of an item that is ready to be used by the application or the library component. A call to this function has to result in a constuctor call to an Arxx::Item.

Implemented in Arxx::DefaultItemFactory.

virtual Arxx::Item* Arxx::ItemFactory::pNewItem ( Arxx::u4byte  u4UniqueID = Arxx::g_u4InvalidID  )  [pure virtual]

Creates a new item.

This function is called whenever there is need for a new item. It is required to return the address of an item that is ready to be used by the application or the library component. A call to this function has to result in a constuctor call to an Arxx::Item.

Implemented in Arxx::DefaultItemFactory.

virtual void Arxx::ItemFactory::vDeleteItem ( Arxx::Item pItem  )  [pure virtual]

Destroys an item.

This function will destroy an item by calling the items destructor and doing anything necessary to release resources or unregister other things.

Implemented in Arxx::DefaultItemFactory.


The documentation for this class was generated from the following files:
Generated on Tue Oct 10 11:34:51 2006 for libarxx by  doxygen 1.4.7