StreamTracker Class Reference

Keeps track of the input stream and appends data to the buffer. More...

#include <streamtracker.h>

Collaboration diagram for StreamTracker:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 StreamTracker (ProjectionDFA *_pdfa, Buffer *_buffer)
 Constructor.
virtual ~StreamTracker ()
void processOpeningTag (const char *tag)
 Processes an opening tag.
void processBachelorTag (const char *tag)
 Processes a bachelor tag.
void processClosingTag ()
 Processes a closing tag.
void processPCData (const char *data)
 Processes PCDATA content.

Private Attributes

ProjectionDFAStatecur
 The current state of the projection DFA.
Bufferbuffer
 Pointer to the Buffer where data is stored in.
TagMaptagmap
 Map for translating tags to their integer ids and vice versa.
unsigned skip_subtree_depth
 Depth tracker used to efficiently skip whole subtrees.
unsigned keep_subtree_depth
 Depth tracker used to efficiently keep whole subtrees.


Detailed Description

Keeps track of the input stream and appends data to the buffer.

This class communicates directly with the buffer. It keeps track of the current state in the ProjectionDFA and, based on this state, decides whether new tags or PCDATA content is appended to the buffer or discarded. Furthermore, it is responsible for adding roles to buffer where necessary.

Author:
Michael Schmidt

Gunnar Jehl

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

Definition at line 56 of file streamtracker.h.


Constructor & Destructor Documentation

StreamTracker::StreamTracker ( ProjectionDFA _pdfa,
Buffer _buffer 
)

Constructor.

Constructor - creating object for a ProjectionDFA and a Buffer.

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

Definition at line 37 of file streamtracker.cpp.

StreamTracker::~StreamTracker (  )  [virtual]

Destructor.

Definition at line 42 of file streamtracker.cpp.


Member Function Documentation

void StreamTracker::processBachelorTag ( const char *  tag  ) 

Processes a bachelor tag.

Depending on the current state of the projection DFA, the token is either projected away or stored in the buffer (together with associated roles).

Parameters:
[in] tag The bachelor tag to be processed.
Return values:
void 

Definition at line 78 of file streamtracker.cpp.

References Buffer::appendTag(), buffer, Buffer::closeTag(), cur, ProjectionDFAState::getCumulativeRoles(), ProjectionDFAState::getNonCumulativeRoles(), TagMap::insertTagWithOffset(), keep_subtree_depth, ProjectionDFAState::keepNode(), skip_subtree_depth, tagmap, ProjectionDFAState::takeTransition(), ProjectionDFAState::traceBack(), TRANSITION_KEEP_SUBTREE, TRANSITION_REGULAR, TRANSITION_SKIP_SUBTREE, and TRANSITION_UNKNOWN.

void StreamTracker::processClosingTag (  ) 

Processes a closing tag.

Depending on the current state of the projection DFA, the closing tag is either ignored or the corresponing opening tag in the buffer is marked as closed.

Return values:
void 
Exceptions:
May throw a ParseException if -DVALIDATION is turned on.

Definition at line 160 of file streamtracker.cpp.

References buffer, Buffer::closeTag(), cur, keep_subtree_depth, ProjectionDFAState::keepNode(), skip_subtree_depth, and ProjectionDFAState::traceBack().

Referenced by StreamPreProcessor::processClosingTag(), StreamPreProcessor::readAll(), and StreamPreProcessor::readNext().

void StreamTracker::processOpeningTag ( const char *  tag  ) 

Processes an opening tag.

Depending on the current state of the projection DFA, the token is either projected away or stored in the buffer (together with associated roles).

Parameters:
[in] tag The opening tag to be processed.
Return values:
void 

Definition at line 45 of file streamtracker.cpp.

References Buffer::appendTag(), buffer, cur, ProjectionDFAState::getCumulativeRoles(), ProjectionDFAState::getNonCumulativeRoles(), TagMap::insertTagWithOffset(), keep_subtree_depth, ProjectionDFAState::keepNode(), skip_subtree_depth, tagmap, ProjectionDFAState::takeTransition(), TRANSITION_KEEP_SUBTREE, TRANSITION_REGULAR, TRANSITION_SKIP_SUBTREE, and TRANSITION_UNKNOWN.

Referenced by StreamPreProcessor::processOpeningTag().

void StreamTracker::processPCData ( const char *  data  ) 

Processes PCDATA content.

Depending on the current state of the projection DFA, the PCDATA content is either projected away or stored in the buffer

Parameters:
[in] data The PCDATA content.
Return values:
void 

Definition at line 175 of file streamtracker.cpp.

References Buffer::appendPCData(), buffer, cur, ProjectionDFAState::getCumulativeRoles(), ProjectionDFAState::getNonCumulativeRoles(), keep_subtree_depth, skip_subtree_depth, and ProjectionDFAState::takeTextTransition().

Referenced by StreamPreProcessor::processPCData().


Member Data Documentation

Pointer to the Buffer where data is stored in.

This member variable allows for direct manipulation of the one and only Buffer used during evaluation.

Definition at line 152 of file streamtracker.h.

Referenced by processBachelorTag(), processClosingTag(), processOpeningTag(), and processPCData().

The current state of the projection DFA.

This variable is used to permanently keep track of the current projection DFA state. It determines the actions to be taken when opening/closing tags or PCDATA content is received.

Definition at line 145 of file streamtracker.h.

Referenced by processBachelorTag(), processClosingTag(), processOpeningTag(), and processPCData().

Depth tracker used to efficiently keep whole subtrees.

Whenever subtrees are stored completely in the buffer, this. member variable is used to keep track of the current depth in the relevant subtree, allowing for faster processing.

Definition at line 174 of file streamtracker.h.

Referenced by processBachelorTag(), processClosingTag(), processOpeningTag(), and processPCData().

Depth tracker used to efficiently skip whole subtrees.

Whenever subtrees are irrelevant, this member variable is used to keep track of the current depth, which allows for fast skipping of subtrees.

Definition at line 166 of file streamtracker.h.

Referenced by processBachelorTag(), processClosingTag(), processOpeningTag(), and processPCData().

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

Allows for the efficient retrieval of tag ids.

Definition at line 158 of file streamtracker.h.

Referenced by processBachelorTag(), and processOpeningTag().


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