This file is indexed.

/usr/include/choreonoid-1.1/cnoid/src/Body/Body.h is in libcnoid-dev 1.1.0+dfsg-6.1+b4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/**
   \file
   \author Shin'ichiro Nakaoka
*/

#ifndef CNOID_BODY_BODY_H_INCLUDED
#define CNOID_BODY_BODY_H_INCLUDED

#include "LinkTraverse.h"
#include "LinkGroup.h"
#include <cnoid/YamlNodes>
#include <cnoid/Referenced>
#include <cnoid/EigenTypes>
#include <boost/shared_ptr.hpp>
#include <map>
#include "exportdecl.h"

namespace cnoid {

    class Sensor;

    class Body;
    typedef boost::intrusive_ptr<Body> BodyPtr;

    class JointPath;
    typedef boost::shared_ptr<JointPath> JointPathPtr;

    class InverseKinematics;
    typedef boost::shared_ptr<InverseKinematics> InverseKinematicsPtr;

    class LinkGroup;

    class YamlMapping;
    typedef boost::intrusive_ptr<YamlMapping> YamlMappingPtr;

    struct BodyHandleEntity {
        Body* body;
    };

    struct BodyInterface;
    struct BodyCustomizerInterface;
    typedef void* BodyHandle;
    typedef void* BodyCustomizerHandle;

    class CNOID_EXPORT Body : public Referenced
    {
      public:

        static void addCustomizerDirectory(const std::string& path);

        static BodyInterface* bodyInterface();

        Body();
        virtual ~Body();

        virtual BodyPtr duplicate() const;

        inline const std::string& name() {
            return name_;
        }
        inline void setName(const std::string& name) {
            name_ = name;
        }
        inline const std::string& modelName() {
            return modelName_;
        }
        inline void setModelName(const std::string& name) {
            modelName_ = name;
        }
        
        void setRootLink(Link* link);

        /**
           This function must be called when the structure of the link tree is changed.
        */
        void updateLinkTree();

        /**
           The number of the links that work as a joint.
           Note that the acutal value is the maximum joint ID plus one.
           Thus there may be a case where the value does not correspond
           to the actual number of the joint-links.
           In other words, the value represents the size of the link sequence
           obtained by joint() function.
        */
        inline int numJoints() const {
            return jointIdToLinkArray.size();
        }

        /**
           This function returns a link that has a given joint ID.
           If there is no link that has a given joint ID,
           the function returns a dummy link object whose ID is minus one.
           The maximum id can be obtained by numJoints().
        */
        inline Link* joint(int id) const {
            return jointIdToLinkArray[id];
        }

        /**
           The vector<Link*> corresponding to the sequence of joint().
        */
        inline const std::vector<Link*>& joints() const {
            return jointIdToLinkArray;
        }

        /**
           The number of all the links the body has.
           The value corresponds to the size of the sequence obtained by link() function.
        */
        inline int numLinks() const {
            return linkTraverse_.numLinks();
        }

        /**
           This function returns the link of a given index in the whole link sequence.
           The order of the sequence corresponds to a link-tree traverse from the root link.
           The size of the sequence can be obtained by numLinks().
        */
        inline Link* link(int index) const {
            return linkTraverse_.link(index);
        }

        inline const LinkTraverse& links() const {
            return linkTraverse_;
        }

        /**
           LinkTraverse object that traverses all the links from the root link
        */
        inline const LinkTraverse& linkTraverse() const {
            return linkTraverse_;
        }

        /**
           This function returns a link that has a given name.
        */
        Link* link(const std::string& name) const;

        /**
           The root link of the body
        */
        inline Link* rootLink() const {
            return rootLink_;
        }

        // sensor access methods
        Sensor* createSensor(Link* link, int sensorType, int id, const std::string& name);

        void addSensor(Sensor* sensor, int sensorType, int id );

        inline Sensor* sensor(int sensorType, int sensorId) const {
            return allSensors[sensorType][sensorId];
        }

        inline int numSensors(int sensorType) const {
            return allSensors[sensorType].size();
        }

        inline int numSensorTypes() const {
            return allSensors.size();
        }

        void clearSensorValues();

        template <class TSensor> inline TSensor* sensor(int id) const {
            return static_cast<TSensor*>(allSensors[TSensor::TYPE][id]);
        }

        template <class TSensor> inline TSensor* sensor(const std::string& name) const {
            TSensor* sensor = 0;
            NameToSensorMap::const_iterator p = nameToSensorMap.find(name);
            if(p != nameToSensorMap.end()){
                sensor = dynamic_cast<TSensor*>(p->second);
            }
            return sensor;
        }

        /**
           This function returns true when the whole body is a static, fixed object like a floor.
        */
        inline bool isStaticModel() {
            return isStaticModel_;
        }

        double calcTotalMass();

        inline double totalMass() const {
            return totalMass_;
        }

        Vector3 calcCM();
        const Vector3& lastCM() { return lastCM_; }

        void calcTotalMomentum(Vector3& out_P, Vector3& out_L);
        void setDefaultRootPosition(const Vector3& p, const Matrix3& R);
        void getDefaultRootPosition(Vector3& out_p, Matrix3& out_R);
        void initializeConfiguration();
        void calcForwardKinematics(bool calcVelocity = false, bool calcAcceleration = false);
        void clearExternalForces();
        JointPathPtr getJointPath(Link* baseLink, Link* targetLink);
        void setVirtualJointForces();

        virtual InverseKinematicsPtr getDefaultIK(Link* targetLink);
        
        /**
           This function must be called before the collision detection.
           It updates the positions and orientations of the models
           for detecting collisions between links.
        */
        void updateLinkColdetModelPositions();

        void putInformation(std::ostream &out);

        bool installCustomizer();
        bool installCustomizer(BodyCustomizerInterface* customizerInterface);

        struct LinkConnection {
            Link* link[2];
            Vector3 point[2];
            int numConstraintAxes;
            Vector3 constraintAxes[3];
        };
        typedef std::vector<LinkConnection> LinkConnectionArray;

        LinkConnectionArray linkConnections;

        YamlMapping* info() { return info_.get(); }
        void resetInfo(YamlMappingPtr info);
        
        LinkGroup* linkGroup() { return linkGroup_.get(); }

      protected:

        Body(const Body& org);

        virtual void doResetInfo(const YamlMapping& info);

      private:

        bool isStaticModel_;
        Link* rootLink_;

        std::string name_;
        std::string modelName_;

        typedef std::vector<Link*> LinkArray;
        LinkArray jointIdToLinkArray;

        LinkTraverse linkTraverse_;

        typedef std::map<std::string, Link*> NameToLinkMap;
        NameToLinkMap nameToLinkMap;

        // sensor = sensors[type][sensorId]
        typedef std::vector<Sensor*> SensorArray;
        std::vector<SensorArray> allSensors;

        typedef std::map<std::string, Sensor*> NameToSensorMap;
        NameToSensorMap nameToSensorMap;

        double totalMass_;
        Vector3 lastCM_;

        Vector3 defaultRootPosition;
        Matrix3 defaultRootAttitude;

        LinkGroupPtr linkGroup_;
        YamlMappingPtr info_;

        // Members for customizer
        BodyCustomizerHandle customizerHandle;
        BodyCustomizerInterface* customizerInterface;
        BodyHandleEntity bodyHandleEntity;
        BodyHandle bodyHandle;

        void initialize();
        Link* createEmptyJoint(int jointId);
        void setVirtualJointForcesSub();

        friend class CustomizedJointPath;
    };

};


CNOID_EXPORT std::ostream &operator<< (std::ostream& out, cnoid::Body& body);

#endif