cttl::inode_reader< NodeDescriptorT, ContainerT > Struct Template Reference

Represents readable node of a syntax tree, modeled on top of STL sequence container. More...

#include <inode_reader.h>

List of all members.

Public Types

typedef inode_reader
< NodeDescriptorT, ContainerT > 
const_iterator
 Defines const_iterator type.
typedef inode_reader
< NodeDescriptorT, ContainerT > 
const_reference
 Bidirectional iterator: const reference type of the node.
typedef ContainerT::const_reference container_const_reference_T
 Defines constant reference type of the container.
typedef ContainerT::reference container_reference_T
 Defines reference type of the container.
typedef ContainerT container_T
 Defines type container.
typedef ptrdiff_t difference_type
 Bidirectional iterator: difference type of the node.
typedef NodeDescriptorT inode_descriptor_T
 Describes logical field positions of the node.
typedef inode_reader
< NodeDescriptorT, ContainerT > 
iterator
 Defines iterator type.
typedef
std::bidirectional_iterator_tag 
iterator_category
 Bidirectional iterator: iterator category of the node.
typedef inode_reader
< NodeDescriptorT, ContainerT > * 
pointer
 Bidirectional iterator: pointer type of the node.
typedef inode_reader
< NodeDescriptorT, ContainerT > 
reference
 Bidirectional iterator: reference type of the node.
typedef ContainerT::size_type size_type
 Bidirectional iterator: size type of the node.
typedef inode_reader
< NodeDescriptorT, ContainerT > 
value_type
 Bidirectional iterator: value type of the node.

Public Member Functions

inode_reader< NodeDescriptorT,
ContainerT > 
begin (int offset_) const
 Returns arbitrary node of the container.
inode_reader< NodeDescriptorT,
ContainerT > 
begin () const
 Bidirectional iterator: returns first node of the container.
inode_reader< NodeDescriptorT,
ContainerT > 
end () const
 Bidirectional iterator: returns zero node of the container.
 inode_reader (ContainerT &container_, size_type offset_)
 Constructs new cttl::inode_reader at specified position.
 inode_reader (ContainerT &container_)
 Constructs new cttl::inode_reader and positions itself at the end.
 inode_reader (inode_reader< NodeDescriptorT, ContainerT > const &other_)
 Bidirectional iterator: copy constructor.
 inode_reader ()
 Bidirectional iterator: default constructor.
size_type offset () const
 Returns current offset of the syntax tree node.
void offset (size_type offset_)
 Sets offset of syntax tree node.
bool operator!= (inode_reader< NodeDescriptorT, ContainerT > const &other_) const
 Bidirectional iterator: true if node positions are different nodes.
inode_reader< NodeDescriptorT,
ContainerT > 
operator() (int field_) const
 Returns instance of cttl::inode_reader pointing to a specific relative node.
reference operator* ()
 Bidirectional iterator: dereference operator of the integer node iterator.
const_reference operator* () const
 Bidirectional iterator: dereference operator of the integer node iterator.
inode_reader< NodeDescriptorT,
ContainerT > 
operator++ (int)
 Bidirectional iterator: postfix increment operator of the integer node iterator.
inode_reader< NodeDescriptorT,
ContainerT > & 
operator++ ()
 Bidirectional iterator: prefix increment operator of the integer node iterator.
inode_reader< NodeDescriptorT,
ContainerT > 
operator-- (int)
 Bidirectional iterator: postfix decrement operator of the integer node iterator.
inode_reader< NodeDescriptorT,
ContainerT > & 
operator-- ()
 Bidirectional iterator: prefix decrement operator of the integer node iterator.
value_typeoperator-> ()
 Bidirectional iterator: pointer operator of the integer node iterator.
value_type const * operator-> () const
 Bidirectional iterator: pointer operator of the integer node iterator.
inode_reader< NodeDescriptorT,
ContainerT > & 
operator= (inode_reader< NodeDescriptorT, ContainerT > const &other_)
 Bidirectional iterator: assignment operator.
bool operator== (inode_reader< NodeDescriptorT, ContainerT > const &other_) const
 Bidirectional iterator: inode_reader comparison returns true if positions of two nodes are equal, false otherwise.
container_const_reference_T operator[] (int field_) const
 Returns constant value at specific field of syntax tree node.
container_reference_T operator[] (int field_)
 Returns mutable value stored at specific field of syntax tree node.
container_const_reference_T value (int field_) const
 Returns constant value at specific field of syntax tree node.
container_reference_T value (int field_)
 Returns mutable value stored at specific field of syntax tree node.

Static Public Attributes

static const int next_link = NodeDescriptorT::NEXT_LINK
 Position of the field that points to the next node.
static const int previous_link = NodeDescriptorT::PREVIOUS_LINK
 Position of the field that points to the previous node.

Protected Attributes

size_type m_offset
 Offset of the node.
ContainerT * m_ptr_container
 Pointer to STL sequence container providing physical storage of the syntax tree.


Detailed Description

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
struct cttl::inode_reader< NodeDescriptorT, ContainerT >

Represents readable node of a syntax tree, modeled on top of STL sequence container.

While representing tree node, cttl::inode_reader behaves as bidirectional iterator.

Template Parameters:
previous_link specifies field pointing to the previous node. As bidirectional iterator, node can be moved to the previous node by prefix and postfix decrement operators. Syntax node stores offset of the previous node in the field described by previous_link.
next_link specifies field pointing to the next node. As bidirectional iterator, node can be moved to the next node by prefix and postfix increment operators. Syntax node stores offset of the next node in the field described by next_link.
ContainerT specifies underlying sequence container type.
See also:

Definition at line 75 of file inode_reader.h.


Member Typedef Documentation

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::const_iterator

Defines const_iterator type.

Definition at line 100 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::const_reference

Bidirectional iterator: const reference type of the node.

Definition at line 112 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef ContainerT::const_reference cttl::inode_reader< NodeDescriptorT, ContainerT >::container_const_reference_T

Defines constant reference type of the container.

Definition at line 94 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef ContainerT::reference cttl::inode_reader< NodeDescriptorT, ContainerT >::container_reference_T

Defines reference type of the container.

Definition at line 91 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef ContainerT cttl::inode_reader< NodeDescriptorT, ContainerT >::container_T

Defines type container.

Definition at line 88 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef ptrdiff_t cttl::inode_reader< NodeDescriptorT, ContainerT >::difference_type

Bidirectional iterator: difference type of the node.

Definition at line 118 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef NodeDescriptorT cttl::inode_reader< NodeDescriptorT, ContainerT >::inode_descriptor_T

Describes logical field positions of the node.

Definition at line 85 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::iterator

Defines iterator type.

Definition at line 97 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef std::bidirectional_iterator_tag cttl::inode_reader< NodeDescriptorT, ContainerT >::iterator_category

Bidirectional iterator: iterator category of the node.

Definition at line 121 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef inode_reader< NodeDescriptorT, ContainerT >* cttl::inode_reader< NodeDescriptorT, ContainerT >::pointer

Bidirectional iterator: pointer type of the node.

Definition at line 106 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::reference

Bidirectional iterator: reference type of the node.

Definition at line 109 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef ContainerT::size_type cttl::inode_reader< NodeDescriptorT, ContainerT >::size_type

Bidirectional iterator: size type of the node.

Definition at line 115 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
typedef inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::value_type

Bidirectional iterator: value type of the node.

Definition at line 103 of file inode_reader.h.


Constructor & Destructor Documentation

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
cttl::inode_reader< NodeDescriptorT, ContainerT >::inode_reader (  ) 

Bidirectional iterator: default constructor.

Definition at line 126 of file inode_reader.h.

