#include <SegServer.h>


Public Member Functions | |
| SegServer () | |
| SegServer (const SegServer &) | |
| const SegServer & | operator= (const SegServer &ss) |
| virtual | ~SegServer () |
| Seg & | createSeg (unsigned long b=0, unsigned long l=0, unsigned long lc=0, const String &s="", const String &sn="") |
| Seg & | duplicateSeg (const Seg &s) |
| SegCluster & | createCluster (unsigned long lc=0, const String &s="", const String &sn="") |
| void | remove (SegAbstract &s) |
| void | removeAllSegs () |
| void | removeAllClusters () |
| Seg & | getSeg (unsigned long idx) const |
| SegCluster & | getCluster (unsigned long idx) const |
| long | getClusterIndexById (unsigned long id) const |
| SegCluster & | getClusterById (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 String & | getServerName () 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 SegServer & | create () |
Private Types | |
| typedef std::map< unsigned long, unsigned long > ::const_iterator | it_t |
Private Member Functions | |
| SegAbstract & | matchingSegAbstract (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 |
Class used to store segments and clusters of segments.
Definition at line 88 of file SegServer.h.
typedef std::map<unsigned long, unsigned long>::const_iterator alize::SegServer::it_t [private] |
Definition at line 244 of file SegServer.h.
| SegServer::SegServer | ( | ) | [explicit] |
Definition at line 68 of file SegServer.cpp.
Referenced by create().
| SegServer::SegServer | ( | const SegServer & | ss ) |
| SegServer::~SegServer | ( | ) | [virtual] |
Definition at line 306 of file SegServer.cpp.
References removeAllClusters(), and removeAllSegs().
| 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] |
Definition at line 80 of file SegServer.cpp.
References _clusterVect, _map, _nextClusterId, _segVect, _serverName, alize::SegCluster::add(), alize::RefVector< T >::addObject(), alize::SegCluster::duplicate(), alize::Seg::duplicate(), alize::SegCluster::get(), getCluster(), alize::SegCluster::getCount(), alize::SegCluster::getId(), getSeg(), alize::K::k, matchingSegAbstract(), removeAllClusters(), removeAllSegs(), alize::SegCluster::setId(), and alize::RefVector< T >::size().
Referenced by operator=(), and SegServer().
| SegServer & SegServer::create | ( | ) | [static] |
Creates a new server (static method)
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
| lc | = label code |
| s | = a free string |
| sn | = source name (free). Ex: file name |
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
| 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 |
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 & | ) |
Duplicates a segment.
| s | the seg to duplicate |
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
Implements alize::Object.
Definition at line 297 of file SegServer.cpp.
| SegCluster & SegServer::getCluster | ( | unsigned long | idx ) | const |
Returns the cluster by an index
| idx | the index |
| 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
| id | identifier to find |
| Exception | if 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
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
| id | identifier to find |
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
| s | segment or cluster |
| Exception | if 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
| idx | the index |
| 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
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
Definition at line 256 of file SegServer.cpp.
References _serverName.
Loads the server from a file
| f | the name of the file |
| c | the configuration to use |
Definition at line 261 of file SegServer.cpp.
References alize::String::endsWith(), alize::Config::getParam_loadSegServerFileFormat(), alize::SegServerFileReaderRaw::readSegServer(), alize::SegServerFileReaderFormat_LIUM, alize::SegServerFileReaderFormat_RAW, and alize::SegServerFileReaderFormat_XML.
| SegAbstract & SegServer::matchingSegAbstract | ( | const SegAbstract & | s ) | const [private] |
Definition at line 101 of file SegServer.cpp.
References getCluster(), getClusterCount(), getSeg(), getSegCount(), alize::SegAbstract::getServer(), and alize::Object::isSameObject().
Referenced by assign().
| bool alize::SegServer::operator!= | ( | const SegServer & | c ) | const [private] |
not implemented
| 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)
| s | the 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().
Saves the server in a file
| f | the name of the file |
| c | the 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
| cl | the cluster |
| id | the id |
| Exception | thrown 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
| s | the 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
Reimplemented from alize::Object.
Definition at line 299 of file SegServer.cpp.
References _serverName, getClusterCount(), getSegCount(), and alize::String::valueOf().
friend class TestSegServer [friend] |
Definition at line 90 of file SegServer.h.
RefVector<SegCluster> alize::SegServer::_clusterVect [private] |
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] |
Definition at line 245 of file SegServer.h.
Referenced by assign(), createCluster(), getClusterById(), getClusterIndexById(), remove(), and setClusterId().
unsigned long alize::SegServer::_nextClusterId [private] |
Definition at line 243 of file SegServer.h.
Referenced by assign(), createCluster(), and removeAllClusters().
RefVector<Seg> alize::SegServer::_segVect [private] |
Definition at line 241 of file SegServer.h.
Referenced by assign(), createSeg(), duplicateSeg(), getIndex(), getSeg(), getSegCount(), and remove().
String alize::SegServer::_serverName [private] |
Definition at line 240 of file SegServer.h.
Referenced by assign(), getServerName(), setServerName(), and toString().
1.7.2