dlvhex  2.5.0
ModuleTable Class Reference

Lookup table for modules. More...

#include <include/dlvhex2/ModuleTable.h>

Inheritance diagram for ModuleTable:
Collaboration diagram for ModuleTable:

Public Types

typedef Container::index
< impl::AddressTag >::type 
AddressIndex
typedef AddressIndex::iterator AddressIterator
typedef Container::index
< impl::ModuleNameTag >::type 
ModuleNameIndex

Public Member Functions

const ModulegetByAddress (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 ModulegetModuleByName (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.

Detailed Description

Lookup table for modules.

Definition at line 50 of file ModuleTable.h.


Member Typedef Documentation

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.


Member Function Documentation

int ModuleTable::getAddressByName ( const std::string &  moduleName) const throw () [inline]

Get address of a module by its name.

Parameters:
moduleNameName of the module to retrieve.
Returns:
Address of the module correponding to moduleName.

Definition at line 187 of file ModuleTable.h.

References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.

Get range over all atoms sorted by address.

NOTE: you may need to lock the mutex also while iterating!

Returns:
Pair of a begin and an end iterator representing all modules in this table.

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.

Parameters:
addressAddress of the module to retrieve.
Returns:
Module corresonding to 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.

Parameters:
addressAddress of the module to retrieve.
Returns:
Module name corresonding to 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!

Parameters:
oStream to print to.
Returns:
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.

Returns:
mod Module to store.
Address of the stored module.

Definition at line 203 of file ModuleTable.h.

References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.


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