Drake
adder.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <memory>
5 
10 
11 namespace drake {
12 namespace systems {
13 
16 template <typename T>
17 class Adder : public SystemInterface<T> {
18  public:
21  Adder(int num_inputs, int length);
22 
25  std::unique_ptr<Context<T>> CreateDefaultContext() const override;
26 
28  std::unique_ptr<SystemOutput<T>> AllocateOutput() const override;
29 
32  void EvalOutput(const Context<T>& context,
33  SystemOutput<T>* output) const override;
34 
36  std::string get_name() const override { return "adder"; }
37 
38  private:
39  const int num_inputs_;
40  const int length_;
41 };
42 
43 } // namespace systems
44 } // namespace drake
Definition: constants.h:3
An adder for arbitrarily many inputs of equal length.
Definition: adder.h:17
The Context is a container for all of the data necessary to uniquely determine the computations perfo...
Definition: context.h:38
A superclass template for systems that receive input, maintain state, and produce numerical output us...
Definition: system_interface.h:46
Adder(int num_inputs, int length)
Definition: adder.cc:14
std::unique_ptr< SystemOutput< T > > AllocateOutput() const override
Allocates one output port of the width specified in the constructor.
Definition: adder.cc:25
std::unique_ptr< Context< T > > CreateDefaultContext() const override
Allocates the number of input ports specified in the constructor.
Definition: adder.cc:18
void EvalOutput(const Context< T > &context, SystemOutput< T > *output) const override
Sums the input ports into the output port.
Definition: adder.cc:38
A container for all the output ports of a System.
Definition: system_output.h:133
std::string get_name() const override
TODO(david-german-tri): Make this configurable in the constructor.
Definition: adder.h:36