Open Lighting Architecture: common/rpc/RpcService.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
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 the ola protoc plugin 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
30namespace ola {
31namespace rpc {
32
33class RpcController;
34
35 class RpcService {
36 public:
37 typedef SingleUseCallback0<void> CompletionCallback;
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_
Callback.h
ola::SingleUseCallback0
A 0 argument callback which deletes itself after it's run.
Definition Callback.h:141
ola::rpc::RpcController
A RpcController object is passed every time an RPC is invoked and is used to indicate the success or ...
Definition RpcController.h:42
ola::rpc
The RPC (Remote Procedure Call) system.
Definition RpcChannel.cpp:41
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44