Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TDataPackageList Class Reference

A simple list of data packages. More...

#include <datapackage.h>

List of all members.

Public Methods

 TDataPackageList ()
 ~TDataPackageList ()
bool Add (const string &sIdentifier, const bool *pData, bool bUnique=true, bool bAutoDelete=false)
bool Add (const string &sIdentifier, const double *pData, bool bUnique=true, bool bAutoDelete=false)
bool Add (const string &sIdentifier, const int2 *pData, bool bUnique=true, bool bAutoDelete=false)
bool Add (const string &sIdentifier, const int4 *pData, bool bUnique=true, bool bAutoDelete=false)
bool Add (const string &sIdentifier, const string *pData, bool bUnique=true, bool bAutoDelete=false)
bool Add (const string &sIdentifier, const TDataPackageList *pData, bool bUnique=true, bool bAutoDelete=false)
bool Add (const string &sIdentifier, const TObjectID *pData, bool bUnique=true, bool bAutoDelete=false)
bool Add (const string &sIdentifier, const TPoint *pData, bool bUnique=true, bool bAutoDelete=false)
void DeleteAll ()
bool Get (const string &sIdentifier, bool *pData, bool bUnique=true)
bool Get (const string &sIdentifier, double *pData, bool bUnique=true)
bool Get (const string &sIdentifier, int2 *pData, bool bUnique=true)
bool Get (const string &sIdentifier, int4 *pData, bool bUnique=true)
bool Get (const string &sIdentifier, string *pData, bool bUnique=true)
bool Get (const string &sIdentifier, TDataPackageList *pData, bool bUnique=true)
bool Get (const string &sIdentifier, TObjectID *pData, bool bUnique=true)
bool Get (const string &sIdentifier, TPoint *pData, bool bUnique=true)
bool getBool (const string &identifier, bool unique=true) const
double getDouble (const string &identifier, bool unique=true) const
int2 getInt2 (const string &identifier, bool unique=true) const
int4 getInt4 (const string &identifier, bool unique=true) const
const string getString (const string &identifier, bool unique=true) const
const TPoint getPoint (const string &identifier, bool unique=true) const
TDataPackageList & operator= (const TDataPackageList &src)
bool save (ofstream &out)
TDataPackageSearch (const string &sIdentifier) const
TDataPackageSearchUnique (const string &sIdentifier) const
TDataPackageSearchAndExtract (const string &sIdentifier)
TDataPackageSearchAndExtractUnique (const string &sIdentifier)
void set (const string &identifier, bool value)
void set (const string &identifier, double value)
void set (const string &identifier, int2 value)
void set (const string &identifier, int4 value)
void set (const string &identifier, const string &value)
void set (const string &identifier, const char *value)
void set (const string &identifier, const TPoint &value)
void showContent (int indent=0) const

Private Methods

TDataPackagegetAndExtractPackage (const string &identifier, bool unique)
TDataPackagegetPackage (const string &identifier, bool unique) const
void Indent (ofstream &out, int2 iIndent) const
bool WriteDataPackage (ofstream &out, const TDataPackage &pPackage, int2 iIndent=0) const


Detailed Description

A simple list of data packages.

Author:
Marco Krohn <marco.krohn@gmx.de>
Version:
Id:
datapackage.h,v 1.19 2002/06/07 00:32:38 mkrohn5 Exp
See also:
TDataPackage
Note that TDataPackageList will delete all TDataPackage objects when the destructor is called. It depends on the settings of the individual TDataPackage objects if their content is also deleted. Please read the documentation of TDataPackage for more information and examples.


Constructor & Destructor Documentation

TDataPackageList::~TDataPackageList  
 

Deletes all data packages. It depends on the settings of the individual TDataPackage objects if their content is also deleted.

See also:
TDataPackage::SetAutoDeleteMode


Member Function Documentation

bool TDataPackageList::Add const string &    sIdentifier,
const TPoint   pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a TPoint to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case a TPoint object.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

bool TDataPackageList::Add const string &    sIdentifier,
const TObjectID   pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a TObjectID to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case a TObjectID object.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

