diff --git a/src/SystemContainer.hpp b/src/SystemContainer.hh similarity index 89% rename from src/SystemContainer.hpp rename to src/SystemContainer.hh index 6027b05926..45ed26d231 100644 --- a/src/SystemContainer.hpp +++ b/src/SystemContainer.hh @@ -22,10 +22,13 @@ #include #include +#include "gz/sim/config.hh" + namespace gz { namespace sim { + inline namespace GZ_SIM_VERSION_NAMESPACE { ////////////////////////////////////////////////// /// This container implements a simple masked vector. /// Using a masked vector for systems ensures that @@ -103,7 +106,7 @@ namespace gz private: std::vector freeSpots; ////////////////////////////////////////// - class iterator { + class Iterator { std::size_t num; SystemContainer* parent; public: @@ -112,12 +115,12 @@ namespace gz using difference_type = long; using pointer = T*; using reference = T&; - explicit iterator(SystemContainer* _parent, std::size_t _num = 0) : + explicit Iterator(SystemContainer* _parent, std::size_t _num = 0) : num(_num), parent(_parent) { } - iterator& operator++() { + Iterator& operator++() { auto end = parent->end(); // O(n) for now do { @@ -126,36 +129,37 @@ namespace gz return *this; } - bool operator==(iterator other) const { return num == other.num; } - bool operator!=(iterator other) const { return !(*this == other); } + bool operator==(Iterator other) const { return num == other.num; } + bool operator!=(Iterator other) const { return !(*this == other); } T& operator*() const { return parent->systems[num]; } }; ////////////////////////////////////////// - public: iterator begin() + public: Iterator begin() { - return iterator(this); + return Iterator(this); } ////////////////////////////////////////// - public: iterator end() + public: Iterator end() { auto lastIdx = this->occupied.size(); if (lastIdx == 0) { - return iterator(this); + return Iterator(this); } while(!this->occupied[lastIdx-1] && lastIdx != 0) { lastIdx--; } - return iterator(this, lastIdx); + return Iterator(this, lastIdx); } }; + } } } diff --git a/src/SystemContainer_TEST.cc b/src/SystemContainer_TEST.cc index c002913de3..857b29af26 100644 --- a/src/SystemContainer_TEST.cc +++ b/src/SystemContainer_TEST.cc @@ -16,7 +16,7 @@ */ #include #include -#include "SystemContainer.hpp" +#include "SystemContainer.hh" using namespace gz::sim; diff --git a/src/SystemManager.cc b/src/SystemManager.cc index b9f7c518b1..86628965f5 100644 --- a/src/SystemManager.cc +++ b/src/SystemManager.cc @@ -22,7 +22,7 @@ #include -#include "SystemContainer.hpp" +#include "SystemContainer.hh" #include "SystemInternal.hh" #include "gz/sim/components/SystemPluginInfo.hh" #include "gz/sim/Conversions.hh" diff --git a/src/SystemManager.hh b/src/SystemManager.hh index 4b1ff39717..430a9f2fb3 100644 --- a/src/SystemManager.hh +++ b/src/SystemManager.hh @@ -34,7 +34,7 @@ #include "gz/sim/SystemLoader.hh" #include "gz/sim/Types.hh" -#include "SystemContainer.hpp" +#include "SystemContainer.hh" #include "SystemInternal.hh" namespace gz