Arxx::Item Class Reference

#include <Item.h>

Inheritance diagram for Arxx::Item:

Inheritance graph
[legend]
Collaboration diagram for Arxx::Item:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Arxx::Item is the basic class for any data storaging.

The Item is a thin wrapper around Arxx::Data but the inheritance ensures you can also treat it as an Arxx::Data object.

It adds the basics of ARX to the data storage: Names, IDs, Types, SubTypes and a connection to a parenting Arxx::Archive.

Additionally, at the moment it provides basic functionality for the structure, but that is about to change. Structure should only be handled by external structure classes.


Public Member Functions

 Item (Arxx::Archive &Archive, Arxx::u4byte u4UniqueID=g_u4InvalidID)
 The "Archive Constructor" creates an Item that is associated to a certain Arxx::Archive.
 Item (Arxx::ItemFactory &ItemFactory, Arxx::Archive &Archive, Arxx::u4byte u4UniqueID=g_u4InvalidID)
 The "Archive & Factory Constructor" creates an Item that is associated to a certain Arxx::Archive and to a certain ItemFactory.
 Item (Arxx::u4byte u4UniqueID=g_u4InvalidID)
 The default constructor, with the additional ability to define a unique identifier.
 Item (Arxx::ItemFactory &ItemFactory, Arxx::u4byte u4UniqueID=g_u4InvalidID)
 The Factory constructor, with the additional ability to define a unique identifier.
virtual ~Item ()
 The destructor for items.
Arxx::u4byte u4GetUniqueID (void) const
 This function returns the unique identifier of this Arxx::Item.
void vSetUniqueID (Arxx::u4byte u4UniqueID)
 Sets this item's unique identifier inside the library.
const std::string & sGetName (void) const
 Returns a const reference to the items name.
void vSetName (const std::string &sName)
 Set the item's name.
Arxx::u4byte u4GetType (void) const
 Returns the type identifier of this item.
Arxx::u4byte u4GetSubType (void) const
 Returns the sub-type identifier of this item.
Arxx::u4byte u4GetVersion (void) const
 Returns the version number of this item.
void vSetType (Arxx::u4byte u4Type)
 Enables you to set the type identifier of this item.
void vSetSubType (Arxx::u4byte u4SubType)
 Enables you to set the sub-type identifier of this item.
void vSetVersion (Arxx::u4byte u4Version)
 Sets the version number of this item.
Arxx::ArchivepGetArchive (void) const
 Returns a pointer to the registered Archive.
Arxx::ItemFactorypGetItemFactory (void) const
 Returns a pointer to the ItemFactory that this item is a part of.
Arxx::StructureGetStructure (void)
 Returns the Structure component associated with this Item.
const Arxx::StructureGetStructure (void) const
 Returns the const Structure component associated with this Item.

Private Member Functions

 Item (const Item &Item)
 Hide the copy constructor from user space. We won't need it in any tool here.
Itemoperator= (const Item &Item)
 Hide to assignment operator from user space.

Private Attributes

u4byte m_u4UniqueID
 The item's unique ID to identify it inside a library.
std::string m_sName
 The item's name in string form.
Arxx::u4byte m_u4Type
 A type identifier for this item.
Arxx::u4byte m_u4SubType
 A subtype identifier for this item.
Arxx::u4byte m_u4Version
 This field stores versioning information about the data.
Arxx::Archivem_pArchive
 A pointer to the Archive.
Arxx::ItemFactorym_pItemFactory
 A pointer to the library that this Item was created with.
Arxx::Structure m_Structure
 The structural information of an item.

Friends

class Arxx::Archive


Constructor & Destructor Documentation

Arxx::Item::Item ( Arxx::Archive Archive,
Arxx::u4byte  u4UniqueID = g_u4InvalidID 
)

The "Archive Constructor" creates an Item that is associated to a certain Arxx::Archive.

Parameters:
Archive The Arxx::Archive which will be used to register the Item after it has been set up.
u4UniqueID The item's unique ID that will be tried for the Item.
After all the member variables have been initialized Archive.vRegisterItem(this) is issued.

