StreamPreProcessor Class Reference

The StreamPreprocessor manages prefiltering of the input stream. More...

#include <streampreprocessor.h>

Collaboration diagram for StreamPreProcessor:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~StreamPreProcessor ()
void processOpeningTag (const char *tag)
 Process the passed opening tag.
void processBachelorTag (const char *tag)
 Process the passed bachelor tag.
void processClosingTag ()
 Process closing tag message.
void processPCData (const char *data)
 Process PCDATA content.
void readNext ()
 Projects another token into the buffer.
void readAll ()
 Projects the whole input stream into the buffer.

Static Public Member Functions

static void initInstance (Buffer *_buffer, ProjectionDFA *_pdfa)
 Initializes the one and only stream preprocessor instance (singleton).
static StreamPreProcessorgetInstance ()
 Returns the one and only instance of the stream preprocessor.

Private Member Functions

 StreamPreProcessor (Buffer *_buffer, ProjectionDFA *_pdfa)
 Constructor.

Private Attributes

TagMaptagmap
 Map for translating tags to their integer ids and vice versa.
TAG tag
 The last recently processed opening tag.
StreamTracker st
 The StreamTracker object used to keep track of the input stream.

Static Private Attributes

static StreamPreProcessorinstance = NULL
 Instance of StreamPreProcessor.


Detailed Description

The StreamPreprocessor manages prefiltering of the input stream.

The stream preprocessor controls static stream projection, which bases on an analysis of the paths used in the input query. It provides the getNext()-function, which allows the query evaluator to project new data into the buffer on demand. This is realized by passing data to the StreamTracker, which itself communicates directly with the buffer.

Note:
The class is implemented as Singleton pattern, so there cannot be more than one instance of this class.
Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 78 of file streampreprocessor.h.


Constructor & Destructor Documentation

StreamPreProcessor::~StreamPreProcessor (  )  [virtual]

Destructor.

Definition at line 54 of file streampreprocessor.cpp.

References destroyLexer().

StreamPreProcessor::StreamPreProcessor ( Buffer _buffer,
ProjectionDFA _pdfa 
) [private]

Constructor.

Constructor - creating object for a Buffer and a ProjectionDFA.

Parameters:
[in] _buffer A pointer to the buffer where data is stored in.
[in] _pdfa The projection DFA that is used for stream preprojection.

Definition at line 47 of file streampreprocessor.cpp.

References getInstance(), InputStream::getParserStream(), and yyxmlin.

Referenced by initInstance().


Member Function Documentation

static StreamPreProcessor * StreamPreProcessor::getInstance (  )  [static]

Returns the one and only instance of the stream preprocessor.

Returns the one and only instance of the stream preprocessor. The method should be called after having initialized the instance using method initInstance().

Note:
Do not call this method before having called initInstance().
Return values:
StreamPreprocessor* The global stream preprocessor object.

Definition at line 43 of file streampreprocessor.cpp.

References instance.

Referenced by Executor::preprocessStream(), saxBeginElement(), saxBeginEndElement(), saxCharacters(), saxEndElement(), StreamPreProcessor(), and Executor::~Executor().

static void StreamPreProcessor::initInstance ( Buffer _buffer,
ProjectionDFA _pdfa 
) [static]

Initializes the one and only stream preprocessor instance (singleton).

Initializes the stream preprocessor. The initialized instance can then be accessed using method getInstance().

Note:
CALL THIS METHOD BEFORE METHOD getInstance()!
Parameters:
[in] _buffer A pointer to the buffer where data is stored in.
[in] _pdfa The projection DFA that is used for stream preprojection.
Return values:
void 

Definition at line 39 of file streampreprocessor.cpp.

References instance, and StreamPreProcessor().

Referenced by Executor::initStreamParser().

void StreamPreProcessor::processBachelorTag ( const char *  tag  )  [inline]

Process the passed bachelor tag.

The bachelor tag parameter is, depending on the state of projection dfa, either appended to the buffer or discarded. If appended, roles are also added to the buffer.

Parameters:
[in] tag The name of the bachelor tag that read in the input stream.
Return values:
void 

Definition at line 125 of file streampreprocessor.h.

Referenced by saxBeginEndElement().

void StreamPreProcessor::processClosingTag (  )  [inline]

Process closing tag message.

If the corresponding opening that has not been projected away, the active buffer opening tag is marked as closed.

Return values:
void 
Note:
This method is used only if GCX compile flag -DVALIDATION is turned off.

Definition at line 150 of file streampreprocessor.h.

References StreamTracker::processClosingTag(), and st.

Referenced by saxEndElement().

void StreamPreProcessor::processOpeningTag ( const char *  tag  )  [inline]

Process the passed opening tag.

The opening tag parameter is, depending on the state of projection dfa, either appended to the buffer or discarded. If appended, roles are also added to the buffer.

Parameters:
[in] tag The name of the tag that has been encountered in the input stream.
Return values:
void 

Definition at line 115 of file streampreprocessor.h.

References StreamTracker::processOpeningTag(), and st.

Referenced by saxBeginElement().

void StreamPreProcessor::processPCData ( const char *  data  )  [inline]

Process PCDATA content.

The PCDATA content is, depending on the state of projection dfa, either appended to the buffer or discarded.

Parameters:
[in] data The PCDATA content that has been encountered in the input stream
Return values:
void 

Definition at line 162 of file streampreprocessor.h.

References StreamTracker::processPCData(), and st.

Referenced by saxCharacters().

void StreamPreProcessor::readAll (  ) 

Projects the whole input stream into the buffer.

This method is not used in typical runs, but required if only input stream projection is carried out. Be aware that, when using this method, the whole document will be loaded into the buffer and the benefit of the signOff mechanism will be totally lost. The purpose of this method is for debugging.

Return values:
void 

Definition at line 68 of file streampreprocessor.cpp.

References StreamTracker::processClosingTag(), saxparse(), st, and TAGID_ROOT.

Referenced by Executor::preprocessStream().

void StreamPreProcessor::readNext (  ) 

Projects another token into the buffer.

This is done by querying the next token from the SAX parser. As a response, typically one of the three methods processOpeningTag(), processPCData(), or closeTag() will be called.

Return values:
void 

Definition at line 58 of file streampreprocessor.cpp.

References StreamTracker::processClosingTag(), saxparse(), st, and TAGID_ROOT.

Referenced by BufferIterator::getNext(), and BufferIterator::isSatisfyingPath().


Member Data Documentation

static StreamPreProcessor * StreamPreProcessor::instance = NULL [static, private]

Instance of StreamPreProcessor.

Instance of StreamPreProcessor to avoid duplicate existence of this object.

Definition at line 191 of file streampreprocessor.h.

Referenced by getInstance(), and initInstance().

The StreamTracker object used to keep track of the input stream.

The StreamTracker object used to keep track of the input stream. Basically, the StreamPreprocessor passes the input stream to this object, which communicates directly with the buffer.

Definition at line 219 of file streampreprocessor.h.

Referenced by processClosingTag(), processOpeningTag(), processPCData(), readAll(), and readNext().

The last recently processed opening tag.

The last recently processed opening tag, mainly required to perform document validation.

Definition at line 211 of file streampreprocessor.h.

Map for translating tags to their integer ids and vice versa.

See class TagMap for more information.

Definition at line 204 of file streampreprocessor.h.


Generated on Sun May 24 20:20:30 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9