diff --git a/include/core/state_block/has_state_blocks.h b/include/core/state_block/has_state_blocks.h index d8238da0bb059aa49c68765338c9f62752a6d15a..1e965ce8fa87c785c5a1684fad1cf7522e2abc52 100644 --- a/include/core/state_block/has_state_blocks.h +++ b/include/core/state_block/has_state_blocks.h @@ -16,6 +16,8 @@ namespace wolf { +typedef std::unordered_map<std::string, StateBlockPtr> StateBlockMap; + class HasStateBlocks { @@ -28,7 +30,7 @@ class HasStateBlocks void appendToStructure(const std::string& _frame_type){ structure_ += _frame_type; } bool isInStructure(const std::string& _sb_type) { return structure_.find(_sb_type) != std::string::npos; } - const std::unordered_map<std::string, StateBlockPtr>& getStateBlockMap() const; + const StateBlockMap& getStateBlockMap() const; std::vector<StateBlockPtr> getStateBlockVec() const; // Some typical shortcuts -- not all should be coded here, see notes below. @@ -52,7 +54,7 @@ class HasStateBlocks bool setStateBlock(const std::string _sb_type, const StateBlockPtr& _sb); bool setStateBlock(const char _sb_type, const StateBlockPtr& _sb) { return setStateBlock(std::string(1, _sb_type), _sb); } bool stateBlockKey(const StateBlockPtr& _sb, std::string& _key) const; - std::unordered_map<std::string, StateBlockPtr>::const_iterator find(const StateBlockPtr& _sb) const; + StateBlockMap::const_iterator find(const StateBlockPtr& _sb) const; // Emplace derived state blocks (angle, quaternion, etc). template<typename SB, typename ... Args> @@ -85,8 +87,8 @@ class HasStateBlocks private: - StateStructure structure_; // TBR - std::unordered_map<std::string, StateBlockPtr> state_block_map_; + StateStructure structure_; // TBR + StateBlockMap state_block_map_; }; @@ -111,7 +113,7 @@ inline HasStateBlocks::~HasStateBlocks() // } -inline const std::unordered_map<std::string, StateBlockPtr>& HasStateBlocks::getStateBlockMap() const +inline const StateBlockMap& HasStateBlocks::getStateBlockMap() const { return state_block_map_; } @@ -266,7 +268,7 @@ inline Eigen::VectorXd HasStateBlocks::getState(const StateStructure& _sub_struc return state; } -inline std::unordered_map<std::string, StateBlockPtr>::const_iterator HasStateBlocks::find(const StateBlockPtr& _sb) const +inline StateBlockMap::const_iterator HasStateBlocks::find(const StateBlockPtr& _sb) const { const auto& it = std::find_if(state_block_map_.begin(), state_block_map_.end(),