LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::fireWireDCAM::nameDB Class Reference

Camera database. More...

#include <ltiFireWireDCAM.h>

Collaboration diagram for lti::fireWireDCAM::nameDB:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nameDB ()
 ~nameDB ()
bool use (const std::string &filename)
bool query (const std::string &name, u_int64_t &id) const
bool add (const std::string &name, u_int64_t &id)
bool del (const std::string &name)

Protected Member Functions

bool dump ()
bool read (const std::string &filename)
void hexToString (const u_int64_t &data, std::string &str) const
bool stringToHex (const std::string &str, u_int64_t &data) const

Protected Attributes

std::map< std::string, u_int64_t > data_
std::string filename_
mutex lock_
bool init_
bool modified_

Detailed Description

Camera database.

Just one instance of this class is used to manage the names of the available cameras.


Constructor & Destructor Documentation

lti::fireWireDCAM::nameDB::nameDB (  ) 

Default constructor.

Does nothing

lti::fireWireDCAM::nameDB::~nameDB (  ) 

Default destructor.

Saves all new data acquired in the file indicated by the use() method.


Member Function Documentation

bool lti::fireWireDCAM::nameDB::add ( const std::string &  name,
u_int64_t &  id 
)

Add a name,id pair.

Returns:
true if the pair could be successfully added or false if there was a problem (usually, the name already existed!
bool lti::fireWireDCAM::nameDB::del ( const std::string &  name  ) 

Delete an entry with the given name as key.

Returns:
true if the entry was removed or false if some problem occured, for instance, the entry didn't exist.
bool lti::fireWireDCAM::nameDB::dump (  )  [protected]

Dump the data_ into the file with the name filename_.

This does not lock! Do it outside the method.

Returns:
true if the file could be dumped or false if an error occurred (like no use() called before)
void lti::fireWireDCAM::nameDB::hexToString ( const u_int64_t &  data,
std::string &  str 
) const [protected]

Convert a 64 integer into a hex chain.

Since not all compilers behave the same with 64 bit chains, we better take charge ourselves of converting them into a chain of 16 nibbles preceded by 0x.

bool lti::fireWireDCAM::nameDB::query ( const std::string &  name,
u_int64_t &  id 
) const

Query a camera id through a camera name.

Returns:
true if the name could be found, in which case id will contain the proper data. false if the name could not be found.
bool lti::fireWireDCAM::nameDB::read ( const std::string &  filename  )  [protected]

Read the data_ from the file with the name filename.

This does not lock! Do it outside the method.

Returns:
true if the file could be read or false if an error occurred (like no use() called before)
bool lti::fireWireDCAM::nameDB::stringToHex ( const std::string &  str,
u_int64_t &  data 
) const [protected]

Convert a 16 nibble string into a u_int64_t value.

The string has to begin with "0x" and continue with a number of less or exactly 16 hex digits

bool lti::fireWireDCAM::nameDB::use ( const std::string &  filename  ) 

Use the given file to serialize the data.

Returns:
true if the file can be successfully open and read, or if it does not exist, if it can be successfully created.

Member Data Documentation

std::map<std::string,u_int64_t> lti::fireWireDCAM::nameDB::data_ [protected]

Map names to the identification numbers of cameras.

std::string lti::fireWireDCAM::nameDB::filename_ [protected]

Filename in use (given by use() method).

The file has to be read just once!

This flag stores if it was read or not

Protect data.

Flag to indicate if the database has been modified since the last read.


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

Generated on Sat Apr 10 15:28:02 2010 for LTI-Lib by Doxygen 1.6.1