libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
RpcMethod.h
Go to the documentation of this file.
1 /* Copyright 2013-2019 Homegear GmbH
2  *
3  * Homegear is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation, either version 3 of the
6  * License, or (at your option) any later version.
7  *
8  * Homegear is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with Homegear. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  * In addition, as a special exception, the copyright holders give
18  * permission to link the code of portions of this program with the
19  * OpenSSL library under certain conditions as described in each
20  * individual source file, and distribute linked combinations
21  * including the two.
22  * You must obey the GNU Lesser General Public License in all respects
23  * for all of the code used other than OpenSSL. If you modify
24  * file(s) with this exception, you may extend this exception to your
25  * version of the file(s), but you are not obligated to do so. If you
26  * do not wish to do so, delete this exception statement from your
27  * version. If you delete this exception statement from all source
28  * files in the program, then also delete it here.
29 */
30 
31 #ifndef RPCMETHOD_H_
32 #define RPCMETHOD_H_
33 
34 #include "../Variable.h"
35 #include "../Sockets/RpcClientInfo.h"
36 
37 #include <vector>
38 #include <memory>
39 
40 namespace BaseLib
41 {
42 namespace Rpc
43 {
44 
45 class RpcMethod
46 {
47 public:
49  {
51  };
52 
53  RpcMethod() {}
54  virtual ~RpcMethod() {}
55 
56  ParameterError::Enum checkParameters(std::shared_ptr<std::vector<PVariable>> parameters, std::vector<VariableType> types);
57  ParameterError::Enum checkParameters(std::shared_ptr<std::vector<PVariable>> parameters, std::vector<std::vector<VariableType>> types);
58  virtual PVariable invoke(PRpcClientInfo clientInfo, std::shared_ptr<std::vector<PVariable>> parameters);
61  void addSignature(VariableType returnType, std::vector<VariableType> parameterTypes);
62  PVariable getHelp() { return _help; }
63  void setHelp(std::string help);
64 protected:
67 };
68 typedef std::shared_ptr<RpcMethod> PRpcMethod;
69 
70 }
71 }
72 #endif
PVariable getSignature()
Definition: RpcMethod.h:60
Enum
Definition: RpcMethod.h:50
PVariable getHelp()
Definition: RpcMethod.h:62
virtual ~RpcMethod()
Definition: RpcMethod.h:54
Definition: BaseLib.cpp:34
virtual PVariable invoke(PRpcClientInfo clientInfo, std::shared_ptr< std::vector< PVariable >> parameters)
Definition: RpcMethod.cpp:38
std::shared_ptr< RpcClientInfo > PRpcClientInfo
Definition: ScriptInfo.h:47
VariableType
Definition: Variable.h:49
void addSignature(VariableType returnType, std::vector< VariableType > parameterTypes)
Definition: RpcMethod.cpp:84
std::shared_ptr< Variable > PVariable
Definition: PhysicalInterfaceSettings.h:41
Definition: RpcMethod.h:45
void setHelp(std::string help)
Definition: RpcMethod.cpp:79
Definition: RpcMethod.h:48
PVariable getError(ParameterError::Enum error)
Definition: RpcMethod.cpp:72
PVariable _help
Definition: RpcMethod.h:66
std::shared_ptr< RpcMethod > PRpcMethod
Definition: RpcMethod.h:68
RpcMethod()
Definition: RpcMethod.h:53
PVariable _signatures
Definition: RpcMethod.h:65
ParameterError::Enum checkParameters(std::shared_ptr< std::vector< PVariable >> parameters, std::vector< VariableType > types)
Definition: RpcMethod.cpp:43