// cxaRuleCacheElement.cpp: implementation of the cxaRuleCacheElement class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "cxaToken.h"
#include "cxAnalyzerTypeMap.h"
#include "cxAnalyzerExpression.h"
#include "cxAnalyzerTree.h"
#include "cxaRuleCacheElement.h"
#include "cxaRuleCache.h"
#include "cxAnalyzerMain.h"
#include "cxaRuleCacheElement.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
cxaRuleCacheElement::cxaRuleCacheElement(
int _nRuleIDValue, int _nAtmTypeFirst,
const cxaToken* _patFirstToken, bool _fCheckFirstIs,
cxaTokenStream::const_iterator _start,
cxaTokenStream::const_iterator _end)
: nRuleIDValue(_nRuleIDValue),
nAtmTypeFirst(_nAtmTypeFirst),
patFirstToken(_patFirstToken),
start(_start), end(_end)
{
int posStart = _start->nToid;
// int posEnd = _end->nToid;
hashValue = ((hashvalue_type)nRuleIDValue)
+ (((hashvalue_type)_nAtmTypeFirst)<<10L)
+ (((hashvalue_type)posStart)<<20L);
fCheckFirstIs =_fCheckFirstIs;
}
cxaRuleCacheElement::~cxaRuleCacheElement()
{ }
//////////////////////////////////////////////////////////////////////
// Operations
//////////////////////////////////////////////////////////////////////
void cxaRuleCacheElement::vSetContents(
const cxAnalyzerTree* patTree,
cxAnalyzerTree::chkpoint_type cpStart,
cxAnalyzerTree::chkpoint_type cpEnd)
{
ASSERT(patTree!=NULL);
ASSERT(cpStart>=0);
ASSERT(cpEnd>cpStart);
patTree->vExtractLogData(cpStart,data,cpEnd);
}
void cxaRuleCacheElement::vUnloadTo(
cxAnalyzerTree* patTree,
cxaTokenStream::const_iterator& _end) const
{
patTree->vInsertLogData(data);
_end = end;
}