World Ocean Simulation System (WOSS) library
woss::TransducerHandler Class Reference

Transducer creator and handler class. More...

#include <transducer-handler.h>

Collaboration diagram for woss::TransducerHandler:
Collaboration graph

Public Member Functions

 TransducerHandler ()
 
 TransducerHandler (const TransducerHandler &copy)
 
 TransducerHandler (TransducerMap &transduc_map)
 
bool insertValue (const ::std::string &name, Transducer *const transducer)
 
TransducerHandlerreplaceValue (const ::std::string &name, Transducer *const transducer)
 
const Transducer *const getValue (const ::std::string &name) const
 
TransducerHandlereraseValue (const ::std::string &name)
 
int size () const
 
bool empty () const
 
TransducerHandlerclear ()
 
TMCIter begin () const
 
TMCIter end () const
 
TMCRIter rbegin () const
 
TMCRIter rend () const
 
virtual bool importValueAscii (const ::std::string &type_name, const ::std::string &file_name)
 
virtual bool importValueBinary (const ::std::string &type_name, const ::std::string &file_name)
 
virtual bool writeValueAscii (const ::std::string &type_name, const ::std::string &file_name)
 
virtual bool writeValueBinary (const ::std::string &type_name, const ::std::string &file_name)
 
TransducerHandleroperator= (const TransducerHandler &x)
 
TransducerHandlersetDebug (bool flag)
 
bool getDebug ()
 

Protected Types

typedef ::std::map< ::std::string, Transducer * > TransducerMap
 
typedef TransducerMap::iterator TMIter
 
typedef TransducerMap::reverse_iterator TMRIter
 
typedef TransducerMap::const_iterator TMCIter
 
typedef TransducerMap::const_reverse_iterator TMCRIter
 

Protected Attributes

bool debug
 
TransducerMap transducer_map
 

Static Protected Attributes

static const ::std::string TRANSDUCER_NOT_VALID = "TRANSDUCER_NOT_VALID"
 

Detailed Description

Transducer creator and handler class.

woss::TransducerHandler class imports and saves woss::Transducer. It provides access to them via string name.

Member Typedef Documentation

◆ TransducerMap

typedef ::std::map< ::std::string, Transducer* > woss::TransducerHandler::TransducerMap
protected

Map that links a string to a pointer to a woss::Transducer

Constructor & Destructor Documentation

◆ TransducerHandler() [1/3]

TransducerHandler::TransducerHandler ( )

TransducerHandler default constructor

References woss::Singleton< T >::instance(), transducer_map, and TRANSDUCER_NOT_VALID.

Here is the call graph for this function:

◆ TransducerHandler() [2/3]

TransducerHandler::TransducerHandler ( const TransducerHandler copy)

TransducerHandler copy constructor

Parameters
copyconst reference a TransducerHandler

References woss::Singleton< T >::instance(), transducer_map, and TRANSDUCER_NOT_VALID.

Here is the call graph for this function:

◆ TransducerHandler() [3/3]

TransducerHandler::TransducerHandler ( TransducerMap transduc_map)

TransducerHandler constructor.

Parameters
transduc_mapTransducerMap to be inserted

References woss::Singleton< T >::instance(), transducer_map, and TRANSDUCER_NOT_VALID.

Here is the call graph for this function:

Member Function Documentation

◆ begin()

TransducerHandler::TMCIter woss::TransducerHandler::begin ( ) const
inline

Returns a const iterator to the beginning of the tranducer map

Returns
const iterator

References transducer_map.

◆ clear()

TransducerHandler & TransducerHandler::clear ( )

Deletes all pointers and clears the map

Returns
reference to *this

References clear(), and transducer_map.

Referenced by clear().

Here is the call graph for this function:

◆ empty()

bool woss::TransducerHandler::empty ( ) const
inline

Checks if the instance has any stored values

Returns
true if condition applies, false otherwise

References transducer_map.

◆ end()

TransducerHandler::TMCIter woss::TransducerHandler::end ( ) const
inline

Returns a const iterator to the end of the tranducer map

Returns
const iterator

References transducer_map.

◆ eraseValue()

TransducerHandler & TransducerHandler::eraseValue ( const ::std::string &  name)

Erases and deletes the pointer to a woss::Transducer for given string

Parameters
nameconst reference to string
Returns
reference to *this

References transducer_map.

◆ getValue()

