Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

alize::SegServer Class Reference

#include <SegServer.h>

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

List of all members.

Public Member Functions

 SegServer ()
 SegServer (const SegServer &)
const SegServeroperator= (const SegServer &ss)
virtual ~SegServer ()
SegcreateSeg (unsigned long b=0, unsigned long l=0, unsigned long lc=0, const String &s="", const String &sn="")
SegduplicateSeg (const Seg &s)
SegClustercreateCluster (unsigned long lc=0, const String &s="", const String &sn="")
void remove (SegAbstract &s)
void removeAllSegs ()
void removeAllClusters ()
SeggetSeg (unsigned long idx) const
SegClustergetCluster (unsigned long idx) const
long getClusterIndexById (unsigned long id) const
SegClustergetClusterById (unsigned long id) const
unsigned long getIndex (const SegAbstract &s) const
void setClusterId (SegCluster &cl, unsigned long id)
unsigned long getSegCount () const
unsigned long getClusterCount () const
const StringgetServerName () const
void setServerName (const String &s)
void save (const FileName &f, const Config &c) const
void load (const FileName &f, const Config &c)
virtual String getClassName () const
virtual String toString () const
void deleteDeletableSeg (const K &)

Static Public Member Functions

static SegServercreate ()

Private Types

typedef std::map< unsigned
long, unsigned long >
::const_iterator 
it_t

Private Member Functions

SegAbstractmatchingSegAbstract (const SegAbstract &) const
void assertServerOwns (const SegAbstract &s) const
void assign (const SegServer &ss)
bool operator== (const SegServer &c) const
bool operator!= (const SegServer &c) const

Private Attributes

String _serverName
RefVector< Seg_segVect
RefVector< SegCluster_clusterVect
unsigned long _nextClusterId
std::map< unsigned long,
unsigned long > 
_map

Friends

class TestSegServer

Detailed Description

Class used to store segments and clusters of segments.

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

Definition at line 88 of file SegServer.h.


Member Typedef Documentation

typedef std::map<unsigned long, unsigned long>::const_iterator alize::SegServer::it_t [private]

Definition at line 244 of file SegServer.h.


Constructor & Destructor Documentation

SegServer::SegServer (  ) [explicit]

Definition at line 68 of file SegServer.cpp.

Referenced by create().

SegServer::SegServer ( const SegServer ss )

Copy constructor

Definition at line 71 of file SegServer.cpp.

References assign().

SegServer::~SegServer (  ) [virtual]

Definition at line 306 of file SegServer.cpp.

References removeAllClusters(), and removeAllSegs().


Member Function Documentation

void SegServer::assertServerOwns ( const SegAbstract s ) const [private]

Definition at line 119 of file SegServer.cpp.

Referenced by getIndex(), and remove().

void SegServer::assign ( const SegServer ss ) [private]
SegServer & SegServer::create (  ) [static]

Creates a new server (static method)

Returns:
a reference to the new server
Warning:
the server must be destroy at the end using operator "delete"

Definition at line 126 of file SegServer.cpp.

References alize::Object::assertMemoryIsAllocated(), and SegServer().

Referenced by createCluster(), and createSeg().

SegCluster & SegServer::createCluster ( unsigned long  lc = 0,
const String s = "",
const String sn = "" 
)

Creates a new cluster inside the server

Parameters:
lc= label code
s= a free string
sn= source name (free). Ex: file name
Returns:
a reference to the new cluster

Definition at line 148 of file SegServer.cpp.

References _clusterVect, _map, _nextClusterId, alize::RefVector< T >::addObject(), create(), getClusterIndexById(), alize::K::k, and alize::SegCluster::setId().

Seg & SegServer::createSeg ( unsigned long  b = 0,
unsigned long  l = 0,
unsigned long  lc = 0,
const String s = "",
const String sn = "" 
)

Creates a new segment inside the server

Parameters:
b= begin : number of the first feature
l= length : count of features
lc= label code
s= a free string
sn= source name (free). Ex: file name
Returns:
a reference to the new segment

Definition at line 133 of file SegServer.cpp.

References _segVect, alize::RefVector< T >::addObject(), create(), and alize::K::k.

void alize::SegServer::deleteDeletableSeg ( const K  )
Seg & SegServer::duplicateSeg ( const Seg s )

Duplicates a segment.

Parameters:
sthe seg to duplicate
Returns:
the new segment

Definition at line 141 of file SegServer.cpp.

References _segVect, alize::RefVector< T >::addObject(), alize::Seg::duplicate(), and alize::K::k.

Referenced by alize::Seg::duplicate().

String SegServer::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 297 of file SegServer.cpp.

SegCluster & SegServer::getCluster ( unsigned long  idx ) const

Returns the cluster by an index

Parameters:
idxthe index
Returns:
the cluster found
Exceptions:
IndexOutOfBoundsException

Definition at line 194 of file SegServer.cpp.

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

Referenced by assign(), getClusterById(), matchingSegAbstract(), removeAllClusters(), and setClusterId().

SegCluster & SegServer::getClusterById ( unsigned long  id ) const

Returns a cluster with a particular id

Parameters:
ididentifier to find
Returns:
the cluster
Exceptions:
Exceptionif the cluster does not exist

