Commit e5ca8229 authored by Omran Saleh's avatar Omran Saleh
Browse files

Fix CEP engine and start the restructuring

parent 013c66fd
......@@ -34,17 +34,16 @@
* The main engine to process CEP
*/
namespace pfabric {
template<class Tin, class Tout, class Tdep>
template<class TinPtr, class ToutPtr, class TdepPtr>
class Matcher;
//class GCStructures;
template<class Tin, class Tout, class Tdep>
template<class TinPtr, class ToutPtr, class TdepPtr>
class CEPEngine {
typedef boost::intrusive_ptr<Tin> TinPtr;
protected:
/**
* CEP manager to notify the system with the matched events
*/
Matcher<Tin, Tout, Tdep> *manager;
Matcher<TinPtr, ToutPtr, TdepPtr> *manager;
/**
* statistical counter to store number of matches
*/
......@@ -52,15 +51,15 @@ protected:
/**
* a pool of structures
*/
StructurePool<Tin, Tout, Tdep>* pool;
StructurePool<TinPtr, ToutPtr, TdepPtr>* pool;
/**
* to be deleted structures, these can be outputted structures or violated time constraint structures
*/
std::list<typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr> deletedStructures;
std::list<typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr> deletedStructures;
/**
* the global NFA
*/
typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr nfa;
typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr nfa;
/**
* create new structure, the event in the parameter will be the first matched event
* @param event an event to start the structure (sequence) with it
......@@ -88,24 +87,24 @@ protected:
* @param str
* @return
*/
bool checkWindowTime(const TinPtr& event, const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str);
bool checkWindowTime(const TinPtr& event, const typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr& str);
/**
* check edge predicates
* @param event
* @param str
* @return
*/
int checkPredicate(const TinPtr& event, const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str,
typename NFAState<Tin>::StateType &type);
int checkPredicate(const TinPtr& event, const typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr& str,
typename NFAState<TinPtr>::StateType &type);
public:
/**
* constructor to receive the CEP manager
* @param manager
*/
CEPEngine(Matcher<Tin, Tout, Tdep> *manager): counter(0), cgIndicator(false) {
CEPEngine(Matcher<TinPtr, ToutPtr, TdepPtr> *manager): counter(0), cgIndicator(false) {
this->manager = manager;
this->nfa = typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr (new NFAController<Tin, Tout, Tdep>());
this->pool = new StructurePool<Tin, Tout, Tdep>();
this->nfa = typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr (new NFAController<TinPtr, ToutPtr, TdepPtr>());
this->pool = new StructurePool<TinPtr, ToutPtr, TdepPtr>();
this->equalityPar = new SequencePartition<TinPtr>;
windowConst = new WindowStruct;
windowConst->window = WindowStruct::NoConstraint;
......@@ -143,42 +142,42 @@ public:
* get the structures pool
* @return structures pool
*/
StructurePool<Tin, Tout, Tdep>* getStructurePool() const {
StructurePool<TinPtr, ToutPtr, TdepPtr>* getStructurePool() const {
return this->pool;
}
/**
* set the structures pool
* @param pool the structures pool
*/
void setStructurePool(StructurePool<Tin, Tout, Tdep>* pool) {
void setStructurePool(StructurePool<TinPtr, ToutPtr, TdepPtr>* pool) {
this->pool = pool ;
}
/**
* get the structures to be deleted
* @return the structures to be deleted
*/
std::list<typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr> getDeletedStructures() const {
std::list<typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr> getDeletedStructures() const {
return this->deletedStructures;
}
/**
* set the structures to be deleted
* @param deletedStructures the structures to be deleted
*/
void setDeletedStructures(std::list<typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr> deletedStructures) {
void setDeletedStructures(std::list<typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr> deletedStructures) {
this->deletedStructures = deletedStructures;
}
/**
* get our working NFA
* @return our working NFA
*/
const typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr getNFA() const {
const typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr getNFA() const {
return this->nfa;
}
/**
* set our working NFA
* @param nfa our working NFA
*/
void setNFA(NFAController<Tin, Tout, Tdep>* nfa) { this->nfa = nfa; }
void setNFA(NFAController<TinPtr, ToutPtr, TdepPtr>* nfa) { this->nfa = nfa; }
/**
* clean unwanted structures from current run
*/
......@@ -222,23 +221,24 @@ protected:
namespace pfabric {
template<class Tin, class Tout, class Tdep>
CEPEngine<Tin, Tout, Tdep>::~CEPEngine() {
template<class TinPtr, class ToutPtr, class Tdep>
CEPEngine<TinPtr, ToutPtr, Tdep>::~CEPEngine() {
delete this->pool;
delete this->equalityPar;
delete this->windowConst;
}
template<class Tin, class Tout, class Tdep>
bool CEPEngine<Tin, Tout, Tdep>::checkWindowTime(const TinPtr& event,
const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str) {
template<class TinPtr, class ToutPtr, class TdepPtr>
bool CEPEngine<TinPtr, ToutPtr, TdepPtr>::checkWindowTime(const TinPtr& event,
const typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr& str) {
/*
if (windowConst->window == WindowStruct::FirstLastEvents) {
if (event->getTimestamp() - str->getFirstEventTimestamp()
if (event->timestamp() - str->getFirstEventTimestamp()
<= windowConst->period) {
return true;
}
} else if (windowConst->window == WindowStruct::FromLastEvents) {
if (event->getTimestamp()
if (event->timestamp()
- str->getEventTimestamp(windowConst->eventFrom)
<= windowConst->period)
return true;
......@@ -248,40 +248,41 @@ bool CEPEngine<Tin, Tout, Tdep>::checkWindowTime(const TinPtr& event,
<= windowConst->period)
return true;
}
return false;
*/
return true;
}
template<class Tin, class Tout, class Tdep>
int CEPEngine<Tin, Tout, Tdep>::checkPredicate(const TinPtr& event,
const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str, typename NFAState<Tin>::StateType &type) {
template<class TinPtr, class ToutPtr, class TdepPtr>
int CEPEngine<TinPtr, ToutPtr, TdepPtr>::checkPredicate(const TinPtr& event,
const typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr& str, typename NFAState<TinPtr>::StateType &type) {
if (str->getCurrentState()->getStateType() == NFAState<Tin>::Normal) {
if (str->getCurrentState()->getStateType() == NFAState<TinPtr>::Normal) {
//creat_new_structure(event, current_state);
auto current = (NormalState<Tin, Tout, Tdep>*)str->getCurrentState();
auto current = (NormalState<TinPtr, ToutPtr, TdepPtr>*)str->getCurrentState();
for (int i = 0; i < current->getNumEdges(); i++) {
if (current->getForwardEdgeByIndex(i)->evaluate(event, str)) {
return i;
}
}
} else if (str->getCurrentState()->getStateType()
== NFAState<Tin>::Kleene) {
== NFAState<TinPtr>::Kleene) {
//try go to the next
auto current = (KleeneState<Tin, Tout, Tdep>*)(
auto current = (KleeneState<TinPtr, ToutPtr, TdepPtr>*)(
str->getCurrentState());
bool forwardOK = false;
switch (current->getSpecification()) {
case KleeneState<Tin, Tout, Tdep>::Star:
case KleeneState<Tin, Tout, Tdep>::Question: {
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Star:
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Question: {
forwardOK = true;
break;
}
case KleeneState<Tin, Tout, Tdep>::Plus: {
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Plus: {
if (str->getCurrentKleene(current) == 1) {
forwardOK = true;
}
break;
}
case KleeneState<Tin, Tout, Tdep>::Restricted:
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Restricted:
if (str->getCurrentKleene(current)
>= current->getLoopEdge()->getNumOfLoop()) {
forwardOK = true;
......@@ -299,18 +300,18 @@ int CEPEngine<Tin, Tout, Tdep>::checkPredicate(const TinPtr& event,
auto loop = current->getLoopEdge();
if (loop->evaluate(event, str)) {
switch (current->getSpecification()) {
case KleeneState<Tin, Tout, Tdep>::Star:
case KleeneState<Tin, Tout, Tdep>::Question: {
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Star:
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Question: {
str->addEvent(event, loop);
break;
}
case KleeneState<Tin, Tout, Tdep>::Plus: {
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Plus: {
if (str->getCurrentKleene(current) == 0) {
str->addEvent(event, loop);
}
break;
}
case KleeneState<Tin, Tout, Tdep>::Restricted: {
case KleeneState<TinPtr, ToutPtr, TdepPtr>::Restricted: {
if (str->getCurrentKleene(current)
< current->getLoopEdge()->getNumOfLoop()) {
str->addEvent(event, loop);
......@@ -320,20 +321,20 @@ int CEPEngine<Tin, Tout, Tdep>::checkPredicate(const TinPtr& event,
}
}
} else if (str->getCurrentState()->getStateType()
== NFAState<Tin>::Negation) {
auto current = (NormalState<Tin, Tout, Tdep>*)str->getCurrentState();
== NFAState<TinPtr>::Negation) {
auto current = (NormalState<TinPtr, ToutPtr, TdepPtr>*)str->getCurrentState();
do {
for (int i = 0; i < current->getNumEdges(); i++) {
if (current->getForwardEdgeByIndex(i)->evaluate(event,
str)) {
type = NFAState<Tin>::Negation;
type = NFAState<TinPtr>::Negation;
return -1;
}
}
current = (NormalState<Tin, Tout, Tdep>*)(
current = (NormalState<TinPtr, ToutPtr, TdepPtr>*)(
current->getForwardEdgeByIndex(0)->getDestState());
} while (current->getStateType() == NFAState<Tin>::Negation);
if (current->getStateType() == NFAState<Tin>::Final)
} while (current->getStateType() == NFAState<TinPtr>::Negation);
if (current->getStateType() == NFAState<TinPtr>::Final)
return 0;
for (int i = 0; i < current->getNumEdges(); i++) {
if (current->getForwardEdgeByIndex(i)->evaluate(event, str)) {
......@@ -345,15 +346,15 @@ int CEPEngine<Tin, Tout, Tdep>::checkPredicate(const TinPtr& event,
return -1;
}
template<class Tin, class Tout, class Tdep>
void CEPEngine<Tin, Tout, Tdep>:: runGCstructures() {
template<class TinPtr, class ToutPtr, class Tdep>
void CEPEngine<TinPtr, ToutPtr, Tdep>:: runGCstructures() {
for (int i = 0; i < this->deletedStructures.size(); i++) {
const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str = this->deletedStructures.front();
const typename NFAStructure<TinPtr, ToutPtr, Tdep>::NFAStructurePtr& str = this->deletedStructures.front();
auto par = str->getEqualityValue();
typename ValueIDMultimap<typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr, TinPtr>::MultimapPair iterPair =
typename ValueIDMultimap<typename NFAStructure<TinPtr, ToutPtr, Tdep>::NFAStructurePtr, TinPtr>::MultimapPair iterPair =
this->pool->getValue(par);
typename ValueIDMultimap<typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr, TinPtr>::MultimapConstIterator it = iterPair.first;
typename ValueIDMultimap<typename NFAStructure<TinPtr, ToutPtr, Tdep>::NFAStructurePtr, TinPtr>::MultimapConstIterator it = iterPair.first;
for (; it != iterPair.second; ++it) {
if (it->second == str) {
pool->removeValue(it);
......@@ -363,8 +364,8 @@ void CEPEngine<Tin, Tout, Tdep>:: runGCstructures() {
this->deletedStructures.pop_front();
}
}
template<class Tin, class Tout, class Tdep>
void CEPEngine<Tin, Tout, Tdep>::createStartStructure(const TinPtr& event) {
template<class TinPtr, class ToutPtr, class Tdep>
void CEPEngine<TinPtr, ToutPtr, Tdep>::createStartStructure(const TinPtr& event) {
auto start = this->nfa->getStartState();
for (int i = 0; i < start->getNumEdges(); i++) {
if (start->getForwardEdgeByIndex(i)->evaluate(event, NULL)) {
......@@ -379,8 +380,8 @@ void CEPEngine<Tin, Tout, Tdep>::createStartStructure(const TinPtr& event) {
}
template<class Tin, class Tout, class Tdep>
void CEPEngine<Tin, Tout, Tdep>::setWindowConstraint(long period, int fromEvent,
template<class TinPtr, class ToutPtr, class Tdep>
void CEPEngine<TinPtr, ToutPtr, Tdep>::setWindowConstraint(long period, int fromEvent,
int toEvent) {
windowConst->eventFrom = fromEvent;
windowConst->eventTo = toEvent;
......
......@@ -37,10 +37,8 @@ namespace pfabric {
* Sequence is necessary to mark the order of this event in the complex event.
*/
//class Instance;
template<class Tin, class Tout>
template<class TinPtr, class ToutPtr>
class Instance {
typedef boost::intrusive_ptr<Tin> TinPtr;
typedef boost::intrusive_ptr<Tout> ToutPtr;
typedef pfabric::Tuple<std::string, int> FooterTuple;
typedef boost::intrusive_ptr<FooterTuple> FooterTuplePtr;
private:
......@@ -64,7 +62,7 @@ private:
public:
typedef boost::intrusive_ptr<Instance<Tin, Tout>> InstancePtr;
typedef boost::intrusive_ptr<Instance<TinPtr, ToutPtr>> InstancePtr;
/**
* A constructor: receive the original CEP event and map it to an instance
* @param event the original CEP event
......@@ -129,16 +127,16 @@ public:
* not events.
* @return tuple construction
*/
ToutPtr convertInstanceToTuple() {
TinPtr convertInstanceToTuple() {
/**
* A tuple contains the sate name and the sequence should be combined with the original
* event data. The timestamp of this instance is the timestamp of the original event
*/
FooterTuplePtr foot = makeTuplePtr(state, sequenceInComplex);
ToutPtr res(
new Tout(std::tuple_cat(originalEvent->data(), foot->data())));
res->setTimestamp(originalEvent->getTimestamp());
return res;
//ToutPtr res(
// new Tout(std::tuple_cat(originalEvent->data(), foot->data())));
//res->setTimestamp(originalEvent->getTimestamp());
return originalEvent;
}
/**
......
......@@ -30,14 +30,12 @@
*/
namespace pfabric {
template<class Tin, class Tout, class Tdep>
template<class TinPtr, class ToutPtr, class TdepPtr>
class MatchProducer {
public:
typedef boost::shared_ptr<MatchProducer<Tin, Tout, Tdep>> MatchProducerPtr;
typedef boost::intrusive_ptr<Tin> TinPtr;
typedef boost::intrusive_ptr<Tout> ToutPtr;
typedef typename std::vector<typename Instance<Tin, Tout>::InstancePtr> matchesList;
typedef typename std::vector<typename Instance<Tin, Tout>::InstancePtr>::const_iterator matchConstIterator;
typedef boost::shared_ptr<MatchProducer<TinPtr, ToutPtr, TdepPtr>> MatchProducerPtr;
typedef typename std::vector<typename Instance<TinPtr, ToutPtr>::InstancePtr> matchesList;
typedef typename std::vector<typename Instance<TinPtr, ToutPtr>::InstancePtr>::const_iterator matchConstIterator;
/**
* A constructor to receive and build a match from a 'structure' which has events ids for the match, then get the actual events
* from an event buffer to build a match
......@@ -51,13 +49,13 @@ public:
* @return a new tuple which has all corresponding events
*/
ToutPtr produceTogether(
const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str) {
const typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr& str) {
//int index = 0;
typename MatchProducer<Tin, Tout, Tdep>::matchesList matches;
typename MatchProducer<TinPtr, ToutPtr, TdepPtr>::matchesList matches;
std::vector<typename Instance<Tin, Tout>::InstancePtr> l =
std::vector<typename Instance<TinPtr, ToutPtr>::InstancePtr> l =
str->getEvents();
for (typename std::vector<typename Instance<Tin, Tout>::InstancePtr>::const_iterator i =
for (typename std::vector<typename Instance<TinPtr, ToutPtr>::InstancePtr>::const_iterator i =
l.begin(); i != l.end(); i++) {
auto tup = (*i)->getOriginalEvent();
for (int j = 0; j < tup->size(); j++) {
......@@ -74,7 +72,7 @@ public:
* @return a list of all matches for this structure
*/
matchesList produceAsList(
const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str) {
const typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr& str) {
return str->getEvents();
}
......@@ -83,7 +81,7 @@ public:
* @return the size
*/
int sizeOfMatch(
const typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr& str) {
const typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr& str) {
return str->getSequence();
}
/**
......
......@@ -268,7 +268,7 @@ else {
EventDependency>::matchConstIterator i = list.begin();
i != list.end(); i++) {
//std::cout << (*i)->convertInstanceToTuple() << std::endl;
this->template getOutputChannel<0>().publish((*i)->convertInstanceToTuple(), false);
//this->getOutputDataChannel().publish( (*i)->convertInstanceToTuple(), false);
}
}
}
......
This diff is collapsed.
......@@ -30,38 +30,36 @@
#include "util/Partition.hpp"
namespace pfabric {
template<class Tin, class Tout, class Tdep>
template<class TinPtr, class ToutPtr, class TdepPtr>
struct compare {
compare(KleeneState<Tin, Tout, Tdep>* val) :
compare(KleeneState<TinPtr, ToutPtr, TdepPtr>* val) :
val_(val) {
}
bool operator()(const std::pair<KleeneState<Tin, Tout, Tdep>*, short>& elem) const {
bool operator()(const std::pair<KleeneState<TinPtr, ToutPtr, TdepPtr>*, short>& elem) const {
return val_ == elem.first;
}
private:
KleeneState<Tin, Tout, Tdep>* val_;
KleeneState<TinPtr, ToutPtr, TdepPtr>* val_;
};
//template<class Tin, class Tout>
//class NFAStructure;
template<class Tin, class Tout, class Tdep>
template<class TinPtr, class ToutPtr, class TdepPtr>
class StructurePool;
template<class Tin, class Tout, class Tdep>
template<class TinPtr, class ToutPtr, class TdepPtr>
class NFAStructure {
typedef boost::intrusive_ptr<Tin> TinPtr;
typedef boost::intrusive_ptr<Tin> ToutPtr;
mutable boost::atomic<short> refCount;
private:
/**
* store the events of this structure which contribute on complex event
*/
std::vector<typename Instance<Tin, Tout>::InstancePtr> events;
std::vector<typename Instance<TinPtr, ToutPtr>::InstancePtr> events;
/**
* which state the structure is at
*/
NFAState<Tin>* currentState;
NFAState<TinPtr>* currentState;
/**
* boolean indicating whether the structure is complete to make a match
......@@ -70,29 +68,29 @@ private:
/**
* our working NFA
*/
typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr nfa;
typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr nfa;
/**
* store related values
*/
Tdep relatedValues;
TdepPtr relatedValues;
/*
* the partition of this structure
*/
Partition<TinPtr>* equality;
std::vector<std::pair<KleeneState<Tin, Tout, Tdep>*, short> > kleeneState;
std::vector<std::pair<KleeneState<TinPtr, ToutPtr, TdepPtr>*, short> > kleeneState;
public:
typedef boost::intrusive_ptr<NFAStructure<Tin, Tout, Tdep>> NFAStructurePtr;
typedef boost::intrusive_ptr<NFAStructure<TinPtr, ToutPtr, TdepPtr>> NFAStructurePtr;
/**
* constructor
* @param start the current state is set to start state
*/
NFAStructure(typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr nfa);
NFAStructure(typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr nfa);
/**
* virtual destructor
......@@ -103,12 +101,12 @@ public:
* Get the current state
* @return the current state
*/
NFAState<Tin>* getCurrentState() const { return this->currentState; }
NFAState<TinPtr>* getCurrentState() const { return this->currentState; }
/**
* set the current state
* @param current_state the current state to set
*/
void setCurrentState(NFAState<Tin>* cur) {
void setCurrentState(NFAState<TinPtr>* cur) {
assert(currentState);
this->currentState = cur;
}
......@@ -116,12 +114,12 @@ public:
* get all event taht match this structure
* @return all event for this structure
*/
const std::vector<typename Instance<Tin, Tout>::InstancePtr>& getEvents() const { return this->events; }
const std::vector<typename Instance<TinPtr, ToutPtr>::InstancePtr>& getEvents() const { return this->events; }
/**
* set all event ids for this structure
* @param events all event ids for this structure
*/
void setEvents(std::vector<typename Instance<Tin, Tout>::InstancePtr> events) { this->events = events; }
void setEvents(std::vector<typename Instance<TinPtr, ToutPtr>::InstancePtr> events) { this->events = events; }
/**
* Checks whether this structure is ready to make a matcht
* @return the complete flag
......@@ -138,27 +136,27 @@ public:
* get the nfa controller
* @return the nfa
*/
typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr getNFA() const { return this->nfa; }
typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr getNFA() const { return this->nfa; }
/**
* set the nfa
* @param nfa the nfa to set
*/
void setNFA(typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr nfa);
void setNFA(typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr nfa);
/**
* Adds an event to this structure, and makes necessary updates
* @param event the event to be added
* @param the current edge
*/
void addEvent(const TinPtr& event, NFAEdge<Tin, Tout, Tdep>* currentEdge);
void addEvent(const TinPtr& event, NFAEdge<TinPtr, ToutPtr, TdepPtr>* currentEdge);
/**
* Clones the structure
* @return new structure
*/
//typename NFAStructure<Tin, Tout, Tdep>::NFAStructurePtr clone( StructurePool<Tin, Tout, Tdep>* pool) ;
//typename NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructurePtr clone( StructurePool<TinPtr, ToutPtr, TdepPtr>* pool) ;
/**
* get a particular event
*/
typename Instance<Tin, Tout>::InstancePtr getEvent(long index) const {
typename Instance<TinPtr, ToutPtr>::InstancePtr getEvent(long index) const {
assert(index < events.size());
return this->events[index];
}
......@@ -212,15 +210,15 @@ public:
}
}
const Tdep& getRelatedValue() {return relatedValues;}
const TdepPtr& getRelatedValue() {return relatedValues;}
void setEqualityValue(Partition<TinPtr>* par) { this->equality = par; }
Partition<TinPtr>* getEqualityValue() { return equality; }
short getCurrentKleene(KleeneState<Tin, Tout, Tdep>* kState) const {
short getCurrentKleene(KleeneState<TinPtr, ToutPtr, TdepPtr>* kState) const {
return std::find_if(kleeneState.begin(), kleeneState.end(),
compare<Tin, Tout, Tdep>((KleeneState<Tin, Tout, Tdep>*) (currentState)))->second;
compare<TinPtr, ToutPtr, TdepPtr>((KleeneState<TinPtr, ToutPtr, TdepPtr>*) (currentState)))->second;
};
};
......@@ -229,8 +227,8 @@ public:
namespace pfabric {
template<class Tin, class Tout, class Tdep>
NFAStructure<Tin, Tout, Tdep>::NFAStructure(typename NFAController<Tin, Tout, Tdep>::NFAControllerPtr nfa) :
template<class TinPtr, class ToutPtr, class TdepPtr>
NFAStructure<TinPtr, ToutPtr, TdepPtr>::NFAStructure(typename NFAController<TinPtr, ToutPtr, TdepPtr>::NFAControllerPtr nfa) :
refCount(0), kleeneState(nfa->getKleeneStatesCount()) {
this->nfa = nfa;
......@@ -242,10 +240,10 @@ NFAStructure<Tin, Tout, Tdep>::NFAStructure(typename NFAController<Tin, Tout, Td
relatedValues = this->nfa->init();
}
template<class Tin, class Tout, class Tdep>
void NFAStructure<Tin, Tout, Tdep>::addEvent(const TinPtr& event,
NFAEdge<Tin, Tout, Tdep>* currentEdge) {
typename Instance<Tin, Tout>::InstancePtr inst(new Instance<Tin, Tout>(event));
template<class TinPtr, class ToutPtr, class TdepPtr>
void NFAStructure<TinPtr, ToutPtr, TdepPtr>::addEvent(const TinPtr& event,
NFAEdge<TinPtr, ToutPtr, TdepPtr>* currentEdge) {
typename Instance<TinPtr, ToutPtr>::InstancePtr inst(new Instance<TinPtr, ToutPtr>(event));
this->events.push_back(inst);
......@@ -254,37 +252,37 @@ void NFAStructure<Tin, Tout, Tdep>::addEvent(const TinPtr& event,
this->nfa->update( relatedValues, currentEdge->getID(), event);
if (currentEdge->getEdgeType() == NFAEdge<Tin, Tout, Tdep>::Forward) {
if (currentEdge->getEdgeType() == NFAEdge<TinPtr, ToutPtr, TdepPtr>::Forward) {
this->currentState =
((ForwardEdge<Tin, Tout, Tdep>*) (currentEdge))->getDestState();