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

Fix bug in structure.find()

parent b4d7cb66
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?"
Pipeline #5114 passed
...@@ -25,7 +25,7 @@ class HasStateBlocks ...@@ -25,7 +25,7 @@ class HasStateBlocks
const StateStructure& getStructure() const { return structure_; } const StateStructure& getStructure() const { return structure_; }
void appendToStructure(const std::string& _frame_type){ structure_ += _frame_type; } void appendToStructure(const std::string& _frame_type){ structure_ += _frame_type; }
bool isInStructure(const std::string& _sb_type) { return structure_.find(_sb_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 std::unordered_map<std::string, StateBlockPtr>& getStateBlockMap() const;
std::vector<StateBlockPtr> getStateBlockVec() const; std::vector<StateBlockPtr> getStateBlockVec() const;
...@@ -156,7 +156,7 @@ inline StateBlockPtr HasStateBlocks::emplaceStateBlock(const std::string& _sb_ty ...@@ -156,7 +156,7 @@ inline StateBlockPtr HasStateBlocks::emplaceStateBlock(const std::string& _sb_ty
inline bool HasStateBlocks::setStateBlock(const std::string _sb_type, const StateBlockPtr& _sb) inline bool HasStateBlocks::setStateBlock(const std::string _sb_type, const StateBlockPtr& _sb)
{ {
assert (structure_.find(_sb_type) && "Cannot set a state block out of the state structure! Use addStateBlock instead."); assert (structure_.find(_sb_type) != std::string::npos && "Cannot set a state block out of the state structure! Use addStateBlock instead.");
assert ( state_block_map_.count(_sb_type) > 0 && "Cannot set an inexistent state block! Use addStateBlock instead."); assert ( state_block_map_.count(_sb_type) > 0 && "Cannot set an inexistent state block! Use addStateBlock instead.");
state_block_map_.at(_sb_type) = _sb; state_block_map_.at(_sb_type) = _sb;
return true; // success return true; // success
......
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