INET Framework for OMNeT++/OMNEST
inet::ieee80211::RepeatingFs Class Reference

#include <GenericFrameSequences.h>

Inheritance diagram for inet::ieee80211::RepeatingFs:
inet::ieee80211::IFrameSequence

Public Member Functions

virtual ~RepeatingFs ()
 
 RepeatingFs (IFrameSequence *element, std::function< bool(RepeatingFs *, FrameSequenceContext *)> predicate=nullptr)
 
virtual int getCount ()
 
virtual int getStep ()
 
virtual bool isSequenceApply (FrameSequenceContext *context)
 
virtual void startSequence (FrameSequenceContext *context, int firstStep) override
 
virtual void repeatSequence (FrameSequenceContext *context)
 
virtual IFrameSequenceStepprepareStep (FrameSequenceContext *context) override
 
virtual bool completeStep (FrameSequenceContext *context) override
 
virtual std::string getHistory () override
 
- Public Member Functions inherited from inet::ieee80211::IFrameSequence
virtual ~IFrameSequence ()
 

Protected Attributes

int count = 0
 
int firstStep = -1
 
int step = -1
 
bool apply = false
 
IFrameSequenceelement
 
std::function< bool(RepeatingFs *, FrameSequenceContext *)> predicate
 
std::vector< std::string > histories
 

Constructor & Destructor Documentation

virtual inet::ieee80211::RepeatingFs::~RepeatingFs ( )
inlinevirtual
85 { delete element; }
IFrameSequence * element
Definition: GenericFrameSequences.h:80
inet::ieee80211::RepeatingFs::RepeatingFs ( IFrameSequence element,
std::function< bool(RepeatingFs *, FrameSequenceContext *)>  predicate = nullptr 
)
109  :
110  element(element),
112 {
113 }
std::function< bool(RepeatingFs *, FrameSequenceContext *)> predicate
Definition: GenericFrameSequences.h:81
IFrameSequence * element
Definition: GenericFrameSequences.h:80

Member Function Documentation

bool inet::ieee80211::RepeatingFs::completeStep ( FrameSequenceContext context)
overridevirtual

Implements inet::ieee80211::IFrameSequence.

153 {
154  ASSERT(apply);
155  step++;
156  bool complete = element->completeStep(context);
157  histories.at(count - 1) = element->getHistory();
158  return complete;
159 }
int count
Definition: GenericFrameSequences.h:76
virtual std::string getHistory()=0
virtual bool completeStep(FrameSequenceContext *context)=0
IFrameSequence * element
Definition: GenericFrameSequences.h:80
int step
Definition: GenericFrameSequences.h:78
std::vector< std::string > histories
Definition: GenericFrameSequences.h:82
bool apply
Definition: GenericFrameSequences.h:79
virtual int inet::ieee80211::RepeatingFs::getCount ( )
inlinevirtual

Referenced by inet::ieee80211::HcfFs::hasMoreTxOps().

88 { return count; }
int count
Definition: GenericFrameSequences.h:76
std::string inet::ieee80211::RepeatingFs::getHistory ( )
overridevirtual

Implements inet::ieee80211::IFrameSequence.

162 {
163  ASSERT(step != -1);
164  std::string repeatHistory = "{" + histories.at(0);
165  for (int i = 1; i < (int) histories.size(); i++)
166  repeatHistory += " " + histories.at(i);
167  return repeatHistory + "}";
168 }
int step
Definition: GenericFrameSequences.h:78
std::vector< std::string > histories
Definition: GenericFrameSequences.h:82
virtual int inet::ieee80211::RepeatingFs::getStep ( )
inlinevirtual
89 { return firstStep + step; }
int firstStep
Definition: GenericFrameSequences.h:77
int step
Definition: GenericFrameSequences.h:78
virtual bool inet::ieee80211::RepeatingFs::isSequenceApply ( FrameSequenceContext context)
inlinevirtual

Referenced by repeatSequence(), and startSequence().

90 { return predicate(this, context); }
std::function< bool(RepeatingFs *, FrameSequenceContext *)> predicate
Definition: GenericFrameSequences.h:81
IFrameSequenceStep * inet::ieee80211::RepeatingFs::prepareStep ( FrameSequenceContext context)
overridevirtual

Implements inet::ieee80211::IFrameSequence.

138 {
139  if (apply) {
140  auto elementStep = element->prepareStep(context);
141  if (elementStep != nullptr)
142  return elementStep;
143  else {
144  repeatSequence(context);
145  return prepareStep(context);
146  }
147  }
148  else
149  return nullptr;
150 }
virtual IFrameSequenceStep * prepareStep(FrameSequenceContext *context)=0
virtual void repeatSequence(FrameSequenceContext *context)
Definition: GenericFrameSequences.cc:127
virtual IFrameSequenceStep * prepareStep(FrameSequenceContext *context) override
Definition: GenericFrameSequences.cc:137
IFrameSequence * element
Definition: GenericFrameSequences.h:80
bool apply
Definition: GenericFrameSequences.h:79
void inet::ieee80211::RepeatingFs::repeatSequence ( FrameSequenceContext context)
virtual

Referenced by prepareStep().

128 {
129  apply = isSequenceApply(context);
130  if (apply) {
131  count++;
132  element->startSequence(context, firstStep + step);
133  histories.push_back(element->getHistory());
134  }
135 }
virtual bool isSequenceApply(FrameSequenceContext *context)
Definition: GenericFrameSequences.h:90
int count
Definition: GenericFrameSequences.h:76
virtual std::string getHistory()=0
int firstStep
Definition: GenericFrameSequences.h:77
IFrameSequence * element
Definition: GenericFrameSequences.h:80
virtual void startSequence(FrameSequenceContext *context, int step)=0
int step
Definition: GenericFrameSequences.h:78
std::vector< std::string > histories
Definition: GenericFrameSequences.h:82
bool apply
Definition: GenericFrameSequences.h:79
void inet::ieee80211::RepeatingFs::startSequence ( FrameSequenceContext context,
int  firstStep 
)
overridevirtual

Implements inet::ieee80211::IFrameSequence.

116 {
117  this->firstStep = firstStep;
118  step = 0;
119  apply = isSequenceApply(context);
120  if (apply) {
121  count = 1;
122  element->startSequence(context, firstStep);
123  histories.push_back(element->getHistory());
124  }
125 }
virtual bool isSequenceApply(FrameSequenceContext *context)
Definition: GenericFrameSequences.h:90
int count
Definition: GenericFrameSequences.h:76
virtual std::string getHistory()=0
int firstStep
Definition: GenericFrameSequences.h:77
IFrameSequence * element
Definition: GenericFrameSequences.h:80
virtual void startSequence(FrameSequenceContext *context, int step)=0
int step
Definition: GenericFrameSequences.h:78
std::vector< std::string > histories
Definition: GenericFrameSequences.h:82
bool apply
Definition: GenericFrameSequences.h:79

Member Data Documentation

bool inet::ieee80211::RepeatingFs::apply = false
protected
int inet::ieee80211::RepeatingFs::count = 0
protected
IFrameSequence* inet::ieee80211::RepeatingFs::element
protected
int inet::ieee80211::RepeatingFs::firstStep = -1
protected

Referenced by repeatSequence(), and startSequence().

std::vector<std::string> inet::ieee80211::RepeatingFs::histories
protected
std::function<bool (RepeatingFs *, FrameSequenceContext *)> inet::ieee80211::RepeatingFs::predicate
protected
int inet::ieee80211::RepeatingFs::step = -1
protected

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