00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #define ACEDIA_REDUCED_ANNOUNCE
00031
00032 #include "rulebuilder.hpp"
00033
00034 namespace acedia
00035 {
00036 namespace details
00037 {
00038
00039 IGuardFunctor::~IGuardFunctor() { }
00040
00041 AnyArrayProcessor::AnyArrayProcessor() : next(NULL) { }
00042
00043 AnyArrayProcessor::~AnyArrayProcessor() { if(next) delete next; }
00044
00045 void AnyArrayProcessor::passThrough(AnyArrayProcessor *nextProcessor)
00046 {
00047 if (next)
00048 {
00049 next->passThrough(nextProcessor);
00050 }
00051 else
00052 {
00053 next = nextProcessor;
00054 }
00055 }
00056
00057 void AnyArrayProcessor::setNext(AnyArrayProcessor *nextProcessor)
00058 {
00059 if (next) delete next;
00060 next = nextProcessor;
00061 }
00062
00063 }
00064
00065 RuleBuilderBase::RuleBuilderBase(details::AnyArrayProcessor *processor)
00066 : proc(processor) { }
00067
00068 details::AnyArrayProcessor* RuleBuilderBase::operator>>(void (*voidFunction)())
00069 {
00070 return passThroughAndClear(new details::InvokeFunctor<0,0>(boost::function0<void>(voidFunction)));
00071 }
00072
00073 details::AnyArrayProcessor *RuleBuilderBase::passThroughAndClear(details::AnyArrayProcessor *nProc)
00074 {
00075 if (proc)
00076 {
00077 details::AnyArrayProcessor *res = proc;
00078 proc = NULL;
00079 res->passThrough(nProc);
00080 return res;
00081 }
00082
00083 delete nProc;
00084 return NULL;
00085 }
00086
00087 }