5 #ifndef FORBCC_METHOD_H 6 #define FORBCC_METHOD_H 9 #include <templates/ordered_unique_list.hpp> 11 #include <interface.hpp> 12 #include <parameter.hpp> 19 extern const std::string res_code_type;
28 int _counters[3] = {0, 0, 0};
31 std::shared_ptr<const type> _return_type;
41 const std::shared_ptr<const type> &return_type)
43 _return_type(return_type) {};
89 ++_counters[
static_cast<int>(param.
dir())];
98 std::string
id()
const;
109 std::string get_unused_variable_name(std::string
name)
const;
114 #endif //FORBCC_METHOD_H Defines a method of a forbcc::interface, which can have an arbitrary number of input, output or inout parameters.
Definition: method.hpp:23
void print_definition(code_ostream &) const override
THIS FUNCTION DOES NOTHING, use the print_stub_definition and print_skeleton_definition methods respe...
Definition: method.hpp:71
void print_stub_definition(code_ostream &out, const std::string &scope, const std::string &enumname) const
Prints the definition of the method of the stub.
Definition: method.cpp:49
std::string id() const
Returns the method id, which will be stored within an enum class defined for each interface...
Definition: method.cpp:297
~method() override=default
This class is virtual, so it requires a virtual destructor.
Represents the parameter of a forbcc::method, each associated with a direction between either input...
Definition: parameter.hpp:22
virtual bool insert(std::string key, const T &value)
Inserts a new value within the list if the corrisponding key is not present.
Definition: ordered_unique_list.hpp:44
direction dir() const
Returns the direction of the parameter.
Definition: parameter.hpp:60
A template that can be used to declare a list of unique ordered items.
Definition: ordered_unique_list.hpp:16
void print_virtual_declaration(code_ostream &out) const
Prints the virtual declaration of a method.
Definition: method.cpp:34
method()
Empty method, used to preallocate variables in arrays or to use later assignment operator.
Definition: method.hpp:37
std::shared_ptr< entity > parent() const
Returns the parent of the given entity.
Definition: entity.hpp:63
std::string name() const
Returns the name of the given entity.
Definition: entity.hpp:68
void print_skeleton_definition(code_ostream &out) const
Prints the definition of the skeleton code wrapping the virtual call to the method, defined by subclasses of the generated skeleton class.
Definition: method.cpp:166
This output stream supports indentation of code lines, which are formatted at each std::endl...
Definition: code_ostream.hpp:14
bool insert(std::string key, const parameter ¶m) override
Proxy to ordered_unique_list<forbcc::parameter>, which counts the number of parameters of each succes...
Definition: method.hpp:85
Definition: code_ostream.hpp:11
Any code entity that should be generated by the compiler: namespaces, classes, structures, methods, variables.
Definition: entity.hpp:18
method & operator=(method &&)=default
This class supports moving.
method(const std::shared_ptr< interface > &parent, const std::string &name, const std::shared_ptr< const type > &return_type)
Constructs a new method for the given parent interface with a name and a return type.
Definition: method.hpp:40
void print_declaration(code_ostream &out) const override
Prints the method declaration.
Definition: method.cpp:29