bool TDataPackageList::Add const string &    sIdentifier,
const TDataPackageList *    pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a TDataPackageList to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case a TDataPackageList object.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

bool TDataPackageList::Add const string &    sIdentifier,
const string *    pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a string to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case of type string.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

bool TDataPackageList::Add const string &    sIdentifier,
const int4 *    pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a int4 to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case of type int4.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

bool TDataPackageList::Add const string &    sIdentifier,
const int2 *    pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a int2 to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case of type int2.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

bool TDataPackageList::Add const string &    sIdentifier,
const double *    pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a double to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case of type double.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

bool TDataPackageList::Add const string &    sIdentifier,
const bool *    pData,
bool    bUnique = true,
bool    bAutoDelete = false
 

Adds a data package containing a bool to the list of data packages.

Parameters:
sIdentifier  The identifier of the data package.
pData  The real data, in this case of boolean type.
bUnique  If set to true the data will only be added if no identifier with the same name already exists.
bAutoDelete  Determines if the data will be automatically deleted after the data package is not needed any more. This means that something like delete pData will be called. Use with care!
Returns:
true if the data package was added without problems, otherwise false.

void TDataPackageList::DeleteAll  
 

Deletes all elements of the list as well as the list itself.

bool TDataPackageList::Get const string &    sIdentifier,
TPoint   pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

bool TDataPackageList::Get const string &    sIdentifier,
TObjectID   pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

bool TDataPackageList::Get const string &    sIdentifier,
TDataPackageList *    pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

bool TDataPackageList::Get const string &    sIdentifier,
string *    pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

bool TDataPackageList::Get const string &    sIdentifier,
int4 *    pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

bool TDataPackageList::Get const string &    sIdentifier,
int2 *    pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

bool TDataPackageList::Get const string &    sIdentifier,
double *    pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

bool TDataPackageList::Get const string &    sIdentifier,
bool *    pData,
bool    bUnique = true
 

Reads a TDataPackage object from a list of datapackages. After reading the data package the package is deleted.

Parameters:
sIdentifier  The identifier of the data package.
pData  The pointer where the data is copied to.
bUnique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
true if the datapackage was unpacked without problems, in case that the identifier was not found or not unique the method will return false.

TDataPackage* TDataPackageList::getAndExtractPackage const string &    identifier,
bool    unique
[private]
 

Looks up a package and deletes it from the list.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The data package or 0 in case the package does not exist or (if unique is set to true) is not unique.

bool TDataPackageList::getBool const string &    identifier,
bool    unique = true
const
 

Reads a bool value from a list of data packages. In contrary to get it will not delete anything and also note that the return value is used in a different way.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The content of the datapackage.

double TDataPackageList::getDouble const string &    identifier,
bool    unique = true
const
 

Reads a double value from a list of data packages. In contrary to get it will not delete anything and also note that the return value is used in a different way.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The content of the datapackage.

int2 TDataPackageList::getInt2 const string &    identifier,
bool    unique = true
const
 

Reads an int2 value from a list of data packages. In contrary to get it will not delete anything and also note that the return value is used in a different way.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The content of the datapackage.

int4 TDataPackageList::getInt4 const string &    identifier,
bool    unique = true
const
 

Reads an int4 value from a list of data packages. In contrary to get it will not delete anything and also note that the return value is used in a different way.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The content of the datapackage.

TDataPackage* TDataPackageList::getPackage const string &    identifier,
bool    unique
const [private]
 

Looks up a package without deleting it.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The data package or 0 in case the package does not exist or (if unique is set to true) is not unique.

const TPoint TDataPackageList::getPoint const string &    identifier,
bool    unique = true
const
 

Reads an object TPoint from a list of data packages. In contrary to get it will not delete anything and also note that the return value is used in a different way.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The content of the datapackage.

const string TDataPackageList::getString const string &    identifier,
bool    unique = true
const
 

Reads an string from a list of data packages. In contrary to get it will not delete anything and also note that the return value is used in a different way.

Parameters:
identifier  The "name" of the data package.
unique  If set to true this method will read the data package only if there are no other data packages with the same name.
Returns:
The content of the datapackage.

