AbstractFunction.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 #include <zeus/debug.hpp>
8 #include <zeus/ParamType.hpp>
9 #include <zeus/File.hpp>
10 #include <zeus/Buffer.hpp>
11 #include <zeus/BufferCall.hpp>
12 #include <ememory/memory.hpp>
13 
14 
15 namespace zeus {
24  protected:
29  AbstractFunction(const std::string& _name);
30  public:
34  virtual ~AbstractFunction() = default;
35  public:
39  enum class type {
40  unknow,
41  global,
42  local,
43  service,
44  object,
45  };
46  protected:
47  enum type m_type;
48  public:
53  enum type getType() const;
58  void setType(enum type _type);
59  protected:
60  std::string m_name;
61  public:
66  const std::string& getName() const;
67  protected:
68  std::string m_description;
69  public:
74  const std::string& getDescription() const;
79  void setDescription(const std::string& _desc);
80  protected:
81  std::vector<std::pair<std::string, std::string>> m_paramsDescription;
82  public:
89  void setParam(int32_t _idParam, const std::string& _name, const std::string& _desc);
95  void addParam(const std::string& _name, const std::string& _desc);
96  protected:
97  std::string m_returnDescription;
98  public:
103  void setReturn(const std::string& _desc);
104  public:
109  std::string getPrototype() const;
114  virtual std::string getSignature() const;
119  virtual std::string getPrototypeReturn() const = 0;
124  virtual std::vector<std::string> getPrototypeParam() const = 0;
131  virtual void execute(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
133  void* _class=nullptr) = 0;
134  };
135 }
136 
137 #include <zeus/WebServer.hpp>
138 
virtual std::vector< std::string > getPrototypeParam() const =0
Get the list of type of the parameter.
this is for service instance call
void setType(enum type _type)
Set the type of the call that must be done for this function.
enum type getType() const
Get the tyope of the call that is needed to do.
This call a service function (global function like "srv.xxx")
This is a global function.
enum type m_type
Type of the subCall (to permit to call many type of call)
Definition: AbstractFunction.hpp:47
AbstractFunction(const std::string &_name)
Constructor.
Interface to store a function and call it after with a zeus::Buffer.
Definition: AbstractFunction.hpp:23
std::string getPrototype() const
Get the prototype of the function with the parameter name and type.
void setParam(int32_t _idParam, const std::string &_name, const std::string &_desc)
Set the parameter name and description.
bool checkOrderFunctionParameter()
virtual void execute(ememory::SharedPtr< zeus::WebServer > _interfaceClient, ememory::SharedPtr< zeus::BufferCall > _obj, void *_class=nullptr)=0
Execute the function with all parameter properties.
std::string m_returnDescription
Return description of the Function.
Definition: AbstractFunction.hpp:97
std::string m_name
name of the function
Definition: AbstractFunction.hpp:60
std::string m_description
description of the function
Definition: AbstractFunction.hpp:68
virtual std::string getSignature() const
Get the signature of the function.
const std::string & getDescription() const
Get the description of the function.
void addParam(const std::string &_name, const std::string &_desc)
Set the parameter name and description of the last parameter not set (increment id every element) ...
virtual std::string getPrototypeReturn() const =0
Get the string of the type of the return value.
void setReturn(const std::string &_desc)
Set the return description of the Function.
virtual ~AbstractFunction()=default
generic virtual destructor
type
Under type of the call methode.
Definition: AbstractFunction.hpp:39
void setDescription(const std::string &_desc)
Set a new description of the function.
Main zeus library namespace.
Definition: AbstractFunction.hpp:15
This is a local fucntion.
Does not know the type of the call.
std::vector< std::pair< std::string, std::string > > m_paramsDescription
List of the parameter descriptions.
Definition: AbstractFunction.hpp:81
const std::string & getName() const
Get the name of the function.