Open Lighting Architecture  0.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RpcService.h
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * RpcService.h
17  * Interface for the RpcService.
18  * Copyright (C) 2013 Simon Newton
19  *
20  * All Services generated by ola_protoc inherit from this one.
21  */
22 
23 #ifndef COMMON_RPC_RPCSERVICE_H_
24 #define COMMON_RPC_RPCSERVICE_H_
25 
26 #include <google/protobuf/service.h>
27 #include <string>
28 #include "ola/Callback.h"
29 
30 namespace ola {
31 namespace rpc {
32 
33 class RpcController;
34 
35 class RpcService {
36  public:
38 
39  RpcService() {}
40  virtual ~RpcService() {}
41 
42  // Return the descriptor for this service.
43  virtual const google::protobuf::ServiceDescriptor* GetDescriptor() = 0;
44 
45  // Invoke a method.
46  virtual void CallMethod(const google::protobuf::MethodDescriptor *method,
47  RpcController *controller,
48  const google::protobuf::Message *request,
49  google::protobuf::Message *response,
50  CompletionCallback *done) = 0;
51 
52  virtual const google::protobuf::Message& GetRequestPrototype(
53  const google::protobuf::MethodDescriptor *method) const = 0;
54  virtual const google::protobuf::Message& GetResponsePrototype(
55  const google::protobuf::MethodDescriptor *method) const = 0;
56 };
57 } // namespace rpc
58 } // namespace ola
59 #endif // COMMON_RPC_RPCSERVICE_H_