joint_dispatcher
Dispatcher.hpp
Go to the documentation of this file.
1 #ifndef JOINT_DISPATCHER_DISPATCHER_HPP
2 #define JOINT_DISPATCHER_DISPATCHER_HPP
3 
4 #include <vector>
5 #include <joint_dispatcher/Input.hpp>
6 #include <joint_dispatcher/Output.hpp>
7 
8 namespace joint_dispatcher
9 {
15  class Dispatcher
16  {
17  std::vector<Input> mInputs;
18  std::vector<Output> mOutputs;
19 
20  public:
21  typedef size_t ChannelID;
22 
29  ChannelID addInput(std::string const& name = "");
30 
36  ChannelID addOutput(std::string const& name, std::vector<std::string> const& jointNames);
37 
44  ChannelID addOutput(std::string const& name = "", size_t size = 0);
45 
48  ChannelID getInputByName(std::string const& name) const;
49 
52  ChannelID getOutputByName(std::string const& name) const;
53 
56  Output &getOutput(ChannelID id);
57 
61  void addDispatch(
62  ChannelID input, JointSelection const& inputJoints,
63  ChannelID output, JointSelection const& outputJoints);
64 
67  void addDispatch(std::string const& input,
68  JointSelection const& inputJoints,
69  std::string const& output,
70  JointSelection const& outputJoints);
71 
76  void write(ChannelID input,
77  base::samples::Joints const& sample);
78 
81  void write(std::string const& input,
82  base::samples::Joints const& sample);
83 
90  bool read(ChannelID output, base::samples::Joints& sample);
91 
94  bool read(std::string const& name, base::samples::Joints& sample);
95 
99  void reset();
100  };
101 }
102 
103 #endif
104 
Definition: Dispatcher.hpp:8
Definition: JointSelection.hpp:12
Definition: Dispatcher.hpp:15
ChannelID addInput(std::string const &name="")
Definition: Dispatcher.cpp:5
void addDispatch(ChannelID input, JointSelection const &inputJoints, ChannelID output, JointSelection const &outputJoints)
Definition: Dispatcher.cpp:47
void write(ChannelID input, base::samples::Joints const &sample)
Definition: Dispatcher.cpp:73
ChannelID getOutputByName(std::string const &name) const
Definition: Dispatcher.cpp:33
Definition: Output.hpp:13
void reset()
Definition: Dispatcher.cpp:107
Output & getOutput(ChannelID id)
Definition: Dispatcher.cpp:41
size_t ChannelID
Definition: Dispatcher.hpp:21
ChannelID addOutput(std::string const &name, std::vector< std::string > const &jointNames)
Definition: Dispatcher.cpp:18
bool read(ChannelID output, base::samples::Joints &sample)
Definition: Dispatcher.cpp:86
ChannelID getInputByName(std::string const &name) const
Definition: Dispatcher.cpp:25