Public Member Functions | Static Public Member Functions | List of all members
Celartem::DataStore Class Referenceabstract

#include <cel_datastore.h>

Inheritance diagram for Celartem::DataStore:
Inheritance graph
[legend]

Public Member Functions

virtual AutoPtr< DataStoreaddDataStore (const String &inName, UChar4 pathSep= '\0')=0
 
virtual void set (const String &inName, Serializable *inSerializable, UChar4 pathSep= '\0')=0
 
template<typename T >
void setT (const String &inName, const T &inValue, UChar4 pathSep= '\0')
 
virtual size_t getSize () const =0
 
virtual String getName (size_t inIndex) const =0
 
virtual AutoPtr< Serializableat (size_t inIndex)=0
 
virtual AutoPtr< const
Serializable
at (size_t inIndex) const =0
 
template<class T >
AutoPtr< T > at (size_t inIndex)
 
template<class T >
AutoPtr< const T > at (size_t inIndex) const
 
virtual AutoPtr< Serializableget (const String &inName, UChar4 pathSep= '\0')=0
 
virtual AutoPtr< const
Serializable
get (const String &inName, UChar4 pathSep= '\0') const =0
 
template<class T >
AutoPtr< T > get (const String &inName, UChar4 pathSep= '\0')
 
template<class T >
AutoPtr< const T > get (const String &inName, UChar4 pathSep= '\0') const
 
virtual void unlink (const String &inName, UChar4 pathSep= '\0')=0
 
void setProperty_U64 (const String &inName, uint64_t v, UChar4 pathSep= '\0')
 
void setProperty_I64 (const String &inName, int64_t v, UChar4 pathSep= '\0')
 
void setProperty_U32 (const String &inName, u32 v, UChar4 pathSep= '\0')
 
void setProperty_I32 (const String &inName, i32 v, UChar4 pathSep= '\0')
 
void setProperty_Double (const String &inName, double v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, size_t v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, const char *v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, const utf8s &v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, const String &v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, const Time &v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, const TimeSpan &v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, const Guid &v, UChar4 pathSep= '\0')
 
void setProperty (const String &inName, Serializable *inSerializable, UChar4 pathSep= '\0')
 
AutoPtr< DataStoregetAsDataStore (const String &inName, UChar4 pathSep= '\0')
 
AutoPtr< const DataStoregetAsDataStore (const String &inName, UChar4 pathSep= '\0') const
 
AutoPtr< BasicDataArraygetAsDataArray (const String &inName, UChar4 pathSep= '\0')
 
AutoPtr< const BasicDataArraygetAsDataArray (const String &inName, UChar4 pathSep= '\0') const
 
ssize_t getAsInteger (const String &inName, UChar4 pathSep= '\0') const
 
size_t getAsUInteger (const String &inName, UChar4 pathSep= '\0') const
 
int64_t getAsInteger64 (const String &inName, UChar4 pathSep= '\0') const
 
uint64_t getAsUInteger64 (const String &inName, UChar4 pathSep= '\0') const
 
double getAsDouble (const String &inName, UChar4 pathSep= '\0') const
 
String getAsString (const String &inName, UChar4 pathSep= '\0') const
 
Time getAsTime (const String &inName, UChar4 pathSep= '\0') const
 
TimeSpan getAsTimeSpan (const String &inName, UChar4 pathSep= '\0') const
 
Guid getAsGUID (const String &inName, UChar4 pathSep= '\0') const
 
bool doesExist (const String &inName, UChar4 pathSep= '\0') const
 
String getClassOf (const String &inName, UChar4 pathSep= '\0') const
 
const GuidgetClassIdOf (const String &inName, UChar4 pathSep= '\0') const
 
virtual void instructNoChecksum ()=0
 
virtual AutoPtr< DataStoreduplicateDataStore ()=0
 
- Public Member Functions inherited from Celartem::Serializable
virtual void serialize (Stream *inStream, size_t inLevel=0, Endian inEndian=endianBig)=0
 
virtual AutoPtr< Serializableduplicate () const =0
 
const GuidgetClassId () const
 
String getClassName () const
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

Static Public Member Functions

static AutoPtr< DataStorecreate ()
 
static AutoPtr< DataStorecreate (Stream *inStream)
 
static AutoPtr< Serializabledeserialize (Stream *inStream, size_t inLevel=0, Endian inEndian=endianBig)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

DataStore is multi purpose container of Serializable objects. Since DataStore itself is also derived from Serializable, it can contain DataStore instances to form the tree structure. The instances that are held by DataStore instance are actually not stored in the instance but they are just linked by AutoPtr array.
This class also support the Serialization to Stream instance.

Member Function Documentation

virtual AutoPtr<DataStore> Celartem::DataStore::addDataStore ( const String inName,
UChar4  pathSep = '\0' 
)
pure virtual

Add child DataStore instance by the specified name. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new DataStore instance.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
virtual AutoPtr<Serializable> Celartem::DataStore::at ( size_t  inIndex)
pure virtual

