KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
semantics::Token_map Class Referenceabstract

#include <Token_map.h>

Inheritance diagram for semantics::Token_map:
semantics::Lexicon_db semantics::Nonterminal_db semantics::Semantic_db

Public Types

typedef std::string Key_type
 
typedef size_t Val_type
 
typedef boost::bimap< Key_type,
Val_type
Map
 
typedef Map::value_type Key_val_pair
 
typedef Map::right_value_type Val_key_pair
 
typedef Map::const_iterator const_iterator
 

Public Member Functions

 Token_map ()
 construct an empty token map More...
 
virtual ~Token_map ()
 translate key into code More...
 
virtual Val_type get_code (const Token_map::Key_type &key)
 look up code associated with key, or return UNKNOWN_TOKEN_VAL More...
 
virtual Val_type encode (const Key_type &key, bool learn=false)
 look up code associated with key, adding it if not found More...
 
virtual const Key_typedecode (const Val_type &val)
 look up key associated with code More...
 
virtual Val_type next_val ()
 gets the next unused code available (e.g., for UNKNOWN) More...
 
const_iterator begin ()
 
const_iterator end ()
 

Static Public Attributes

static const Val_type UNKNOWN_TOKEN_VAL = 1
 

Protected Member Functions

virtual const Key_typeunknown_key ()=0
 

Protected Attributes

Map map_
 
Val_type next_val_
 

Friends

std::ostream & operator<< (std::ostream &os, Token_map &map)
 

Member Typedef Documentation

typedef Map::const_iterator semantics::Token_map::const_iterator
typedef std::string semantics::Token_map::Key_type
typedef Map::value_type semantics::Token_map::Key_val_pair
typedef Map::right_value_type semantics::Token_map::Val_key_pair

Constructor & Destructor Documentation

semantics::Token_map::Token_map ( )
inline

construct an empty token map

virtual semantics::Token_map::~Token_map ( )
inlinevirtual

translate key into code

Returns
returns code associated with key, with constant UNKNOWN code

Member Function Documentation

const_iterator semantics::Token_map::begin ( )
inline
const Token_map::Key_type & semantics::Token_map::decode ( const Val_type val)
virtual

look up key associated with code

Token_map::Val_type semantics::Token_map::encode ( const Key_type key,
bool  learn = false 
)
virtual

look up code associated with key, adding it if not found

const_iterator semantics::Token_map::end ( )
inline
Token_map::Val_type semantics::Token_map::get_code ( const Token_map::Key_type key)
virtual

look up code associated with key, or return UNKNOWN_TOKEN_VAL

virtual Val_type semantics::Token_map::next_val ( )
inlinevirtual

gets the next unused code available (e.g., for UNKNOWN)

virtual const Key_type& semantics::Token_map::unknown_key ( )
protectedpure virtual

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
Token_map map 
)
friend

Member Data Documentation

Map semantics::Token_map::map_
protected
Val_type semantics::Token_map::next_val_
protected
const Token_map::Val_type semantics::Token_map::UNKNOWN_TOKEN_VAL = 1
static

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