unary-op.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #ifndef SOT_CORE_UNARYOP_HH
11 #define SOT_CORE_UNARYOP_HH
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* SOT */
19 #include <dynamic-graph/entity.h>
20 
21 /* --------------------------------------------------------------------- */
22 /* --- CLASS ----------------------------------------------------------- */
23 /* --------------------------------------------------------------------- */
24 
25 namespace dynamicgraph {
26 namespace sot {
27 
28 template <typename Operator>
29 class UnaryOp : public Entity {
30  Operator op;
31  typedef typename Operator::Tin Tin;
32  typedef typename Operator::Tout Tout;
34 
35  public: /* --- CONSTRUCTION --- */
36  static std::string getTypeInName(void) { return Operator::nameTypeIn(); }
37  static std::string getTypeOutName(void) { return Operator::nameTypeOut(); }
38  static const std::string CLASS_NAME;
39 
40  virtual const std::string &getClassName() const { return CLASS_NAME; }
41 
42  std::string getDocString() const { return op.getDocString(); }
43 
44  UnaryOp(const std::string &name)
45  : Entity(name),
46  SIN(NULL, Self::CLASS_NAME + "(" + name + ")::input(" +
47  Self::getTypeInName() + ")::sin"),
48  SOUT(boost::bind(&Self::computeOperation, this, _1, _2), SIN,
49  Self::CLASS_NAME + "(" + name + ")::output(" +
50  Self::getTypeOutName() + ")::sout") {
52  op.addSpecificCommands(*this, commandMap);
53  }
54 
55  virtual ~UnaryOp(void){};
56 
57  public: /* --- SIGNAL --- */
60 
61  protected:
63  const Tin &x1 = SIN(time);
64  op(x1, res);
65  return res;
66  }
67 
68  public: /* --- PARAMS --- */
69 };
70 } /* namespace sot */
71 } /* namespace dynamicgraph */
72 
73 #endif // #ifndef SOT_CORE_UNARYOP_HH
dynamicgraph::sot::UnaryOp::Tin
Operator::Tin Tin
Definition: unary-op.hh:31
dynamicgraph::SignalPtr< Tin, sigtime_t >
dynamicgraph
dynamicgraph::sot::UnaryOp::getClassName
virtual const std::string & getClassName() const
Definition: unary-op.hh:40
dynamicgraph::Entity::commandMap
CommandMap_t commandMap
dynamicgraph::Entity
boost
dynamicgraph::Entity::name
std::string name
dynamicgraph::sot::UnaryOp::SIN
SignalPtr< Tin, sigtime_t > SIN
Definition: unary-op.hh:55
dynamicgraph::sot::UnaryOp::Tout
Operator::Tout Tout
Definition: unary-op.hh:32
dynamicgraph::sot::UnaryOp::getTypeInName
static std::string getTypeInName(void)
Definition: unary-op.hh:36
res
res
dynamicgraph::sigtime_t
int64_t sigtime_t
dynamicgraph::sot::UnaryOp
Definition: unary-op.hh:29
dynamicgraph::sot::UnaryOp::UnaryOp
UnaryOp(const std::string &name)
Definition: unary-op.hh:44
all-signals.h
dynamicgraph::sot::UnaryOp::Self
UnaryOp< Operator > Self
Definition: unary-op.hh:33
dynamicgraph::sot::UnaryOp::getTypeOutName
static std::string getTypeOutName(void)
Definition: unary-op.hh:37
dynamicgraph::sot::UnaryOp::computeOperation
Tout & computeOperation(Tout &res, sigtime_t time)
Definition: unary-op.hh:62
dynamicgraph::SignalTimeDependent< Tout, sigtime_t >
dynamicgraph::sot::UnaryOp::CLASS_NAME
static const std::string CLASS_NAME
Definition: unary-op.hh:38
dynamicgraph::sot::UnaryOp::getDocString
std::string getDocString() const
Definition: unary-op.hh:42
dynamicgraph::sot::UnaryOp::op
Operator op
Definition: unary-op.hh:30
dynamicgraph::Entity::signalRegistration
void signalRegistration(const SignalArray< sigtime_t > &signals)
dynamicgraph::sot::UnaryOp::~UnaryOp
virtual ~UnaryOp(void)
Definition: unary-op.hh:55
dynamicgraph::sot::UnaryOp::SOUT
SignalTimeDependent< Tout, sigtime_t > SOUT
Definition: unary-op.hh:59


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:32