EEROS  1.0.0.0
API for the EEROS Real-Time Robotics Framework
DeMux.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_CONTROL_DEMUX_HPP_
2 #define ORG_EEROS_CONTROL_DEMUX_HPP_
3 
5 #include <eeros/math/Matrix.hpp>
7 
8 namespace eeros {
9  namespace control {
10 
11  template < uint32_t N, typename T = double, typename C = eeros::math::Matrix<N,1,T> >
12  class DeMux: public Block1i<C> {
13  public:
14  DeMux() {
15  for(int i = 0; i < N; i++) {
16  this->out[i].getSignal().clear();
17  out[i].setOwner(this);
18  }
19  }
20 
21  virtual void run() {
22  for(int i = 0; i < N; i++) {
23  out[i].getSignal().setValue(this->in.getSignal().getValue()(i));
24  out[i].getSignal().setTimestamp(this->in.getSignal().getTimestamp());
25  }
26  }
27 
28  virtual Output<T>& getOut(uint32_t index) {
29  return out[index];
30  }
31 
32  protected:
34  };
35 
36  };
37 };
38 
39 #endif /* ORG_EEROS_CONTROL_DEMUX_HPP_ */
virtual void run()
Definition: DeMux.hpp:21
Output< T > out[N]
Definition: DeMux.hpp:33
virtual T getValue() const
Definition: Signal.hpp:49
Definition: Block1i.hpp:12
Definition: Config.hpp:14
Definition: DeMux.hpp:12
Definition: Output.hpp:11
virtual Output< T > & getOut(uint32_t index)
Definition: DeMux.hpp:28
DeMux()
Definition: DeMux.hpp:14
virtual Signal< T > & getSignal()
Definition: Input.hpp:38
virtual timestamp_t getTimestamp() const
Definition: Signal.hpp:62
Input< C > in
Definition: Block1i.hpp:21