| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/* |
| 2 |
|
|
* Copyright 2010, |
| 3 |
|
|
* François Bleibel, |
| 4 |
|
|
* Olivier Stasse, |
| 5 |
|
|
* |
| 6 |
|
|
* CNRS/AIST |
| 7 |
|
|
* |
| 8 |
|
|
*/ |
| 9 |
|
|
|
| 10 |
|
|
#include <sot/core/derivator.hh> |
| 11 |
|
|
#include <sot/core/factory.hh> |
| 12 |
|
|
|
| 13 |
|
|
using namespace dynamicgraph::sot; |
| 14 |
|
|
using namespace dynamicgraph; |
| 15 |
|
|
|
| 16 |
|
|
// Unrolled Code: |
| 17 |
|
|
// template<> |
| 18 |
|
|
// const double Derivator<double>::TIMESTEP_DEFAULT = 1.; |
| 19 |
|
|
|
| 20 |
|
|
// template<> |
| 21 |
|
|
// std::string Derivator<double>:: |
| 22 |
|
|
// getTypeName( void ) { return #double; } |
| 23 |
|
|
|
| 24 |
|
|
// template<> |
| 25 |
|
|
// const std::string Derivator<double>::CLASS_NAME = |
| 26 |
|
|
// std::string("Derivator_of_double"); extern "C" { |
| 27 |
|
|
// Entity *regFunctiondoubleDerivator( const std::string& objname ) |
| 28 |
|
|
// { |
| 29 |
|
|
// return new Derivator<double>( objname ); |
| 30 |
|
|
// } |
| 31 |
|
|
// EntityRegisterer regObjdoubleDerivator |
| 32 |
|
|
// ( std::string("Derivator_of_double"), |
| 33 |
|
|
// ®FunctiondoubleDerivator ); |
| 34 |
|
|
// } |
| 35 |
|
|
|
| 36 |
|
|
#define SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(sotClassType, sotType, className) \ |
| 37 |
|
|
template <> \ |
| 38 |
|
|
const double Derivator<sotType>::TIMESTEP_DEFAULT = 1.; \ |
| 39 |
|
|
template <> \ |
| 40 |
|
|
std::string sotClassType<sotType>::getTypeName(void) { \ |
| 41 |
|
|
return #sotType; \ |
| 42 |
|
|
} \ |
| 43 |
|
|
template <> \ |
| 44 |
|
|
const std::string sotClassType<sotType>::CLASS_NAME = \ |
| 45 |
|
|
std::string(className) + "_of_" + #sotType; \ |
| 46 |
|
|
extern "C" { \ |
| 47 |
|
|
Entity *regFunction##_##sotType##_##sotClassType( \ |
| 48 |
|
|
const std::string &objname) { \ |
| 49 |
|
|
return new sotClassType<sotType>(objname); \ |
| 50 |
|
|
} \ |
| 51 |
|
|
EntityRegisterer regObj##_##sotType##_##sotClassType( \ |
| 52 |
|
|
std::string(className) + "_of_" + #sotType, \ |
| 53 |
|
|
®Function##_##sotType##_##sotClassType); \ |
| 54 |
|
|
} |
| 55 |
|
|
|
| 56 |
|
|
namespace dynamicgraph { |
| 57 |
|
|
namespace sot { |
| 58 |
|
✗ |
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(Derivator, double, "Derivator") |
| 59 |
|
✗ |
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(Derivator, Vector, "Derivator") |
| 60 |
|
✗ |
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(Derivator, Matrix, "Derivator") |
| 61 |
|
✗ |
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(Derivator, VectorQuaternion, "Derivator") |
| 62 |
|
|
} // namespace sot |
| 63 |
|
|
} // namespace dynamicgraph |
| 64 |
|
|
|
| 65 |
|
|
#include <sot/core/derivator-impl.hh> |
| 66 |
|
|
|
| 67 |
|
|
#ifdef WIN32 |
| 68 |
|
|
#define SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN_WIN32(sotClassType, sotType, \ |
| 69 |
|
|
className) \ |
| 70 |
|
|
sotClassType##sotType## ::sotClassType##sotType##(const std::string &name) \ |
| 71 |
|
|
: sotClassType<sotType>(name){}; |
| 72 |
|
|
|
| 73 |
|
|
typedef double Double; |
| 74 |
|
|
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN_WIN32(Derivator, Double, "Derivator") |
| 75 |
|
|
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN_WIN32(Derivator, Vector, "Derivator") |
| 76 |
|
|
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN_WIN32(Derivator, Matrix, "Derivator") |
| 77 |
|
|
SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN_WIN32(Derivator, VectorQuaternion, |
| 78 |
|
|
"Derivator") |
| 79 |
|
|
#endif |
| 80 |
|
|
|