Debian Codegraph @

.deprecated/articulated_model/link.h

raw
1 /*
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2011-2014, Willow Garage, Inc.
5 * Copyright (c) 2014-2016, Open Source Robotics Foundation
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * Neither the name of Open Source Robotics Foundation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36 /** \author Dalibor Matura, Jia Pan */
37
38 #ifndef FCL_ARTICULATED_MODEL_LINK_H
39 #define FCL_ARTICULATED_MODEL_LINK_H
40
41 #include "fcl/common/data_types.h"
42 #include "fcl/object/collision_object.h"
43
44 #include <memory>
45 #include <vector>
46
47 namespace fcl
48 {
49
50 template <typename S>
51 class Joint;
52
53 template <typename S>
54 class Link
55 {
56 public:
57 Link(const std::string& name);
58
59 const std::string& getName() const;
60
61 void setName(const std::string& name);
62
63 void addChildJoint(const std::shared_ptr<Joint>& joint);
64
65 void setParentJoint(const std::shared_ptr<Joint>& joint);
66
67 void addObject(const std::shared_ptr<CollisionObject<S>>& object);
68
69 std::size_t getNumChildJoints() const;
70
71 std::size_t getNumObjects() const;
72
73 protected:
74 std::string name_;
75
76 std::vector<std::shared_ptr<CollisionObject<S>> > objects_;
77
78 std::vector<std::shared_ptr<Joint> > children_joints_;
79
80 std::shared_ptr<Joint> parent_joint_;
81 };
82
83 //============================================================================//
84 // //
85 // Implementations //
86 // //
87 //============================================================================//
88
89 //==============================================================================
90 template <typename S>
91 Link<S>::Link(const std::string& name) : name_(name)
92 {}
93
94 //==============================================================================
95 template <typename S>
96 const std::string& Link<S>::getName() const
97 {
98 return name_;
99 }
100
101 //==============================================================================
102 template <typename S>
103 void Link<S>::setName(const std::string& name)
104 {
105 name_ = name;
106 }
107
108 //==============================================================================
109 template <typename S>
110 void Link<S>::addChildJoint(const std::shared_ptr<Joint>& joint)
111 {
112 children_joints_.push_back(joint);
113 }
114
115 //==============================================================================
116 template <typename S>
117 void Link<S>::setParentJoint(const std::shared_ptr<Joint>& joint)
118 {
119 parent_joint_ = joint;
120 }
121
122 //==============================================================================
123 template <typename S>
124 void Link<S>::addObject(const std::shared_ptr<CollisionObject<S>>& object)
125 {
126 objects_.push_back(object);
127 }
128
129 //==============================================================================
130 template <typename S>
131 std::size_t Link<S>::getNumChildJoints() const
132 {
133 return children_joints_.size();
134 }
135
136 //==============================================================================
137 template <typename S>
138 std::size_t Link<S>::getNumObjects() const
139 {
140 return objects_.size();
141 }
142
143 } // namespace fcl
144
145 #endif