ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Member Functions | Private Attributes | List of all members
meta::parser::transition_map Class Reference

An invertible map that maps transitions to ids. More...

#include <transition_map.h>

Classes

class  exception
 Exception thrown from interactions with the transition_map. More...
 

Public Member Functions

 transition_map ()=default
 Default constructor.
 
 transition_map (const std::string &prefix)
 Loads a transition map from a prefix. More...
 
const transitionat (trans_id id) const
 
trans_id at (const transition &trans) const
 
trans_id operator[] (const transition &trans)
 Adds a transition to the map, if it doesn't already exist. More...
 
void save (const std::string &prefix) const
 Saves the map to a file stored in the folder indicated by prefix. More...
 
uint64_t size () const
 

Private Attributes

util::sparse_vector< transition, trans_id > map_
 The map from transition to id.
 
std::vector< transitiontransitions_
 The "map" from id to transition.
 

Detailed Description

An invertible map that maps transitions to ids.

Constructor & Destructor Documentation

meta::parser::transition_map::transition_map ( const std::string &  prefix)

Loads a transition map from a prefix.

Parameters
prefixThe folder to load the map from

Member Function Documentation

const transition & meta::parser::transition_map::at ( trans_id  id) const
Parameters
idThe id to look up
Returns
the transition corresponding to that id
trans_id meta::parser::transition_map::at ( const transition trans) const
Parameters
transThe transition to look up
Returns
the trans_id associated with that transition
trans_id meta::parser::transition_map::operator[] ( const transition trans)

Adds a transition to the map, if it doesn't already exist.

Parameters
transThe transition to look up
thetrans_id associated with that transition.
void meta::parser::transition_map::save ( const std::string &  prefix) const

Saves the map to a file stored in the folder indicated by prefix.

Parameters
prefixThe folder to save the map to
uint64_t meta::parser::transition_map::size ( ) const
Returns
the number of transitions in the map.

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