Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members
serverVI Class Reference
Template container class.
More...
#include <serverVI.h>
Inheritance diagram for serverVI:
List of all members.
Public Methods |
| serverVI () |
| default constructor.
|
| ~serverVI () |
| defualt destructor.
|
void | add (std::string n, T* t) |
| add a new element, with its name and pointer to the template class.
|
int | size () const |
| returns number of elements in to server.
|
int | num () const |
| returns number of elements in the server.
|
void | clear () |
| add element no entries (no deletion of pointers).
|
bool | search (std::string name) const |
| returns true if the object with name is in the server.
|
std::string | getName (T* t) const |
| returns the name of the object, (otherwise "EMPTY").
|
std::string | getName (int i) const |
| returns the name of the i object (otherwise "EMPTY").
|
T* | get (std::string name) const |
| returns the pointer to the object with name.
|
T* | get (int i) const |
| returns the pointer to the i element.
|
std::string | nameList () const |
| returns a string with the list of all the names in the server.
|
void | command (std::string com) const |
| executed a command com defined in the template class to all the elements in server.
|
Private Attributes |
std::vector<std::string> | m_names |
std::vector<T*> | m_List |
Detailed Description
template<class T> class serverVI
Template container class.
serverVI stores objects accesible by index or by its name (string)
serverVI executes commands to all its objects via the command()
method. The contained classes should therefore have defined this method.
- The server store POINTERS to the templates. It uses the method
add()
to add objects. - Every object should have a unique name. The server will refuse to add an object which name corresponds to another object already stored in the server,
- the objects are accesible by their names or by they index via the
get()
method. It the object required is NOT in the server, the server returns a 0 pointer that mostlikely will break the program. - via the
search()
method a client can ask if an object with that name is already in ther server. - it has the possibility of executing class methods viapassing then with the
command()
method. - Not possibility (yet) of removing objects from the server. DO NOT delete object that are in the server if the server is not destroyed or not used.
- future plan: use a map<string,T> class as base class.
Definition at line 33 of file serverVI.h.
Constructor & Destructor Documentation
template<class T>
serverVI<T>::serverVI<T> ( ) [inline] |
|
default constructor.
Definition at line 40 of file serverVI.h.
template<class T>
serverVI<T>::~serverVI<T> ( ) [inline] |
|
defualt destructor.
Definition at line 42 of file serverVI.h.
Member Function Documentation
template<class T>
void serverVI<T>::add (
|
std::string n, |
|
T * t ) [inline] |
|
add a new element, with its name and pointer to the template class.
Definition at line 45 of file serverVI.h.
template<class T>
void serverVI<T>::clear ( ) [inline] |
|
add element no entries (no deletion of pointers).
Definition at line 60 of file serverVI.h.
template<class T>
void serverVI<T>::command (
|
std::string com ) const [inline] |
|
executed a command com defined in the template class to all the elements in server.
Definition at line 100 of file serverVI.h.
template<class T>
T * serverVI<T>::get (
|
int i ) const [inline] |
|
returns the pointer to the i element.
Definition at line 90 of file serverVI.h.
template<class T>
T * serverVI<T>::get (
|
std::string name ) const [inline] |
|
returns the pointer to the object with name.
Definition at line 82 of file serverVI.h.
template<class T>
std::string serverVI<T>::getName (
|
int i ) const [inline] |
|
returns the name of the i object (otherwise "EMPTY").
Definition at line 79 of file serverVI.h.
template<class T>
std::string serverVI<T>::getName (
|
T * t ) const [inline] |
|
returns the name of the object, (otherwise "EMPTY").
Definition at line 71 of file serverVI.h.
template<class T>
std::string serverVI<T>::nameList ( ) const [inline] |
|
returns a string with the list of all the names in the server.
Definition at line 93 of file serverVI.h.
template<class T>
int serverVI<T>::num ( ) const [inline] |
|
returns number of elements in the server.
Definition at line 56 of file serverVI.h.
template<class T>
bool serverVI<T>::search (
|
std::string name ) const [inline] |
|
returns true if the object with name is in the server.
Definition at line 63 of file serverVI.h.
template<class T>
int serverVI<T>::size ( ) const [inline] |
|
returns number of elements in to server.
Definition at line 54 of file serverVI.h.
Member Data Documentation
template<class T>
std::vector<T *> serverVI<T>::m_List [private] |
|
template<class T>
std::vector<std::string> serverVI<T>::m_names [private] |
|
The documentation for this class was generated from the following file:
Generated at Fri Aug 18 12:57:42 2000 for centella framework by
1.1.3 written by Dimitri van Heesch,
© 1997-2000