This method gets the object instance by index.

Parameters
inIndexIndex of the object.
Returns
Pointer to the object.

Referenced by at().

virtual AutoPtr<const Serializable> Celartem::DataStore::at ( size_t  inIndex) const
pure virtual

This method gets the object instance by index. (const version)

Parameters
inIndexIndex of the object.
Returns
Pointer to the object.
template<class T >
AutoPtr<T> Celartem::DataStore::at ( size_t  inIndex)
inline

This method gets the object instance by index.

Parameters
inIndexIndex of the object.
Returns
Pointer to the object.

The following is a sample use of this method:

AutoPtr<DataArray> da = ds->at<DataArray>(index);
template<class T >
AutoPtr<const T> Celartem::DataStore::at ( size_t  inIndex) const
inline

This method gets the object instance by index. (const version)

Parameters
inIndexIndex of the object.
Returns
Pointer to the object.

The following is a sample use of this method:

AutoPtr<DataArray> da = ds->at<DataArray>(index);
static AutoPtr<DataStore> Celartem::DataStore::create ( )
static

Creates a new DataStore instance.

Returns
Pointer to the newly created instance.
static AutoPtr<DataStore> Celartem::DataStore::create ( Stream inStream)
static

Creates a new DataStore instance from the stream.
This function is almost identical to deserialize function except it does only have a parameter that specifies the source stream. For more information, see deserialize.

Parameters
inStreamA stream from which the serialization starts.
Returns
Pointer to the newly created instance.
See Also
deserialize
static AutoPtr<Serializable> Celartem::DataStore::deserialize ( Stream inStream,
size_t  inLevel = 0,
Endian  inEndian = endianBig 
)
static

This function starts the serialization from the specified stream.

Parameters
inStreamA stream from which the serialization starts.
inLevelThe level of the object. If the objects has tree structure and the serialization process is to make recursion, the inLevel is incremented just before calling deserialize function of the child objects. If you are no the top level, set the value to 0.
inEndianThe endianness used to read the data.
Returns
Pointer to the newly created instance.
See Also
create, Serializable, SerializableData
bool Celartem::DataStore::doesExist ( const String inName,
UChar4  pathSep = '\0' 
) const

Verifies whether there is the object of the specified name or not.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
true if the object exists, otherwise false.
virtual AutoPtr<DataStore> Celartem::DataStore::duplicateDataStore ( )
pure virtual

This function duplicates the DataStore instance.

Returns
Pointer to the newly created DataStore instance.
virtual AutoPtr<Serializable> Celartem::DataStore::get ( const String inName,
UChar4  pathSep = '\0' 
)
pure virtual

This method gets the object instance by name.

Parameters
inNameName or path of the object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the object.
virtual AutoPtr<const Serializable> Celartem::DataStore::get ( const String inName,
UChar4  pathSep = '\0' 
) const
pure virtual

This method gets the object instance by name. (const version)

Parameters
inNameName or path of the object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the object.
template<class T >
AutoPtr<T> Celartem::DataStore::get ( const String inName,
UChar4  pathSep = '\0' 
)
inline

This method gets the object instance by name.

Parameters
inNameName or path of the object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the object.

The following is a sample use of this method:

AutoPtr<DataArray> da = ds->get<DataArray>("myDataArray");
template<class T >
AutoPtr<const T> Celartem::DataStore::get ( const String inName,
UChar4  pathSep = '\0' 
) const
inline

This method gets the object instance by name. (const version)

Parameters
inNameName or path of the object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the object.

The following is a sample use of this method:

AutoPtr<const DataArray> da
= ds->get< DataArray<u8> >("myDataArray");
AutoPtr<BasicDataArray> Celartem::DataStore::getAsDataArray ( const String inName,
UChar4  pathSep = '\0' 
)

This method gets the Serializable object specified by name as BasicDataArray.
This implementation internally uses dynamic_cast<> to convert Serializable into BasicDataArray.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the BasicDataArray object.
AutoPtr<const BasicDataArray> Celartem::DataStore::getAsDataArray ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as BasicDataArray (const version).
This implementation internally uses dynamic_cast<> to convert Serializable into BasicDataArray.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the BasicDataArray object.
AutoPtr<DataStore> Celartem::DataStore::getAsDataStore ( const String inName,
UChar4  pathSep = '\0' 
)