Arxx::Item::Item ( Arxx::ItemFactory ItemFactory,
Arxx::Archive Archive,
Arxx::u4byte  u4UniqueID = g_u4InvalidID 
)

The "Archive & Factory Constructor" creates an Item that is associated to a certain Arxx::Archive and to a certain ItemFactory.

Parameters:
ItemFactory The Arxx::ItemFactory that this item is created from and will be destroyed from.
Archive The Arxx::Archive which will be used to register the Item after it has been set up.
u4UniqueID The item's unique ID that will be tried for the Item.
After all the member variables have been initialized Archive.vRegisterItem(this) is issued.

Arxx::Item::Item ( Arxx::u4byte  u4UniqueID = g_u4InvalidID  )  [explicit]

The default constructor, with the additional ability to define a unique identifier.

Parameters:
u4UniqueID The unique ID you wish to assign to the new Arxx::Item.
This constructor is available so you can create items which don't belong to a library initially.

Arxx::Item::Item ( Arxx::ItemFactory ItemFactory,
Arxx::u4byte  u4UniqueID = g_u4InvalidID 
)

The Factory constructor, with the additional ability to define a unique identifier.

Parameters:
ItemFactory The Arxx::ItemFactory that this item is created from and will be destroyed from.
u4UniqueID The unique ID you wish to assign to the new Arxx::Item.
This constructor is available so you can create items which don't belong to a library initially.

Arxx::Item::~Item (  )  [virtual]

The destructor for items.

This destructor is virtual so that you can savely derieve from the Arxx::Item.

Arxx::Item::Item ( const Item Item  )  [private]

Hide the copy constructor from user space. We won't need it in any tool here.

See also:
If you ever should be in need of this functionality I need to figure out the semantics.


Member Function Documentation

const Arxx::Structure & Arxx::Item::GetStructure ( void   )  const

Returns the const Structure component associated with this Item.

Arxx::Structure & Arxx::Item::GetStructure ( void   ) 

Returns the Structure component associated with this Item.

Item& Arxx::Item::operator= ( const Item Item  )  [private]

Hide to assignment operator from user space.

See also:
If you are in need of this functionality, tell me so I can figure out the semantis needed for this.

Arxx::Archive * Arxx::Item::pGetArchive ( void   )  const

Returns a pointer to the registered Archive.

The function will return `0` if there is no Archive set for the Item.

Arxx::ItemFactory * Arxx::Item::pGetItemFactory ( void   )  const

Returns a pointer to the ItemFactory that this item is a part of.

The function will return 0 if there is no item factory set for this item.

const std::string & Arxx::Item::sGetName ( void   )  const

Returns a const reference to the items name.

This function is called for const items and returns a const reference to the item's name.

Arxx::u4byte Arxx::Item::u4GetSubType ( void   )  const

Returns the sub-type identifier of this item.

As the type the sub-type identifier has no sematic meaning to ARX or libarxx. It is meant to be placed into meaning by the application.

The default value for the sub type is 0xFFFFFFFF.

Arxx::u4byte Arxx::Item::u4GetType ( void   )  const

Returns the type identifier of this item.

The type identifier has no sematic meaning to ARX or libarxx. It only serves the purpose of getting a meaning by the application.

The default value for the type is 0xFFFFFFFF.

Arxx::u4byte Arxx::Item::u4GetUniqueID ( void   )  const

This function returns the unique identifier of this Arxx::Item.

Returns the unique identifier of this item. Remember that it is only unique inside a certain ARX archive.

Arxx::u4byte Arxx::Item::u4GetVersion ( void   )  const

Returns the version number of this item.

The version number has no semantic meaning within ARX or libarxx and is only related to the content. It may represent ANY kind of information however it SHOULD be useful as a indicator for the up-to-dateness of the item's content.

If the value is actually a version number it should be treated like xx.xx.xx.xx with each component ranging from 0 to 255. However you may also like to store the timestamp when the item was created.

The default value for the version number is 0.0.0.0.

void Arxx::Item::vSetName ( const std::string &  sName  ) 

Set the item's name.

