Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RpcSession.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  * RpcSession.h
17  * The RPC Session object.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef COMMON_RPC_RPCSESSION_H_
22 #define COMMON_RPC_RPCSESSION_H_
23 
24 namespace ola {
25 namespace rpc {
26 
27 class RpcChannel;
28 
45 class RpcSession {
46  public:
52  explicit RpcSession(RpcChannel *channel)
53  : m_channel(channel),
54  m_data(NULL) {
55  }
56 
61  RpcChannel *Channel() { return m_channel; }
62 
68  void SetData(void *ptr) {
69  m_data = ptr;
70  }
71 
76  void *GetData() const { return m_data; }
77 
78  // TODO(simon): return the RpcPeer here as well.
79 
80  private:
81  RpcChannel *m_channel;
82  void *m_data;
83 };
84 } // namespace rpc
85 } // namespace ola
86 #endif // COMMON_RPC_RPCSESSION_H_
Represents the RPC session between a client and server.
Definition: RpcSession.h:45
void SetData(void *ptr)
Associate user data with this session.
Definition: RpcSession.h:68
void * GetData() const
Retrieve the user data associated with this session.
Definition: RpcSession.h:76
The RPC channel used to communicate between the client and the server. This implementation runs over ...
Definition: RpcChannel.h:51
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
RpcChannel * Channel()
Returns the underlying RPCChannel.
Definition: RpcSession.h:61
RpcSession(RpcChannel *channel)
Create a new session object.
Definition: RpcSession.h:52