Common::GaCatalogueEntry< T > Class Template Reference

This template class manages key and pointer to data of a catalogue entry. Catalogue entry stores key's string value and pointer to data. Entry stores copied string value of a key. After binding data to an entry, entry object takes over responsibility for memory occupied by data. Data must be located at heap. More...

#include <D:/Temp/vs/gal/source/Catalogue.h>

List of all members.

Public Member Functions

 GaCatalogueEntry (const char *name, T *data)
 Constructor makes copy of key and stores pointer to copied key and pointer to user specified data.
 ~GaCatalogueEntry ()
 Frees memory used by the data and the key.
const char *GACALL GetName () const
 This method is not thread-safe.
void GACALL SetName (const char *name)
 SetName method copies key's string and stores pointer to the copied string.
int GACALL GetNameLength () const
 This method is not thread-safe.
T *GACALL GetData () const
 This method is not thread-safe.
void GACALL SetData (T *data)
 SetData method stores pointer to data.

Private Attributes

char * _name
 Pointer to string representing key of the catalogue's entry.
int _nameLength
 Stores length of string (key) without null-terminating character.
T * _data
 Pointer to the data.

Friends

class GaCatalogue< T >


Detailed Description

template<typename T>
class Common::GaCatalogueEntry< T >

This template class manages key and pointer to data of a catalogue entry. Catalogue entry stores key's string value and pointer to data. Entry stores copied string value of a key. After binding data to an entry, entry object takes over responsibility for memory occupied by data. Data must be located at heap.

This class has no built-in synchronizator, so LOCK_OBJECT and LOCK_THIS_OBJECT macros cannot be used with instances of this class. No public or private methods are thread-safe.

Parameters:
T type of stored data in the entry.

Constructor & Destructor Documentation

template<typename T>
Common::GaCatalogueEntry< T >::GaCatalogueEntry ( const char *  name,
T *  data 
) [inline]

Constructor makes copy of key and stores pointer to copied key and pointer to user specified data.

Parameters:
name key of the entry (null-terminating string).
data data which will be stored in the entry.

template<typename T>
Common::GaCatalogueEntry< T >::~GaCatalogueEntry (  )  [inline]

Frees memory used by the data and the key.


Member Function Documentation

template<typename T>
const char* GACALL Common::GaCatalogueEntry< T >::GetName (  )  const [inline]

This method is not thread-safe.

Returns:
Method returns pointer to string representing key of the entry.

template<typename T>
void GACALL Common::GaCatalogueEntry< T >::SetName ( const char *  name  )  [inline]

SetName method copies key's string and stores pointer to the copied string.

This method is not thread-safe.

Parameters:
name pointer to string which represents new key.

template<typename T>
int GACALL Common::GaCatalogueEntry< T >::GetNameLength (  )  const [inline]

This method is not thread-safe.

Returns:
Method returns length of the key.

template<typename T>
T* GACALL Common::GaCatalogueEntry< T >::GetData (  )  const [inline]

This method is not thread-safe.

Returns:
Method returns reference to the data.

template<typename T>
void GACALL Common::GaCatalogueEntry< T >::SetData ( T *  data  )  [inline]

SetData method stores pointer to data.

This method is not thread-safe.

Parameters:
data reference to new data.


Friends And Related Function Documentation

template<typename T>
friend class GaCatalogue< T > [friend]


Member Data Documentation

template<typename T>
char* Common::GaCatalogueEntry< T >::_name [private]

Pointer to string representing key of the catalogue's entry.

template<typename T>
int Common::GaCatalogueEntry< T >::_nameLength [private]

Stores length of string (key) without null-terminating character.

template<typename T>
T* Common::GaCatalogueEntry< T >::_data [private]

Pointer to the data.


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

Genetic Algorithm Library
Coolsoft Software Development