5 #ifndef CNOID_BODY_LINK_GROUP_H_INCLUDED
6 #define CNOID_BODY_LINK_GROUP_H_INCLUDED
8 #include <boost/variant.hpp>
9 #include <cnoid/Referenced>
18 typedef boost::intrusive_ptr<Body>
BodyPtr;
25 typedef boost::variant<LinkGroupPtr, int> Element;
29 static LinkGroupPtr create(BodyPtr body,
const YamlSequence& linkGroupSeq);
34 inline void setName(
const std::string& name) { name_ = name; }
35 inline const std::string&
name() {
return name_; }
38 inline bool isSubGroup(
int index) {
return elements[index].which() == 0; }
39 inline bool isLinkIndex(
int index) {
return elements[index].which() == 1; }
40 inline LinkGroupPtr
subGroup(
int index) {
return boost::get<LinkGroupPtr>(elements[index]); }
41 inline int linkIndex(
int index) {
return boost::get<int>(elements[index]); }
43 std::vector<int> collectLinkIndices()
const;
44 std::vector<LinkGroupPtr> collectGroups()
const;
49 std::vector<Element> elements;
51 bool load(BodyPtr& body,
const YamlSequence& linkGroupseq);
52 void setFlatLinkList(BodyPtr& body);
boost::intrusive_ptr< Body > BodyPtr
Definition: Body.h:22
bool isLinkIndex(int index)
Definition: LinkGroup.h:39
bool isSubGroup(int index)
Definition: LinkGroup.h:38
Definition: LinkGroup.h:23
void setName(const std::string &name)
Definition: LinkGroup.h:34
Definition: YamlNodes.h:386
Definition: Referenced.h:21
boost::intrusive_ptr< LinkGroup > LinkGroupPtr
Definition: LinkGroup.h:20
int numElements()
Definition: LinkGroup.h:37
const std::string & name()
Definition: LinkGroup.h:35
Definition: EasyScanner.h:16
int linkIndex(int index)
Definition: LinkGroup.h:41
LinkGroupPtr subGroup(int index)
Definition: LinkGroup.h:40
#define CNOID_EXPORT
Definition: Util/exportdecl.h:13