Definition at line 218 of file SegServer.cpp.

References _map, getCluster(), and alize::String::valueOf().

unsigned long SegServer::getClusterCount (  ) const

Returns the count of clusters in the server

Returns:
the count

Definition at line 251 of file SegServer.cpp.

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

Referenced by matchingSegAbstract(), removeAllClusters(), and toString().

long SegServer::getClusterIndexById ( unsigned long  id ) const

Tests whether a cluster with a particular id exists inside the server

Parameters:
ididentifier to find
Returns:
the index of the cluster if it exists; -1 otherwise

Definition at line 197 of file SegServer.cpp.

References _map.

Referenced by createCluster().

unsigned long SegServer::getIndex ( const SegAbstract s ) const

Returns the index of a segment or a cluster

Parameters:
ssegment or cluster
Returns:
the index
Exceptions:
Exceptionif the segment/cluster does not belong to the server

Definition at line 227 of file SegServer.cpp.

References _clusterVect, _segVect, assertServerOwns(), alize::RefVector< T >::getObject(), alize::Object::isSameObject(), NULL, and alize::RefVector< T >::size().

Seg & SegServer::getSeg ( unsigned long  idx ) const

Returns the segment by an index

Parameters:
idxthe index
Returns:
the segment found
Exceptions:
IndexOutOfBoundsException

Definition at line 189 of file SegServer.cpp.

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

Referenced by assign(), matchingSegAbstract(), and removeAllSegs().

unsigned long SegServer::getSegCount (  ) const

Returns the count of segments in the server

Returns:
the count

Definition at line 192 of file SegServer.cpp.

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

Referenced by matchingSegAbstract(), removeAllSegs(), and toString().

const String & SegServer::getServerName (  ) const

Returns the name of the server

Returns:
the name of the server

Definition at line 256 of file SegServer.cpp.

References _serverName.

void SegServer::load ( const FileName f,
const Config c 
)
SegAbstract & SegServer::matchingSegAbstract ( const SegAbstract s ) const [private]
bool alize::SegServer::operator!= ( const SegServer c ) const [private]

not implemented

const SegServer & SegServer::operator= ( const SegServer ss )

Assignment operator

Definition at line 74 of file SegServer.cpp.

References assign().

bool alize::SegServer::operator== ( const SegServer c ) const [private]
void SegServer::remove ( SegAbstract s )

Removes (deletes) a segment or a cluster from the server and from all the clusters (hierarchical clusters)

Parameters:
sthe segment or cluster to remove

Definition at line 160 of file SegServer.cpp.

References _clusterVect, _map, _segVect, assertServerOwns(), alize::SegCluster::getId(), alize::K::k, NULL, alize::SegCluster::removeAll(), alize::SegAbstract::removeAllOwners(), and alize::RefVector< T >::removeObject().

Referenced by alize::Seg::merge().

void SegServer::removeAllClusters (  )

Removes (deletes) all clusters from the server

Definition at line 182 of file SegServer.cpp.

References _nextClusterId, getCluster(), and getClusterCount().

Referenced by assign(), and ~SegServer().

void SegServer::removeAllSegs (  )

Removes (deletes) all segments from the server and from all the clusters

Definition at line 176 of file SegServer.cpp.

References getSeg(), and getSegCount().

Referenced by assign(), and ~SegServer().

void SegServer::save ( const FileName f,
const Config c 
) const

Saves the server in a file

Parameters:
fthe name of the file
cthe configuration to use

Definition at line 258 of file SegServer.cpp.

References alize::SegServerFileWriter::writeSegServer().

void SegServer::setClusterId ( SegCluster cl,
unsigned long  id 
)

Sets a new id to a cluster. The id must be unique in the server

Parameters:
clthe cluster
idthe id
Exceptions:
Exceptionthrown if the id is not unique or if the cluster does not belong to the server

Definition at line 205 of file SegServer.cpp.

References _map, getCluster(), alize::SegCluster::getId(), alize::Object::isSameObject(), alize::K::k, alize::SegCluster::setId(), and alize::String::valueOf().

void SegServer::setServerName ( const String s )

Sets the name of the server

Parameters:
sthe name of the server

Definition at line 254 of file SegServer.cpp.

References _serverName.

String SegServer::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Reimplemented from alize::Object.

Definition at line 299 of file SegServer.cpp.

References _serverName, getClusterCount(), getSegCount(), and alize::String::valueOf().


Friends And Related Function Documentation

friend class TestSegServer [friend]

Definition at line 90 of file SegServer.h.


Member Data Documentation

Definition at line 242 of file SegServer.h.

Referenced by assign(), createCluster(), getCluster(), getClusterCount(), getIndex(), and remove().

std::map<unsigned long, unsigned long> alize::SegServer::_map [private]
unsigned long alize::SegServer::_nextClusterId [private]

Definition at line 243 of file SegServer.h.

Referenced by assign(), createCluster(), and removeAllClusters().

Definition at line 241 of file SegServer.h.

Referenced by assign(), createSeg(), duplicateSeg(), getIndex(), getSeg(), getSegCount(), and remove().

Definition at line 240 of file SegServer.h.

Referenced by assign(), getServerName(), setServerName(), and toString().


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