33 #ifndef DART_COLLISION_DETAIL_UNORDEREDPAIRS_HPP_ 34 #define DART_COLLISION_DETAIL_UNORDEREDPAIRS_HPP_ 36 #include <unordered_map> 37 #include <unordered_set> 48 void addPair(
const T* left,
const T* right);
51 void removePair(
const T* left,
const T* right);
57 bool contains(
const T* left,
const T* right)
const;
65 std::unordered_map<const T*, std::unordered_set<const T*>> mList;
75 const auto* less = left;
76 const auto* greater = right;
79 std::swap(less, greater);
85 = mList.insert(std::make_pair(less, std::unordered_set<const T*>()))
90 itLess->second.insert(greater);
100 const auto* bodyNodeLess = left;
101 const auto* bodyNodeGreater = right;
103 if (bodyNodeLess > bodyNodeGreater)
104 std::swap(bodyNodeLess, bodyNodeGreater);
107 const auto resultLeft = mList.find(bodyNodeLess);
108 const bool foundLeft = (resultLeft != mList.end());
111 auto& associatedRights = resultLeft->second;
112 associatedRights.erase(bodyNodeGreater);
114 if (associatedRights.empty())
115 mList.erase(resultLeft);
130 const auto* less = left;
131 const auto* greater = right;
134 std::swap(less, greater);
136 const auto resultLeft = mList.find(less);
137 const bool foundLeft = (resultLeft != mList.end());
140 auto& associatedRights = resultLeft->second;
142 const auto resultRight = associatedRights.find(greater);
143 const bool foundRight = (resultRight != associatedRights.end());
155 #endif // DART_COLLISION_DETAIL_UNORDEREDPAIRS_HPP_ bool contains(const T *left, const T *right) const
Returns true if this container contains the pair.
Definition: UnorderedPairs.hpp:128
Definition: UnorderedPairs.hpp:44
Definition: Aspect.cpp:40
void removePair(const T *left, const T *right)
Removes a pair from this container.
Definition: UnorderedPairs.hpp:95
void removeAllPairs()
Removes all the pairs from this container.
Definition: UnorderedPairs.hpp:121
void addPair(const T *left, const T *right)
Adds a pair to this container.
Definition: UnorderedPairs.hpp:70