EEROS  0.4.1.0
API for the EEROS Real-Time Robotics Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Mux.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_CONTROL_MUX_HPP_
2 #define ORG_EEROS_CONTROL_MUX_HPP_
3 
5 #include <eeros/math/Matrix.hpp>
8 
9 namespace eeros {
10  namespace control {
11 
12  template < uint32_t N, typename T = double, typename C = eeros::math::Matrix<N,1,T> >
13  class Mux: public Block {
14 
15  public:
16  Mux() { }
17 
18  virtual void run() {
19  C newValue;
20  for(int i = 0; i < N; i++) {
21  newValue(i) = in[i].getSignal().getValue();
22  }
23  out.getSignal().setValue(newValue);
24  out.getSignal().setTimestamp(in[0].getSignal().getTimestamp());
25  }
26 
27  virtual Input<T>& getIn(uint32_t index) {
28  return in[index];
29  }
30 
31  virtual Output<C>& getOut() {
32  return out;
33  }
34 
35  protected:
38  };
39 
40  };
41 };
42 
43 #endif /* ORG_EEROS_CONTROL_MUX_HPP_ */
Definition: Mux.hpp:13
virtual Signal< T > & getSignal()
Definition: Output.hpp:13
Mux()
Definition: Mux.hpp:16
virtual Input< T > & getIn(uint32_t index)
Definition: Mux.hpp:27
Output< C > out
Definition: Mux.hpp:37
virtual void run()
Definition: Mux.hpp:18
Definition: Block.hpp:10
virtual void setValue(T newValue)
Definition: Signal.hpp:50
virtual Output< C > & getOut()
Definition: Mux.hpp:31
virtual void setTimestamp(timestamp_t newTimestamp)
Definition: Signal.hpp:63
Input< T > in[N]
Definition: Mux.hpp:36
int i
Definition: RingBufferTest.cpp:12
Definition: Input.hpp:11