This method gets the Serializable object specified by name as DataStore.
This implementation internally uses dynamic_cast<> to convert Serializable into DataStore.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the DataStore object.
AutoPtr<const DataStore> Celartem::DataStore::getAsDataStore ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as DataStore (const version).
This implementation internally uses dynamic_cast<> to convert Serializable into DataStore.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
Pointer to the DataStore object.
double Celartem::DataStore::getAsDouble ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as double value.
This implementation internally uses dynamic_cast<> to convert Serializable into SerializableData<double> that contains double value.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
double value.
Guid Celartem::DataStore::getAsGUID ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as Guid.
This implementation internally uses dynamic_cast<> to convert Serializable into SerializableData<Guid>.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
The Guid.
ssize_t Celartem::DataStore::getAsInteger ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as ssize_t value.
Any signed integral type smaller than ssize_t can be obtained by this method.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
int value.
int64_t Celartem::DataStore::getAsInteger64 ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as int64_t value.
Any signed integral type smaller than int64_t can be obtained by this method.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
int value.
String Celartem::DataStore::getAsString ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as String.
This implementation internally uses dynamic_cast<> to convert Serializable into SerializableData<String>.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
The String.
Time Celartem::DataStore::getAsTime ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as Time.
This implementation internally uses dynamic_cast<> to convert Serializable into SerializableData<Time>.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
The Time.
TimeSpan Celartem::DataStore::getAsTimeSpan ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as TimeSpan.
This implementation internally uses dynamic_cast<> to convert Serializable into SerializableData<TimeSpan>.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
The TimeSpan.
size_t Celartem::DataStore::getAsUInteger ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as size_t value.
Any unsigned integral type smaller than size_t can be obtained by this method.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
int value.
uint64_t Celartem::DataStore::getAsUInteger64 ( const String inName,
UChar4  pathSep = '\0' 
) const

This method gets the Serializable object specified by name as uint64_t value.
Any unsigned integral type smaller than uint64_t can be obtained by this method.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
int value.
const Guid& Celartem::DataStore::getClassIdOf ( const String inName,
UChar4  pathSep = '\0' 
) const

Obtains the class Id (Guid) of the object specified by name.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
A Guid that represents the class.
String Celartem::DataStore::getClassOf ( const String inName,
UChar4  pathSep = '\0' 
) const

Obtains the class name of the object specified by name.

Parameters
inNameName or path of the new object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
Returns
A string that represents the class.
virtual String Celartem::DataStore::getName ( size_t  inIndex) const
pure virtual

This method gets the name of the object instance by index.

Parameters
inIndexIndex of the object.
Returns
The name of the specified instance.
virtual size_t Celartem::DataStore::getSize ( ) const
pure virtual

This method returns the number of Serializable instance in this DataStore as direct children.

Returns
The number of children.
virtual void Celartem::DataStore::instructNoChecksum ( )
pure virtual

This method instructs the DataStore not to use Checksum when serializing the contents into the stream.

virtual void Celartem::DataStore::set ( const String inName,
Serializable inSerializable,
UChar4  pathSep = '\0' 
)
pure virtual

Add child object instance by the specified name. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
inSerializableAn object to add.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.

Referenced by setT().

void Celartem::DataStore::setProperty ( const String inName,
size_t  v,
UChar4  pathSep = '\0' 
)

Add a size_t value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA size_t value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty ( const String inName,
const char *  v,
UChar4  pathSep = '\0' 
)

Add a string value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA string.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty ( const String inName,
const utf8s v,
UChar4  pathSep = '\0' 
)

Add a string value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA string.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty ( const String inName,
const String v,
UChar4  pathSep = '\0' 
)

Add a string value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA string.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty ( const String inName,
const Time v,
UChar4  pathSep = '\0' 
)

Add a Time value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA Time value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty ( const String inName,
const TimeSpan v,
UChar4  pathSep = '\0' 
)

Add a TimeSpan value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA TimeSpan value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty ( const String inName,
const Guid v,
UChar4  pathSep = '\0' 
)

Add a Guid value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA Guid value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty ( const String inName,
Serializable inSerializable,
UChar4  pathSep = '\0' 
)

Add a Serializable value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
inSerializableA Serializable value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty_Double ( const String inName,
double  v,
UChar4  pathSep = '\0' 
)

Add a double value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA double value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty_I32 ( const String inName,
i32  v,
UChar4  pathSep = '\0' 
)

Add an int value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA size_t value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty_I64 ( const String inName,
int64_t  v,
UChar4  pathSep = '\0' 
)

Add a 64-bit int value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA size_t value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty_U32 ( const String inName,
u32  v,
UChar4  pathSep = '\0' 
)

Add an unsigned int value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA ssize_t value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
void Celartem::DataStore::setProperty_U64 ( const String inName,
uint64_t  v,
UChar4  pathSep = '\0' 
)

Add a 64-bit unsigned int value. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
vA ssize_t value.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
template<typename T >
void Celartem::DataStore::setT ( const String inName,
const T &  inValue,
UChar4  pathSep = '\0' 
)
inline

Add child object instance by the specified name. This method automatically create the DataStore instance that is needed to add the specified DataStore to creating the directory structure.

Parameters
inNameName or path of the new object.
inValueAn object to add.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.
virtual void Celartem::DataStore::unlink ( const String inName,
UChar4  pathSep = '\0' 
)
pure virtual

Removes the object from the DataStore instance. This method does not delete the instance but just unlink from the DataStore.

Parameters
inNameName or path of the object.
pathSepPath separator used in inName parameter if inName is the path, otherwise it should be '\0'.

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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo