LLVM  4.0.0
Public Member Functions | List of all members
llvm::msf::VarStreamArrayIterator< ValueType, Extractor > Class Template Reference

VarStreamArray represents an array of variable length records backed by a stream. More...

#include <StreamArray.h>

Inheritance diagram for llvm::msf::VarStreamArrayIterator< ValueType, Extractor >:
[legend]
Collaboration diagram for llvm::msf::VarStreamArrayIterator< ValueType, Extractor >:
[legend]

Public Member Functions

 VarStreamArrayIterator (const ArrayType &Array, const Extractor &E, bool *HadError=nullptr)
 
 VarStreamArrayIterator ()=default
 
 VarStreamArrayIterator (const Extractor &E)
 
 ~VarStreamArrayIterator ()=default
 
bool operator== (const IterType &R) const
 
const ValueTypeoperator* () const
 
IterTypeoperator++ ()
 
- Public Member Functions inherited from llvm::iterator_facade_base< VarStreamArrayIterator< ValueType, Extractor >, std::forward_iterator_tag, ValueType >
VarStreamArrayIterator
< ValueType, Extractor > 
operator+ (std::ptrdiff_tn) const
 
VarStreamArrayIterator
< ValueType, Extractor > 
operator- (std::ptrdiff_tn) const
 
VarStreamArrayIterator
< ValueType, Extractor > & 
operator++ ()
 
VarStreamArrayIterator
< ValueType, Extractor > 
operator++ (int)
 
VarStreamArrayIterator
< ValueType, Extractor > & 
operator-- ()
 
VarStreamArrayIterator
< ValueType, Extractor > 
operator-- (int)
 
bool operator!= (const VarStreamArrayIterator< ValueType, Extractor > &RHS) const
 
bool operator> (const VarStreamArrayIterator< ValueType, Extractor > &RHS) const
 
bool operator<= (const VarStreamArrayIterator< ValueType, Extractor > &RHS) const
 
bool operator>= (const VarStreamArrayIterator< ValueType, Extractor > &RHS) const
 
ValueTypeoperator-> () const
 
ReferenceProxy operator[] (std::ptrdiff_tn) const
 

Additional Inherited Members

- Protected Types inherited from llvm::iterator_facade_base< VarStreamArrayIterator< ValueType, Extractor >, std::forward_iterator_tag, ValueType >
enum  
 

Detailed Description

template<typename ValueType, typename Extractor>
class llvm::msf::VarStreamArrayIterator< ValueType, Extractor >

VarStreamArray represents an array of variable length records backed by a stream.

This could be a contiguous sequence of bytes in memory, it could be a file on disk, or it could be a PDB stream where bytes are stored as discontiguous blocks in a file. Usually it is desirable to treat arrays as contiguous blocks of memory, but doing so with large PDB files, for example, could mean allocating huge amounts of memory just to allow re-ordering of stream data to be contiguous before iterating over it. By abstracting this out, we need not duplicate this memory, and we can iterate over arrays in arbitrarily formatted streams. Elements are parsed lazily on iteration, so there is no upfront cost associated with building a VarStreamArray, no matter how large it may be.

You create a VarStreamArray by specifying a ValueType and an Extractor type. If you do not specify an Extractor type, it expects you to specialize VarStreamArrayExtractor<T> for your ValueType.

By default an Extractor is default constructed in the class, but in some cases you might find it useful for an Extractor to maintain state across extractions. In this case you can provide your own Extractor through a secondary constructor. The following examples show various ways of creating a VarStreamArray.

  // Will use VarStreamArrayExtractor<MyType> as the extractor.
  VarStreamArray<MyType> MyTypeArray;

  // Will use a default-constructed MyExtractor as the extractor.
  VarStreamArray<MyType, MyExtractor> MyTypeArray2;

  // Will use the specific instance of MyExtractor provided.
  // MyExtractor need not be default-constructible in this case.
  MyExtractor E(SomeContext);
  VarStreamArray<MyType, MyExtractor> MyTypeArray3(E);

Definition at line 75 of file StreamArray.h.

Constructor & Destructor Documentation

template<typename ValueType , typename Extractor >
llvm::msf::VarStreamArrayIterator< ValueType, Extractor >::VarStreamArrayIterator ( const ArrayType Array,
const Extractor &  E,
bool HadError = nullptr 
)
inline
template<typename ValueType , typename Extractor >
llvm::msf::VarStreamArrayIterator< ValueType, Extractor >::VarStreamArrayIterator ( )
default
template<typename ValueType , typename Extractor >
llvm::msf::VarStreamArrayIterator< ValueType, Extractor >::VarStreamArrayIterator ( const Extractor &  E)
inlineexplicit

Definition at line 133 of file StreamArray.h.

template<typename ValueType , typename Extractor >
llvm::msf::VarStreamArrayIterator< ValueType, Extractor >::~VarStreamArrayIterator ( )
default

Member Function Documentation

template<typename ValueType , typename Extractor >
const ValueType& llvm::msf::VarStreamArrayIterator< ValueType, Extractor >::operator* ( ) const
inline

Definition at line 151 of file StreamArray.h.

References assert().

template<typename ValueType , typename Extractor >
IterType& llvm::msf::VarStreamArrayIterator< ValueType, Extractor >::operator++ ( )
inline
template<typename ValueType , typename Extractor >
bool llvm::msf::VarStreamArrayIterator< ValueType, Extractor >::operator== ( const IterType R) const
inline

Definition at line 136 of file StreamArray.h.

References assert().


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