Public Member Functions | Private Member Functions | Private Attributes | Friends

alize::LabelServer Class Reference

#include <LabelServer.h>

Inheritance diagram for alize::LabelServer:
Inheritance graph
[legend]
Collaboration diagram for alize::LabelServer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LabelServer (bool usePredefinedLabels=false)
virtual ~LabelServer ()
unsigned long addLabel (const Label &l, bool forceAdd=false)
void setLabel (const Label &l, unsigned long index) const
LabelgetLabel (unsigned long index) const
long getLabelIndexByString (const String &s) const
void clear (bool deletePreDefined=false)
unsigned long size () const
virtual String getClassName () const

Private Member Functions

 LabelServer (const LabelServer &)
const LabelServeroperator= (const LabelServer &)
bool operator== (const LabelServer &) const
bool operator!= (const LabelServer &) const

Private Attributes

unsigned long _first
unsigned long _lastAdded
RefVector< Label_vect

Friends

class TestLabelServer

Detailed Description

This class is a container for Label objects. Each Label got an index. This index is used to set the label code in a feature.

Deprecated:
since jan 2005
Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2004

Definition at line 84 of file LabelServer.h.


Constructor & Destructor Documentation

LabelServer::LabelServer ( bool  usePredefinedLabels = false )

Initialize internal data of the server

Parameters:
usePredefinedLabelstrue to use the pre-defined labels; false otherwise (no labels in the server)

Definition at line 68 of file LabelServer.cpp.

References _first, addLabel(), and size().

LabelServer::~LabelServer (  ) [virtual]

Definition at line 137 of file LabelServer.cpp.

References clear().

alize::LabelServer::LabelServer ( const LabelServer  ) [private]

Member Function Documentation

unsigned long LabelServer::addLabel ( const Label l,
bool  forceAdd = false 
)

Adds a new Label object to the server. <FRANCAIS> Le serveur commence par regarder si le label ajoute est identique a celui ajoute precedemment. Si oui, il retourne son index sans ajouter de label. Avantage : c'est tres rapide. Si non, il parcours tous les labels du serveur a la recherche d'un label identique. S'il le trouve, il retourne son index sans ajouter de nouveau label. Dans le cas contraire, il ajoute une copie de ce label à la fin de sa liste de label et retourne l'index. On peut forcer l'ajout d'un label dans le cas ou un exemplaire existe déjà

Parameters:
lThe object to add. The Label object stored is a copy of this parameter.
forceAddforce the add of the label
Returns:
the index of the label

Definition at line 81 of file LabelServer.cpp.

References _lastAdded, _vect, alize::RefVector< T >::addObject(), alize::Label::duplicate(), getLabel(), and size().

Referenced by LabelServer().

void LabelServer::clear ( bool  deletePreDefined = false )

Delete all Label objects stored in the server except for the pre-defined labels.

Parameters:
deletePreDefinedtrue to delete the pre-defined labels too; otherwise false

Definition at line 126 of file LabelServer.cpp.

References _first, _vect, and alize::RefVector< T >::deleteAllObjects().

Referenced by ~LabelServer().

String LabelServer::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::Object.

Definition at line 135 of file LabelServer.cpp.

Label & LabelServer::getLabel ( unsigned long  index ) const

Returns a reference to the label stored inside the server at a specific position

Parameters:
indexthe position of the label inside the server
Exceptions:
IndexOutOfBoundsException
Returns:
a reference to the label

Definition at line 111 of file LabelServer.cpp.

References _vect, and alize::RefVector< T >::getObject().

Referenced by addLabel().

long LabelServer::getLabelIndexByString ( const String s ) const

Find and returns the index of a label

Parameters:
sthe string used as a key to search the label
Returns:
the index of the label if it exists; -1 otherwise

Definition at line 117 of file LabelServer.cpp.

References _vect, alize::RefVector< T >::getObject(), alize::Label::getString(), alize::RefVector< T >::size(), and size().

bool alize::LabelServer::operator!= ( const LabelServer  ) const [private]

Not implemented

const LabelServer& alize::LabelServer::operator= ( const LabelServer  ) [private]

Not implemented

bool alize::LabelServer::operator== ( const LabelServer  ) const [private]

Not implemented

void LabelServer::setLabel ( const Label l,
unsigned long  index 
) const

Set a new Label object at a specific position inside the server.

Parameters:
lThe object to store. The Label object stored is a copy of this parameter
indexthe position of the label inside the server
Exceptions:
IndexOutOfBoundsException

Definition at line 105 of file LabelServer.cpp.

References _vect, alize::Label::duplicate(), alize::RefVector< T >::getObject(), and alize::RefVector< T >::setObject().

unsigned long LabelServer::size (  ) const

Returns the count of label stored in the server

Returns:
the count of label stored in the server

Definition at line 133 of file LabelServer.cpp.

References _vect, and alize::RefVector< T >::size().

Referenced by addLabel(), getLabelIndexByString(), and LabelServer().


Friends And Related Function Documentation

friend class TestLabelServer [friend]

Definition at line 86 of file LabelServer.h.


Member Data Documentation

unsigned long alize::LabelServer::_first [private]

Definition at line 155 of file LabelServer.h.

Referenced by clear(), and LabelServer().

unsigned long alize::LabelServer::_lastAdded [private]

index of the first non-predefined label

Definition at line 156 of file LabelServer.h.

Referenced by addLabel().

index of the last label added

Definition at line 157 of file LabelServer.h.

Referenced by addLabel(), clear(), getLabel(), getLabelIndexByString(), setLabel(), and size().


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