EtherCATFrame.cpp
Go to the documentation of this file.
1 #include "EtherCATFrame.h"
2 
4 {
6  size_t startIndex,
7  size_t count) :
8  list(list), nextIndex(startIndex), remaining(count)
9  {
10  }
11 
12  std::pair<EtherCATFrame*, EtherCATFrameMetaData*>
14  {
15  return {&list->list[nextIndex].first, &list->list[nextIndex].second};
16  }
17 
18  bool
20  {
21  return nextIndex == 0;
22  }
23 
26  {
27  if (remaining > 0)
28  {
29  nextIndex = (nextIndex + 1) % list->list.size();
30  --remaining;
31  }
32  return *this;
33  }
34 
35  bool
37  {
38  return remaining == 0;
39  }
40 
41  size_t
43  {
44  if (not hasCompletedLoop())
45  {
46  return nextIndex - 1;
47  }
48  return 0;
49  }
50 } // namespace armarx::control::ethercat
EtherCATFrame.h
list
list(APPEND SOURCES ${QT_RESOURCES}) set(COMPONENT_LIBS ArmarXGui ArmarXCoreObservers ArmarXCoreEigen3Variants PlotterController $
Definition: CMakeLists.txt:49
armarx::control::ethercat::EtherCATFrameList::list
std::vector< std::pair< EtherCATFrame, EtherCATFrameMetaData > > list
Definition: EtherCATFrame.h:127
armarx::control::ethercat::EtherCATFrameIterator::operator*
std::pair< EtherCATFrame *, EtherCATFrameMetaData * > operator*() const
Get the EtherCAT frame this iterator is on with metadata.
Definition: EtherCATFrame.cpp:13
armarx::control::ethercat::EtherCATFrameIterator
The EtherCATFrameIterator class iterates over a set range of EtherCAT frames once.
Definition: EtherCATFrame.h:134
armarx::control::ethercat::EtherCATFrameIterator::EtherCATFrameIterator
EtherCATFrameIterator(EtherCATFrameList *list, size_t startIndex, size_t count)
Construct a new EtherCATFrameIterator that iterates over the given range of EtherCAT frames.
Definition: EtherCATFrame.cpp:5
armarx::control::ethercat::EtherCATFrameList
The EtherCATFrameList struct holds a list of EtherCAT frames that can be scheduled in round-robin-sty...
Definition: EtherCATFrame.h:124
armarx::control::ethercat
Definition: Bus.cpp:24
armarx::control::ethercat::EtherCATFrameIterator::operator++
EtherCATFrameIterator & operator++()
Move this iterator to the next EtherCAT frame.
Definition: EtherCATFrame.cpp:25
armarx::control::ethercat::EtherCATFrameIterator::atEnd
bool atEnd() const
Check if this iterator has stepped over its range.
Definition: EtherCATFrame.cpp:36
armarx::control::ethercat::EtherCATFrameIterator::hasCompletedLoop
bool hasCompletedLoop() const
Check if this iterator points to the first available register frame.
Definition: EtherCATFrame.cpp:19
remaining
size_t remaining
Definition: ReadMe.txt:93
armarx::control::ethercat::EtherCATFrameIterator::getCurrentIndex
size_t getCurrentIndex() const
Definition: EtherCATFrame.cpp:42