Skip to content
Snippets Groups Projects
Commit 5f1b7aa3 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

new typedef StateBlockMap

parent 38b69508
No related branches found
No related tags found
2 merge requests!358WIP: Resolve "Complete state vector new data structure?",!343WIP: Resolve "Complete state vector new data structure?"
......@@ -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(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment