dlvhex
2.5.0
|
Lookup table for modules. More...
#include <include/dlvhex2/ModuleTable.h>
Public Types | |
typedef Container::index < impl::AddressTag >::type | AddressIndex |
typedef AddressIndex::iterator | AddressIterator |
typedef Container::index < impl::ModuleNameTag >::type | ModuleNameIndex |
Public Member Functions | |
const Module & | getByAddress (int address) const throw () |
Retrieve by address. | |
const std::string & | getModuleName (int address) const throw () |
Retrieve module name by address. | |
std::pair< AddressIterator, AddressIterator > | getAllByAddress () const throw () |
Get range over all atoms sorted by address. | |
const Module & | getModuleByName (const std::string &moduleName) const throw () |
Given a module name, look if already stored. | |
int | getAddressByName (const std::string &moduleName) const throw () |
Get address of a module by its name. | |
int | storeAndGetAddress (const Module &mod) throw () |
Store symbol, assuming it does not exist. | |
virtual std::ostream & | print (std::ostream &o) const |
Prints the table in human-readable format. |
Lookup table for modules.
Definition at line 50 of file ModuleTable.h.
typedef Container::index<impl::AddressTag>::type ModuleTable::AddressIndex |
Definition at line 70 of file ModuleTable.h.
typedef AddressIndex::iterator ModuleTable::AddressIterator |
Definition at line 71 of file ModuleTable.h.
typedef Container::index<impl::ModuleNameTag>::type ModuleTable::ModuleNameIndex |
Definition at line 72 of file ModuleTable.h.
int ModuleTable::getAddressByName | ( | const std::string & | moduleName | ) | const throw () [inline] |
Get address of a module by its name.
moduleName | Name of the module to retrieve. |
moduleName
. Definition at line 187 of file ModuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
std::pair< ModuleTable::AddressIterator, ModuleTable::AddressIterator > ModuleTable::getAllByAddress | ( | ) | const throw () [inline] |
Get range over all atoms sorted by address.
NOTE: you may need to lock the mutex also while iterating!
Definition at line 122 of file ModuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
const Module & ModuleTable::getByAddress | ( | int | address | ) | const throw () [inline] |
Retrieve by address.
address | Address of the module to retrieve. |
address
. Definition at line 146 of file ModuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
const Module & ModuleTable::getModuleByName | ( | const std::string & | moduleName | ) | const throw () [inline] |
Given a module name, look if already stored.
MODULE_FAIL if moduleName
is not stored, otherwise return the module struct.
Definition at line 171 of file ModuleTable.h.
References Table< ValueT, IndexT >::container, MODULE_FAIL(), and Table< ValueT, IndexT >::mutex.
const std::string & ModuleTable::getModuleName | ( | int | address | ) | const throw () [inline] |
Retrieve module name by address.
address | Address of the module to retrieve. |
address
. Definition at line 158 of file ModuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
std::ostream & ModuleTable::print | ( | std::ostream & | o | ) | const [inline, virtual] |
Prints the table in human-readable format.
Implementation in Registry.cpp!
o | Stream to print to. |
o
. Reimplemented from Table< ValueT, IndexT >.
Definition at line 130 of file ModuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
int ModuleTable::storeAndGetAddress | ( | const Module & | mod | ) | throw () [inline] |
Store symbol, assuming it does not exist.
Assert that symbol did not exist.
Definition at line 203 of file ModuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.