/usr/include/choreonoid-1.1/cnoid/src/Body/LinkTraverse.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 | /**
\file
\brief The header file of the LinkTraverse class
\author Shin'ichiro Nakaoka
*/
#ifndef CNOID_BODY_LINK_TRAVERSE_H_INCLUDED
#define CNOID_BODY_LINK_TRAVERSE_H_INCLUDED
#include <vector>
#include <ostream>
#include "exportdecl.h"
namespace cnoid {
class Link;
class CNOID_EXPORT LinkTraverse
{
public:
LinkTraverse();
LinkTraverse(int size);
LinkTraverse(Link* root, bool doUpward = false, bool doDownward = true);
virtual ~LinkTraverse();
virtual void find(Link* root, bool doUpward = false, bool doDownward = true);
inline int numLinks() const {
return links.size();
}
inline bool empty() const {
return links.empty();
}
inline size_t size() const {
return links.size();
}
inline Link* rootLink() const {
return (links.empty() ? 0 : links.front());
}
inline Link* link(int index) const {
return links[index];
}
inline Link* operator[] (int index) const {
return links[index];
}
inline std::vector<Link*>::const_iterator begin() const {
return links.begin();
}
inline std::vector<Link*>::const_iterator end() const {
return links.end();
}
/**
If the connection from the queried link to the next link is downward (forward) direction,
the method returns true. Otherwise, returns false.
The range of valid indices is 0 to (numLinks() - 2).
*/
inline bool isDownward(int index) const {
return (index >= numUpwardConnections);
}
void calcForwardKinematics(bool calcVelocity = false, bool calcAcceleration = false) const;
protected:
std::vector<Link*> links;
int numUpwardConnections;
private:
void traverse(Link* link, bool doUpward, bool doDownward, bool isUpward, Link* prev);
};
};
CNOID_EXPORT std::ostream& operator<<(std::ostream& os, cnoid::LinkTraverse& traverse);
#endif
|