OverSim
RpcMacros.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
25 #ifndef __RPC_MACROS_H
26 #define __RPC_MACROS_H
27 
33 #define RPC_SWITCH_START( message ) \
34  bool rpcHandled = false;\
35  do { \
36  BaseRpcMessage* ___msg = dynamic_cast<BaseRpcMessage*>(message);
37 
41 #define RPC_SWITCH_END() \
42  } while (false);
43 
44 #define IF_RPC_HANDLED \
45  if (rpcHandled)
46 
47 #define RPC_HANDLED \
48  rpcHandled
49 
56 #define RPC_DELEGATE( name, method ) \
57  name##Call* _##name##Call = dynamic_cast<name##Call*>(___msg); \
58  if (_##name##Call != NULL) { rpcHandled = true; method(_##name##Call); \
59  break; }
60 
66 #define RPC_ON_CALL( name ) \
67  name##Call* _##name##Call = dynamic_cast<name##Call*>(___msg); \
68  if (_##name##Call != NULL && !rpcHandled)
69 
75 #define RPC_ON_RESPONSE( name ) \
76  name##Response* _##name##Response = dynamic_cast<name##Response*>(___msg); \
77  if (_##name##Response != NULL && !rpcHandled)
78 
79 
80 #endif
81