|
reSIProcate/DialogUsageManager
9694
|
#include <DumFeatureChain.hxx>

Public Types | |
| enum | ProcessingResultMask { EventTakenBit = 1 << 0, ChainDoneBit = 1 << 1 } |
| enum | ProcessingResult { EventTaken = EventTakenBit, ChainDone = ChainDoneBit, ChainDoneAndEventTaken = ChainDoneBit | EventTakenBit } |
| typedef std::vector< SharedPtr < DumFeature > > | FeatureList |
Public Member Functions | |
| DumFeatureChain (DialogUsageManager &dum, const FeatureList &features, TargetCommand::Target &target) | |
| ProcessingResult | process (Message *msg) |
Private Attributes | |
| std::vector< bool > | mActiveFeatures |
| FeatureList | mFeatures |
Definition at line 12 of file DumFeatureChain.hxx.
| typedef std::vector<SharedPtr<DumFeature> > resip::DumFeatureChain::FeatureList |
Definition at line 15 of file DumFeatureChain.hxx.
Definition at line 24 of file DumFeatureChain.hxx.
{
EventTaken = EventTakenBit, //don't delete event
ChainDone = ChainDoneBit, //event not consumed by chain
ChainDoneAndEventTaken = ChainDoneBit | EventTakenBit
};
Definition at line 17 of file DumFeatureChain.hxx.
{
EventTakenBit = 1 << 0, //don't pass on, don't delete event
ChainDoneBit = 1 << 1 //if true chain can be deleted
};
| DumFeatureChain::DumFeatureChain | ( | DialogUsageManager & | dum, |
| const FeatureList & | features, | ||
| TargetCommand::Target & | target | ||
| ) |
Definition at line 26 of file DumFeatureChain.cxx.
References mActiveFeatures, and mFeatures.
:mFeatures(features) { mFeatures.push_back(SharedPtr<DumFeature>(new GuardFeature(dum, target))); for (FeatureList::size_type i = 0; i < mFeatures.size(); ++i) { mActiveFeatures.push_back(true); } }
| DumFeatureChain::ProcessingResult DumFeatureChain::process | ( | Message * | msg | ) |
Definition at line 38 of file DumFeatureChain.cxx.
References bits(), resip::DumFeature::ChainDoneAndEventDone, resip::DumFeature::ChainDoneAndEventTaken, ChainDoneBit, resip::DumFeature::ChainDoneBit, resip::DumFeature::EventDoneBit, EventTaken, resip::DumFeature::EventTaken, EventTakenBit, resip::DumFeature::EventTakenBit, resip::DumFeature::FeatureDone, resip::DumFeature::FeatureDoneAndEventDone, resip::DumFeature::FeatureDoneAndEventTaken, mActiveFeatures, and mFeatures.
{
FeatureList::iterator feat = mFeatures.begin();
vector<bool>::iterator active = mActiveFeatures.begin();
bool stop = false;
DumFeature::ProcessingResult pres = DumFeature::FeatureDone;
do
{
if (*active)
{
pres = (*feat)->process(msg);
switch(pres)
{
case DumFeature::EventTaken:
stop = true;
break;
case DumFeature::FeatureDone:
*active = false;
break;
case DumFeature::FeatureDoneAndEventDone:
case DumFeature::FeatureDoneAndEventTaken: //??
case DumFeature::ChainDoneAndEventTaken:
case DumFeature::ChainDoneAndEventDone:
*active = false;
stop = true;
break;
}
if (pres & DumFeature::EventDoneBit)
{
delete msg;
int bits = pres;
bits ^= DumFeature::EventDoneBit;
bits |= DumFeature::EventTaken;
pres = static_cast<DumFeature::ProcessingResult>(bits);
}
}
active++;
feat++;
}
while(!stop && feat != mFeatures.end());
int chainBits = 0;
if (pres & DumFeature::ChainDoneBit || feat == mFeatures.end())
{
chainBits |= ChainDoneBit;
}
if (pres & DumFeature::EventTakenBit)
{
chainBits |= EventTakenBit;
}
return static_cast<DumFeatureChain::ProcessingResult>(chainBits);
}

std::vector<bool> resip::DumFeatureChain::mActiveFeatures [private] |
Definition at line 37 of file DumFeatureChain.hxx.
Referenced by DumFeatureChain(), and process().
FeatureList resip::DumFeatureChain::mFeatures [private] |
Definition at line 38 of file DumFeatureChain.hxx.
Referenced by DumFeatureChain(), and process().
1.7.5.1