00127         :
00128         m_offset( 0 ),
00129         m_ptr_container( NULL )
00130     {
00131     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
cttl::inode_reader< NodeDescriptorT, ContainerT >::inode_reader ( inode_reader< NodeDescriptorT, ContainerT > const &  other_  ) 

Bidirectional iterator: copy constructor.

Definition at line 134 of file inode_reader.h.

00135         :
00136         m_offset( other_.m_offset ),
00137         m_ptr_container( other_.m_ptr_container )
00138     {
00139     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
cttl::inode_reader< NodeDescriptorT, ContainerT >::inode_reader ( ContainerT &  container_  ) 

Constructs new cttl::inode_reader and positions itself at the end.

Definition at line 142 of file inode_reader.h.

00143         :
00144         m_offset( container_.size() ),
00145         m_ptr_container( &container_ )
00146     {
00147     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
cttl::inode_reader< NodeDescriptorT, ContainerT >::inode_reader ( ContainerT &  container_,
size_type  offset_ 
)

Constructs new cttl::inode_reader at specified position.

Definition at line 150 of file inode_reader.h.

00151         :
00152         m_offset( offset_ ),
00153         m_ptr_container( &container_ )
00154     {
00155     }


Member Function Documentation

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::begin ( int  offset_  )  const

Returns arbitrary node of the container.

Definition at line 241 of file inode_reader.h.

00242     {
00243         return inode_reader< NodeDescriptorT, ContainerT >( *m_ptr_container, offset_ );
00244     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::begin (  )  const

Bidirectional iterator: returns first node of the container.

Definition at line 235 of file inode_reader.h.

00236     {
00237         return inode_reader< NodeDescriptorT, ContainerT >( *m_ptr_container, 0 );
00238     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::end (  )  const

Bidirectional iterator: returns zero node of the container.

Definition at line 247 of file inode_reader.h.

00248     {
00249         return begin();
00250     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
size_type cttl::inode_reader< NodeDescriptorT, ContainerT >::offset (  )  const

Returns current offset of the syntax tree node.

Definition at line 287 of file inode_reader.h.

00288     {
00289         return m_offset;
00290     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
void cttl::inode_reader< NodeDescriptorT, ContainerT >::offset ( size_type  offset_  ) 

Sets offset of syntax tree node.

Definition at line 281 of file inode_reader.h.

00282     {
00283         m_offset = offset_;
00284     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
bool cttl::inode_reader< NodeDescriptorT, ContainerT >::operator!= ( inode_reader< NodeDescriptorT, ContainerT > const &  other_  )  const

Bidirectional iterator: true if node positions are different nodes.

Definition at line 229 of file inode_reader.h.

00230     {
00231         return ( offset() != other_.offset() );
00232     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::operator() ( int  field_  )  const

Returns instance of cttl::inode_reader pointing to a specific relative node.

Definition at line 297 of file inode_reader.h.

00298     {
00299         return inode_reader< NodeDescriptorT, ContainerT >( *m_ptr_container, value( field_ ) );
00300     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
reference cttl::inode_reader< NodeDescriptorT, ContainerT >::operator* (  ) 

Bidirectional iterator: dereference operator of the integer node iterator.

Definition at line 175 of file inode_reader.h.

00176     {
00177         return *this;
00178     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
const_reference cttl::inode_reader< NodeDescriptorT, ContainerT >::operator* (  )  const

Bidirectional iterator: dereference operator of the integer node iterator.

Definition at line 169 of file inode_reader.h.

00170     {
00171         return *this;
00172     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::operator++ ( int   ) 

Bidirectional iterator: postfix increment operator of the integer node iterator.

Definition at line 200 of file inode_reader.h.

00201     {
00202         inode_reader< NodeDescriptorT, ContainerT > sibling( *this );
00203         offset( value( next_link ) );
00204         return sibling;
00205     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT >& cttl::inode_reader< NodeDescriptorT, ContainerT >::operator++ (  ) 

Bidirectional iterator: prefix increment operator of the integer node iterator.

Definition at line 193 of file inode_reader.h.

00194     {
00195         offset( value( next_link ) );
00196         return *this;
00197     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT > cttl::inode_reader< NodeDescriptorT, ContainerT >::operator-- ( int   ) 

Bidirectional iterator: postfix decrement operator of the integer node iterator.

Definition at line 215 of file inode_reader.h.

00216     {
00217         inode_reader< NodeDescriptorT, ContainerT > sibling( *this );
00218         offset( value( previous_link ) );
00219         return sibling;
00220     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT >& cttl::inode_reader< NodeDescriptorT, ContainerT >::operator-- (  ) 

Bidirectional iterator: prefix decrement operator of the integer node iterator.

Definition at line 208 of file inode_reader.h.

00209     {
00210         offset( value( previous_link ) );
00211         return *this;
00212     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
value_type* cttl::inode_reader< NodeDescriptorT, ContainerT >::operator-> (  ) 

Bidirectional iterator: pointer operator of the integer node iterator.

Definition at line 187 of file inode_reader.h.

00188     {
00189         return this;
00190     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
value_type const* cttl::inode_reader< NodeDescriptorT, ContainerT >::operator-> (  )  const

Bidirectional iterator: pointer operator of the integer node iterator.

Definition at line 181 of file inode_reader.h.

00182     {
00183         return this;
00184     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
inode_reader< NodeDescriptorT, ContainerT >& cttl::inode_reader< NodeDescriptorT, ContainerT >::operator= ( inode_reader< NodeDescriptorT, ContainerT > const &  other_  ) 

Bidirectional iterator: assignment operator.

Definition at line 158 of file inode_reader.h.

00159     {
00160         if ( this != &other_ ) {
00161             m_offset = other_.m_offset;
00162             m_ptr_container = other_.m_ptr_container;
00163         }
00164 
00165         return *this;
00166     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
bool cttl::inode_reader< NodeDescriptorT, ContainerT >::operator== ( inode_reader< NodeDescriptorT, ContainerT > const &  other_  )  const

Bidirectional iterator: inode_reader comparison returns true if positions of two nodes are equal, false otherwise.

Definition at line 223 of file inode_reader.h.

00224     {
00225         return ( offset() == other_.offset() );
00226     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
container_const_reference_T cttl::inode_reader< NodeDescriptorT, ContainerT >::operator[] ( int  field_  )  const

Returns constant value at specific field of syntax tree node.

Definition at line 275 of file inode_reader.h.

00276     {
00277         return value( field_ );
00278     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
container_reference_T cttl::inode_reader< NodeDescriptorT, ContainerT >::operator[] ( int  field_  ) 

Returns mutable value stored at specific field of syntax tree node.

Definition at line 269 of file inode_reader.h.

00270     {
00271         return value( field_ );
00272     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
container_const_reference_T cttl::inode_reader< NodeDescriptorT, ContainerT >::value ( int  field_  )  const

Returns constant value at specific field of syntax tree node.

Definition at line 263 of file inode_reader.h.

00264     {
00265         return (*m_ptr_container)[ m_offset + field_ ];
00266     }

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
container_reference_T cttl::inode_reader< NodeDescriptorT, ContainerT >::value ( int  field_  ) 

Returns mutable value stored at specific field of syntax tree node.

Definition at line 257 of file inode_reader.h.

00258     {
00259         return (*m_ptr_container)[ m_offset + field_ ];
00260     }


Member Data Documentation

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
size_type cttl::inode_reader< NodeDescriptorT, ContainerT >::m_offset [protected]

Offset of the node.

Definition at line 308 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
ContainerT* cttl::inode_reader< NodeDescriptorT, ContainerT >::m_ptr_container [protected]

Pointer to STL sequence container providing physical storage of the syntax tree.

Definition at line 311 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
const int cttl::inode_reader< NodeDescriptorT, ContainerT >::next_link = NodeDescriptorT::NEXT_LINK [static]

Position of the field that points to the next node.

Definition at line 79 of file inode_reader.h.

template<typename NodeDescriptorT = inode_default_descriptor, typename ContainerT = std::vector< size_t >>
const int cttl::inode_reader< NodeDescriptorT, ContainerT >::previous_link = NodeDescriptorT::PREVIOUS_LINK [static]

Position of the field that points to the previous node.

Definition at line 82 of file inode_reader.h.


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

Generated on Sat Aug 22 22:33:54 2009 for Common Text Transformation Library by  doxygen 1.5.9