libmonaa  0.5.2
Public Member Functions | Protected Attributes | List of all members
WordContainer< Container > Class Template Reference

Container class for the input timed word. More...

#include <word_container.hh>

Public Member Functions

 WordContainer (FILE *file, bool isBinary=false)
 The constructor. More...
 
Container::value_type operator[] (const std::size_t n)
 Access an element of the container. More...
 
Container::value_type at (const std::size_t n)
 Access an element of the container. More...
 
std::size_t size () const
 Returns the length of the timed word. More...
 
void setFront (std::size_t n)
 Discard the elements before n-th position. More...
 
bool fetch (std::size_t n)
 Fetch the timed words by n-th position. More...
 

Protected Attributes

Container vec
 The actual container of the timed word.
 

Detailed Description

template<class Container>
class WordContainer< Container >

Container class for the input timed word.

Note
This class just defines the interface of the container. The actual definition must be done in the class Container passed by template argument. An example is LazyDeque.

Constructor & Destructor Documentation

◆ WordContainer()

template<class Container >
WordContainer< Container >::WordContainer ( FILE *  file,
bool  isBinary = false 
)
inline

The constructor.

Parameters
[in]fileThe name of the file that the input timed word is in. If the container does not use the timed word in a file (e.g., when a result of simulation is directly passed), this can be ignored.
[in]isBinaryA flag if the input is in a binary file.

Member Function Documentation

◆ at()

template<class Container >
Container::value_type WordContainer< Container >::at ( const std::size_t  n)
inline

Access an element of the container.

Note
If the argument is out of range, out_of_range exception can be thrown.
Parameters
[in]nA position in the timed word
Returns
The n-th element in the timed word

◆ fetch()

template<class Container >
bool WordContainer< Container >::fetch ( std::size_t  n)
inline

Fetch the timed words by n-th position.

Parameters
[in]nA position in the timed word
Returns
It returns true if and only if the fetch succeeded.

◆ operator[]()

template<class Container >
Container::value_type WordContainer< Container >::operator[] ( const std::size_t  n)
inline

Access an element of the container.

Note
If the argument is out of range, out_of_range exception can be thrown.
Parameters
[in]nA position in the timed word
Returns
The n-th element in the timed word

◆ setFront()

template<class Container >
void WordContainer< Container >::setFront ( std::size_t  n)
inline

Discard the elements before n-th position.

Note
If n is out of range, out_of_range exception may be thrown.
Parameters
[in]nA position in the timed word

◆ size()

template<class Container >
std::size_t WordContainer< Container >::size ( ) const
inline

Returns the length of the timed word.

Note
If the length of the timed word is unknown (e.g., when the stream does not reach the end yet), the maximum value of std::size_t is returned.
Returns
The length of the timed word, if it is known.

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