Parameters:
sName The new name of the item.
This function lets you change the name of an item to any value representable in a std::string.

void Arxx::Item::vSetSubType ( Arxx::u4byte  u4SubType  ) 

Enables you to set the sub-type identifier of this item.

Parameters:
u4SubType The sub-type identifier you whish to set for this item.
As the type the sub-type identifier has no sematic meaning to ARX or libarxx. It is meant to be placed into meaning by the application.

void Arxx::Item::vSetType ( Arxx::u4byte  u4Type  ) 

Enables you to set the type identifier of this item.

Parameters:
u4Type The type identifier you whish to set for this item.
The type identifier has no sematic meaning to ARX or libarxx. It only serves the purpose of getting a meaning by the application.

void Arxx::Item::vSetUniqueID ( Arxx::u4byte  u4UniqueID  ) 

Sets this item's unique identifier inside the library.

Parameters:
u4UniqueID The new unique identifier of this item.
This function is trivial for items that don't belong to any library. The unique identifier has no meaning there and will just get assigned.

If this Arxx::Item is inside an Arxx:Archive the function is responsible for checking that the new identifier is not used yet.

void Arxx::Item::vSetVersion ( Arxx::u4byte  u4Version  ) 

Sets the version number of this item.

Parameters:
u4Version The new version number of the item.
Sets the versin number of the item. Note that this information is purely related to the content and in no way related to the components or structure of the Arxx::Item.


Friends And Related Function Documentation

friend class Arxx::Archive [friend]


Member Data Documentation

Arxx::Archive* Arxx::Item::m_pArchive [private]

A pointer to the Archive.

Depending on the constructor this field is either initialized with 0 or with the address of the Archive passed to the constructor.

It is changed in conjuction with the Arxx::Archive::vRegisterItem() and Arxx::Archive::vUnregisterItem() functions.

Arxx::ItemFactory* Arxx::Item::m_pItemFactory [private]

A pointer to the library that this Item was created with.

Depending on the constructor this field is either initialized with 0 or with the address of the ItemFactory passed to the constructor.

std::string Arxx::Item::m_sName [private]

The item's name in string form.

The name is in no way meant to identify the item. It's just used to have a short description of the item (although no length restriction is given).

Despite this, the name can be used to build paths over the items of the library.

Paths look like this:

 /
 /some
 /some/path
 /[child]some/[child]path
 /[child]some/path/[parent]some/path
 /[child]some/[other]path

After creating an Item this value is intentionally "".

Arxx::Structure Arxx::Item::m_Structure [private]

The structural information of an item.

Arxx::u4byte Arxx::Item::m_u4SubType [private]

A subtype identifier for this item.

Like the type the subtype has no semantic meaning inside ARX or libarxx. Ite exists only to be used by the application to identify subtypes of types. This is useful for example to distinguish between different versions of data format that belong to the same type. It can also be used to highlight semantic meaning of a general data format on filesystem layer, like identifying all kinds of log files with a certain type and distinguishing between error, info, debug and critical with different subtypes.

After creating an Item this value is intentionally 0xFFFFFFFF.

Arxx::u4byte Arxx::Item::m_u4Type [private]

A type identifier for this item.

The type of an item has no semantic meaning inside ARX or libarxx. It exists only to be used by applications to identify the type of the data of this item. Think of it as a replacement for extensions.

After creating an Item this value is intentionally 0xFFFFFFFF.

u4byte Arxx::Item::m_u4UniqueID [private]

The item's unique ID to identify it inside a library.

The item's unique ID will identify the item in a library. The ID allows access to the item in O(log(n)).

Depending on the constructor this field is either initialized with 0xFFFFFFFF or with the unique ID passed to the constructor.

Arxx::u4byte Arxx::Item::m_u4Version [private]

This field stores versioning information about the data.

This version information, given in xx.xx.xx.xx format, allows applications to assign a running version number of this item's data. It should strictly refere to data content only, not the data format. Again this property has no semantic meaning inside ARX or libarxx, however the more recently the Item is been changed the higher the version number should generally be.

After creating an Item this value is intentionally 0x00000000.


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