RecursionParams.h
Go to the documentation of this file.
00001 
00031 #ifndef URDF_TRAVERSER_RECURSIONPARAMS_H
00032 #define URDF_TRAVERSER_RECURSIONPARAMS_H
00033 // Copyright Jennifer Buehler
00034 
00035 #include <baselib_binding/SharedPtr.h>
00036 #include <urdf_traverser/Types.h>
00037 
00038 namespace urdf_traverser
00039 {
00040 
00051 class RecursionParams
00052 {
00053     friend class UrdfTraverser;
00054 public:
00055     typedef baselib_binding::shared_ptr<RecursionParams>::type Ptr;
00056 
00057     explicit RecursionParams(): level(-1) {}
00058     explicit RecursionParams(const RecursionParams& o):
00059         link(o.link),
00060         level(o.level) {}
00061     virtual ~RecursionParams() {}
00062 
00063     RecursionParams& operator=(const RecursionParams& o)
00064     {
00065         link = o.link;
00066         level = o.level;
00067         return *this;
00068     }
00069 
00070     LinkPtr getLink() const
00071     {
00072         return link;
00073     }
00074 
00078     unsigned int getLevel() const
00079     {
00080         return level;
00081     }
00082 
00083 protected:
00084     explicit RecursionParams(LinkPtr& _link, unsigned int _level):
00085         link(_link),
00086         level(_level) {}
00087 
00088 
00089     // Sets the current variables for the recursion state.
00090     void setParams(const LinkPtr& _link, int _level)
00091     {
00092         link = _link;
00093         level = _level;
00094     }
00095 
00096     // the link the recursion is applied on
00097     LinkPtr link;
00098 
00099     // level in the tree (distance to link on which traversal was started)
00100     unsigned int level;
00101 };
00102 
00103 typedef RecursionParams::Ptr RecursionParamsPtr;
00104 
00112 class ModelRecursionParams: public RecursionParams
00113 {
00114 public:
00115     typedef baselib_binding::shared_ptr<ModelRecursionParams>::type Ptr;
00116     explicit ModelRecursionParams(): RecursionParams() {}
00117     explicit ModelRecursionParams(const ModelPtr& _model):
00118         RecursionParams(),
00119         model(_model) {}
00120     ModelRecursionParams(const ModelRecursionParams& o):
00121         RecursionParams(o),
00122         model(o.model) {}
00123     virtual ~ModelRecursionParams() {}
00124 
00125     ModelPtr model;
00126 };
00127 typedef ModelRecursionParams::Ptr ModelRecursionParamsPtr;
00128 
00134 class LinkRecursionParams: public ModelRecursionParams
00135 {
00136 public:
00137     typedef baselib_binding::shared_ptr<LinkRecursionParams>::type Ptr;
00138     explicit LinkRecursionParams(): ModelRecursionParams() {}
00139     explicit LinkRecursionParams(const ModelPtr& model): ModelRecursionParams(model) {}
00140     LinkRecursionParams(const LinkRecursionParams& o):
00141         ModelRecursionParams(o),
00142         resultLink(o.resultLink) {}
00143     virtual ~LinkRecursionParams() {}
00144 
00145     LinkPtr resultLink;
00146 };
00147 typedef LinkRecursionParams::Ptr LinkRecursionParamsPtr;
00148 
00149 
00150 
00151 
00156 class FactorRecursionParams: public RecursionParams
00157 {
00158 public:
00159     typedef baselib_binding::shared_ptr<FactorRecursionParams>::type Ptr;
00160     explicit FactorRecursionParams(): RecursionParams(), factor(1.0) {}
00161     explicit FactorRecursionParams(double _factor):
00162         RecursionParams(),
00163         factor(_factor) {}
00164     FactorRecursionParams(const FactorRecursionParams& o):
00165         RecursionParams(o),
00166         factor(o.factor) {}
00167     virtual ~FactorRecursionParams() {}
00168 
00169     double factor;
00170 };
00171 typedef FactorRecursionParams::Ptr FactorRecursionParamsPtr;
00172 
00177 class FlagRecursionParams: public RecursionParams
00178 {
00179 public:
00180     typedef baselib_binding::shared_ptr<FlagRecursionParams>::type Ptr;
00181     explicit FlagRecursionParams(): RecursionParams(), flag(false) {}
00182     explicit FlagRecursionParams(bool _flag):
00183         RecursionParams(),
00184         flag(_flag) {}
00185     FlagRecursionParams(const FlagRecursionParams& o):
00186         RecursionParams(o),
00187         flag(o.flag) {}
00188     virtual ~FlagRecursionParams() {}
00189 
00190     bool flag;
00191 };
00192 typedef FlagRecursionParams::Ptr FlagRecursionParamsPtr;
00193 
00194 
00195 
00200 class StringVectorRecursionParams: public RecursionParams
00201 {
00202 public:
00203     typedef baselib_binding::shared_ptr<StringVectorRecursionParams>::type Ptr;
00204     explicit StringVectorRecursionParams(const bool _skipFixed):
00205         RecursionParams(),
00206         skipFixed(_skipFixed) {}
00207     StringVectorRecursionParams(const StringVectorRecursionParams& o):
00208         RecursionParams(o),
00209         names(o.names),
00210         skipFixed(o.skipFixed) {}
00211     virtual ~StringVectorRecursionParams() {}
00212     // skip the fixed joints and collect only movable ones
00213     bool skipFixed;
00214     std::vector<std::string> names;
00215 private:
00216     explicit StringVectorRecursionParams() {}
00217 };
00218 typedef StringVectorRecursionParams::Ptr StringVectorRecursionParamsPtr;
00219 
00220 
00221 
00222 }  // namespace
00223 #endif  //  URDF_TRAVERSER_RECURSIONPARAMS_H


urdf_traverser
Author(s): Jennifer Buehler
autogenerated on Fri Mar 1 2019 03:38:07