Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Attributes | Private Member Functions

DocumentIDTagger Class Reference
[Metadata]

Tags OpenMS file containers with a DocumentID. More...

#include <OpenMS/METADATA/DocumentIDTagger.h>

List of all members.

Public Member Functions

 DocumentIDTagger (String toolname)
 Constructor.
 DocumentIDTagger (const DocumentIDTagger &source)
 Copy constructor.
 ~DocumentIDTagger ()
 Destructor.
DocumentIDTaggeroperator= (const DocumentIDTagger &source)
 Assignment operator.
bool operator== (const DocumentIDTagger &source) const
 Equality operator.
bool operator!= (const DocumentIDTagger &source) const
 Equality operator.
String getPoolFile () const
 Return the file used as ID pool.
void setPoolFile (const String &file)
 Set the file used as ID pool.
bool tag (DocumentIdentifier &map) const
 Tags any structure which is derived from DocumentIdentifier with a unique tag.
bool countFreeIDs (Int &free) const
 return the number of available IDs in the pool.

Protected Attributes

String toolname_
 name of the calling TOPP tool
String pool_file_
 location of the ID pool

Private Member Functions

 DocumentIDTagger ()
 Constructor (declared away).
bool getID_ (String &id, Int &free, bool idcount_only) const
 retrieve an ID from the pool

Detailed Description

Tags OpenMS file containers with a DocumentID.

Intended usage is from within a TOPP tool. An instance of this class is present in TOPPBase and can be used by all derived TOPP tools to assign a unique ID which is fetched from an ID pool in ./share/OpenMS/IDPool/.


Constructor & Destructor Documentation

DocumentIDTagger (  )  [private]

Constructor (declared away).

DocumentIDTagger ( String  toolname  ) 

Constructor.

DocumentIDTagger ( const DocumentIDTagger source  ) 

Copy constructor.

~DocumentIDTagger (  ) 

Destructor.


Member Function Documentation

bool countFreeIDs ( Int free  )  const

return the number of available IDs in the pool.

Retrieve the number of available IDs in the pool. Returns true of count was successful, false otherwise (locking error, file creation error ...)

Parameters:
free Number of available identifiers. You should worry if it's 0!
bool getID_ ( String id,
Int free,
bool  idcount_only 
) const [private]

retrieve an ID from the pool

Uses boost filelocks to safely retrieve an ID from an ID pool.

Parameters:
id Unique identifier returned from ID pool
free Number of available identifiers in ID pool (before this query)
idcount_only Only count available identifiers, do NOT retrieve one (the id string will nevertheless be filled)

Return true if all file operations could be executed successfully (this does not imply there was an ID left over - check free>0)

String getPoolFile (  )  const

Return the file used as ID pool.

The default ID pool file is in /share/OpenMS/IDPool/IDPool.txt A custom file can be set by setIDPoolFile()

bool operator!= ( const DocumentIDTagger source  )  const

Equality operator.

DocumentIDTagger& operator= ( const DocumentIDTagger source  ) 

Assignment operator.

bool operator== ( const DocumentIDTagger source  )  const

Equality operator.

void setPoolFile ( const String file  ) 

Set the file used as ID pool.

bool tag ( DocumentIdentifier map  )  const

Tags any structure which is derived from DocumentIdentifier with a unique tag.

Tags any structure which is derived from DocumentIdentifier with a unique tag Returns true if ID could be assigned, otherwise an Exception::DepletedIDPool is thrown

Parameters:
map Some class (derived from a DocumentIdentifier class) which needs a unique id
Exceptions:
Exception::DepletedIDPool when no identifier (for whatever reason) could be aquired

Member Data Documentation

String pool_file_ [protected]

location of the ID pool

String toolname_ [protected]

name of the calling TOPP tool


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:56 using doxygen 1.7.1