reSIProcate/DialogUsageManager  9694
Public Types | Public Member Functions | Private Attributes
resip::DumFeatureChain Class Reference

#include <DumFeatureChain.hxx>

Collaboration diagram for resip::DumFeatureChain:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 12 of file DumFeatureChain.hxx.


Member Typedef Documentation

Definition at line 15 of file DumFeatureChain.hxx.


Member Enumeration Documentation

Enumerator:
EventTaken 
ChainDone 
ChainDoneAndEventTaken 

Definition at line 24 of file DumFeatureChain.hxx.

      {
         EventTaken = EventTakenBit, //don't delete event
         ChainDone = ChainDoneBit,  //event not consumed by chain
         ChainDoneAndEventTaken = ChainDoneBit | EventTakenBit
      };
Enumerator:
EventTakenBit 
ChainDoneBit 

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
      };                              

Constructor & Destructor Documentation

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);
   }
}

Member Function Documentation

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);
}

Here is the call graph for this function:


Member Data Documentation

std::vector<bool> resip::DumFeatureChain::mActiveFeatures [private]

Definition at line 37 of file DumFeatureChain.hxx.

Referenced by DumFeatureChain(), and process().

Definition at line 38 of file DumFeatureChain.hxx.

Referenced by DumFeatureChain(), and process().


The documentation for this class was generated from the following files: