#include <streamtracker.h>
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 | |
ProjectionDFAState * | cur |
The current state of the projection DFA. | |
Buffer * | buffer |
Pointer to the Buffer where data is stored in. | |
TagMap * | tagmap |
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. |
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.
Definition at line 56 of file streamtracker.h.
StreamTracker::StreamTracker | ( | ProjectionDFA * | _pdfa, | |
Buffer * | _buffer | |||
) |
Constructor.
Constructor - creating object for a ProjectionDFA and a Buffer.
[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.
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).
[in] | tag | The bachelor tag to be processed. |
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.
void |
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).
[in] | tag | The opening tag to be processed. |
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
[in] | data | The PCDATA content. |
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().
Buffer * StreamTracker::buffer [private] |
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().
ProjectionDFAState * StreamTracker::cur [private] |
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().
unsigned StreamTracker::keep_subtree_depth [private] |
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().
unsigned StreamTracker::skip_subtree_depth [private] |
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().
TagMap * StreamTracker::tagmap [private] |
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().