void TDataPackageList::Indent ofstream &    out,
int2    iIndent
const [private]
 

Writes a number of spaces to the ofstream. (This is used to make the output file a bit nicer).

Parameters:
out  The output stream.
iIndent  The number of spaces.

TDataPackageList& TDataPackageList::operator= const TDataPackageList &    src
 

FIXME

bool TDataPackageList::save ofstream &    out
 

Writes a list of data packages to a stream. Note that calling this method will also delete all elements in the data package list.

Parameters:
out  The output stream.
Returns:
true if no problems occured while saving, otherwise false.

TDataPackage* TDataPackageList::Search const string &    sIdentifier const
 

Searches for a data package with a given identifier.

Parameters:
sIdentifier  The identifier of the data package to look for.
Returns:
The pointer to the data package or 0 if no data package with the name sIdentifier was not found.

TDataPackage* TDataPackageList::SearchAndExtract const string &    sIdentifier
 

Searches for a data package with a given identifier and extracts the data package from the list of data packages. It is your duty to delete the data package after that.

Parameters:
sIdentifier  The identifier of the data package to look for.
Returns:
The pointer to the data package or 0 if no data package with the name sIdentifier was not found.

TDataPackage* TDataPackageList::SearchAndExtractUnique const string &    sIdentifier
 

Searches for a data package with a given identifier and extracts the data package from the list of data packages if the identifier was unique. It is your duty to delete the data package after that.

Parameters:
sIdentifier  The identifier of the data package to look for.
Returns:
The pointer to the data package or 0 if no data package with the name sIdentifier was not found (or the data package was not unique).

TDataPackage* TDataPackageList::SearchUnique const string &    sIdentifier const
 

Searches for a data package with a given identifier and ensures that the identifier is unique.

Parameters:
sIdentifier  The identifier of the data package to look for.
Returns:
The pointer to the data package or 0 if no data package with the name sIdentifier was not found or the package was no unique.

void TDataPackageList::set const string &    identifier,
const TPoint   value
 

Sets a data package with the name identifier to value. If the data package does not exist it is created.

Parameters:
identifier  The "name" of the data package.
value  The new value for the content of the data package.

void TDataPackageList::set const string &    identifier,
const char *    value
 

Sets a data package with the name identifier to value. If the data package does not exist it is created.

Parameters:
identifier  The "name" of the data package.
value  The new value for the content of the data package.

void TDataPackageList::set const string &    identifier,
const string &    value
 

Sets a data package with the name identifier to value. If the data package does not exist it is created.

Parameters:
identifier  The "name" of the data package.
value  The new value for the content of the data package.

void TDataPackageList::set const string &    identifier,
int4    value
 

Sets a data package with the name identifier to value. If the data package does not exist it is created.

Parameters:
identifier  The "name" of the data package.
value  The new value for the content of the data package.

void TDataPackageList::set const string &    identifier,
int2    value
 

Sets a data package with the name identifier to value. If the data package does not exist it is created.

Parameters:
identifier  The "name" of the data package.
value  The new value for the content of the data package.

void TDataPackageList::set const string &    identifier,
double    value
 

Sets a data package with the name identifier to value. If the data package does not exist it is created.

Parameters:
identifier  The "name" of the data package.
value  The new value for the content of the data package.

void TDataPackageList::set const string &    identifier,
bool    value
 

Sets a data package with the name identifier to value. If the data package does not exist it is created.

Parameters:
identifier  The "name" of the data package.
value  The new value for the content of the data package.

void TDataPackageList::showContent int    indent = 0 const
 

For debugging only! This method writes the content of the datapackage list to the log file.

bool TDataPackageList::WriteDataPackage ofstream &    out,
const TDataPackage   pPackage,
int2    iIndent = 0
const [private]
 

Writes a data package to an ofstream.

Parameters:
out  The stream to write to.
pPackage  The data package to write.
Returns:


The documentation for this class was generated from the following file:
Generated on Thu Jun 20 18:13:19 2002 for Stellar Legacy by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001