const Transducer *const TransducerHandler::getValue ( const ::std::string &  name) const

Returns a const iterator to the woss::Transducer for given string.

Parameters
nameconst reference to string
Returns
constant pointer to a constant woss::Transducer that is invalid if the given key is not found.

References transducer_map, and TRANSDUCER_NOT_VALID.

Referenced by woss::BellhopCreator::initializeBhWoss().

◆ importValueAscii()

bool TransducerHandler::importValueAscii ( const ::std::string &  type_name,
const ::std::string &  file_name 
)
virtual

Imports a woss::Transducer from the given file and with given string key

Parameters
type_nametransducer type name
file_namefile path
Returns
true if method was successful, false otherwise

References woss::Transducer::clone(), woss::Transducer::import(), woss::Singleton< T >::instance(), and transducer_map.

Here is the call graph for this function:

◆ importValueBinary()

bool TransducerHandler::importValueBinary ( const ::std::string &  type_name,
const ::std::string &  file_name 
)
virtual

Imports a woss::Transducer from the given binary file and with given string key

Parameters
type_nametransducer type name
file_namefile path
Returns
true if method was successful, false otherwise

References woss::Transducer::clone(), woss::Transducer::importBinary(), woss::Singleton< T >::instance(), and transducer_map.

Here is the call graph for this function:

◆ insertValue()

bool TransducerHandler::insertValue ( const ::std::string &  name,
Transducer *const  transducer 
)

Inserts and doesn't replace if another pointer to a woss::Transducer is found for given key; in this case the given pointer is deleted.

Parameters
nametype name
transducerconstant pointer to a woss::Transducer
Returns
true if inserted, false otherwise

References transducer_map.

◆ operator=()

TransducerHandler & TransducerHandler::operator= ( const TransducerHandler x)

Assignment operator

Parameters
copyconst reference to a TransducerHandler object to be copied
Returns
TransducerHandler reference to this

References debug, woss::Singleton< T >::instance(), transducer_map, and TRANSDUCER_NOT_VALID.

Here is the call graph for this function:

◆ rbegin()

TransducerHandler::TMCRIter woss::TransducerHandler::rbegin ( ) const
inline

Returns a const reverse iterator to the reverse beginning of the tranducer map

Returns
const reverse iterator

References transducer_map.

◆ rend()

TransducerHandler::TMCRIter woss::TransducerHandler::rend ( ) const
inline

Returns a const reverse iterator to the reverse end of the tranducer map

Returns
const reverse iterator

References transducer_map.

◆ replaceValue()

TransducerHandler & TransducerHandler::replaceValue ( const ::std::string &  name,
Transducer *const  transducer 
)

Replaces a pointer to a woss::Transducer for given key. The old value is deleted

Parameters
nametype name
transducerconstant pointer to a woss::Transducer
Returns
true if inserted, false otherwise

References transducer_map.

◆ setDebug()

TransducerHandler & woss::TransducerHandler::setDebug ( bool  flag)
inline

Sets debug flag for all instances

Parameters
flagdebug bool

References debug.

◆ size()

int woss::TransducerHandler::size ( ) const
inline

Returns the number of pointers stored

Returns
number of pointers stored

References transducer_map.

◆ writeValueAscii()

bool TransducerHandler::writeValueAscii ( const ::std::string &  type_name,
const ::std::string &  file_name 
)
virtual

Writes a woss::Transducer to the given file

Parameters
type_nametransducer type name
file_namefile path
Returns
true if method was successful, false otherwise

References transducer_map.

◆ writeValueBinary()

bool TransducerHandler::writeValueBinary ( const ::std::string &  type_name,
const ::std::string &  file_name 
)
virtual

Writes a woss::Transducer to the given binary file

Parameters
type_nametransducer type name
file_namefile path
Returns
true if method was successful, false otherwise

References transducer_map.

Member Data Documentation

◆ debug

bool woss::TransducerHandler::debug
protected

debug flag

Referenced by operator=(), and setDebug().

◆ transducer_map

◆ TRANSDUCER_NOT_VALID

const ::std::string TransducerHandler::TRANSDUCER_NOT_VALID = "TRANSDUCER_NOT_VALID"
staticprotected

string key that represents an invalid woss::Transducer

Referenced by getValue(), operator=(), TransducerHandler(), TransducerHandler(), and TransducerHandler().


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