|
opensurgsim
|
Class to wrap grouping operations, gives access to the members of a group and the groups of members. More...
#include <Groups.h>
Public Types | |
| typedef Key | IdentifierType |
| typedef T | MemberType |
Public Member Functions | |
| bool | add (const Key &group, const T &element) |
| Add an element to the given group, if the group doesn't exist it will be created, if the element is already a member of the group, nothing happens. More... | |
| bool | add (const std::vector< Key > &groups, const T &element) |
| Add a member to the given groups, if any of the groups don't exist they will be created, if the element is already a member of a group, it won't be added to that specific group. More... | |
| bool | add (const Groups< Key, T > &other) |
| Add all the members from the other group to this group, essentially forming a union of the two. More... | |
| bool | remove (const Key &group, const T &element) |
| Remove an element from a given group, if the group does not exist or the element is not a member of that group, nothing will happen. More... | |
| bool | remove (const T &element) |
| Remove an element from all known groups, if the element is not a member of any group, nothing happens. More... | |
| std::vector< T > | getMembers (const Key &group) const |
| Return all the members of the given group. More... | |
| std::vector< Key > | getGroups (const T &element) const |
| Return all the groups that the given member is a member of. More... | |
| std::vector< Key > | getGroups () const |
| std::vector< T > | operator[] (const Key &group) const |
| Return all the members of the given group. More... | |
| void | clear () |
| Erases all entries. | |
Class to wrap grouping operations, gives access to the members of a group and the groups of members.
Groups is threadsafe with regard to add and remove operations, and observations
| Key | the label to be used for the groups |
| T | the type of the group members |
| bool SurgSim::DataStructures::Groups< Key, T >::add | ( | const Key & | group, |
| const T & | element | ||
| ) |
Add an element to the given group, if the group doesn't exist it will be created, if the element is already a member of the group, nothing happens.
| group | the group to use |
| element | the element to add |
| bool SurgSim::DataStructures::Groups< Key, T >::add | ( | const std::vector< Key > & | groups, |
| const T & | element | ||
| ) |
Add a member to the given groups, if any of the groups don't exist they will be created, if the element is already a member of a group, it won't be added to that specific group.
| groups | the groups to use |
| element | the element to add |
| bool SurgSim::DataStructures::Groups< Key, T >::add | ( | const Groups< Key, T > & | other | ) |
Add all the members from the other group to this group, essentially forming a union of the two.
| other | object to add groups from |
| std::vector< Key > SurgSim::DataStructures::Groups< Key, T >::getGroups | ( | const T & | element | ) | const |
Return all the groups that the given member is a member of.
| element | the element to query |
| std::vector< Key > SurgSim::DataStructures::Groups< Key, T >::getGroups | ( | ) | const |
| std::vector< T > SurgSim::DataStructures::Groups< Key, T >::getMembers | ( | const Key & | group | ) | const |
Return all the members of the given group.
| group | the group to query |
| std::vector< T > SurgSim::DataStructures::Groups< Key, T >::operator[] | ( | const Key & | group | ) | const |
Return all the members of the given group.
| group | group to query |
| bool SurgSim::DataStructures::Groups< Key, T >::remove | ( | const Key & | group, |
| const T & | element | ||
| ) |
Remove an element from a given group, if the group does not exist or the element is not a member of that group, nothing will happen.
| group | the group to use |
| element | the element to remove |
| bool SurgSim::DataStructures::Groups< Key, T >::remove | ( | const T & | element | ) |
Remove an element from all known groups, if the element is not a member of any group, nothing happens.
| element | the element to remove |
1.8.12