Remote Call Framework 3.1
RemoteCallContext.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2019, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 3.1
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_REMOTECALLCONTEXT_HPP
20 #define INCLUDE_RCF_REMOTECALLCONTEXT_HPP
21 
22 #include <memory>
23 #include <type_traits>
24 
25 #include <RCF/Export.hpp>
26 #include <RCF/Marshal.hpp>
27 #include <RCF/Tools.hpp>
28 
29 namespace RCF {
30 
31  class I_Parameters;
32  class RcfSession;
33  class AsioNetworkSession;
34 
35  typedef std::shared_ptr<RcfSession> RcfSessionPtr;
36  typedef std::shared_ptr<AsioNetworkSession> AsioNetworkSessionPtr;
37 
39  class RCF_EXPORT RemoteCallContextImpl
40  {
41  public:
42 
44 
46  void commit();
47 
49  void commit(const std::exception &e);
50 
52  bool isCommitted() const;
53 
55  RcfSession& getRcfSession();
56 
57  private:
58  RcfSessionPtr mRcfSessionPtr;
59  AsioNetworkSessionPtr mNetworkSessionPtr;
60  bool mCommitted;
61 
62  protected:
63  I_Parameters * mpParametersUntyped;
64 
65  };
66 
69  template<
70  typename R,
71  typename A1 = Void,
72  typename A2 = Void,
73  typename A3 = Void,
74  typename A4 = Void,
75  typename A5 = Void,
76  typename A6 = Void,
77  typename A7 = Void,
78  typename A8 = Void,
79  typename A9 = Void,
80  typename A10 = Void,
81  typename A11 = Void,
82  typename A12 = Void,
83  typename A13 = Void,
84  typename A14 = Void,
85  typename A15 = Void>
87  {
88  public:
89 
90  // If return type is void, change it to RCF::Void.
91  typedef typename If<
92  std::is_same<R, void>,
93  Void,
94  R>::type R_;
95 
96  typedef ServerParameters<
97  R_,
98  A1, A2, A3, A4, A5, A6, A7, A8,
99  A9, A10, A11, A12, A13, A14, A15> ParametersT;
100 
103  {
104  RCF_ASSERT( dynamic_cast<ParametersT *>(mpParametersUntyped) );
105  }
106 
108  ParametersT &parameters()
109  {
110  return * static_cast<ParametersT *>(mpParametersUntyped);;
111  }
112  };
113 
114 } // namespace RCF
115 
116 #endif // ! INCLUDE_RCF_REMOTECALLCONTEXT_HPP
Represents a server side session, associated with a client connection.
Definition: RcfSession.hpp:67
Base class of RemoteCallContext.
Definition: RemoteCallContext.hpp:39
Definition: RemoteCallContext.hpp:86
RemoteCallContext(RCF::RcfSession &session)
Constructs a remote call context.
Definition: RemoteCallContext.hpp:102
Definition: AmiIoHandler.hpp:24
ParametersT & parameters()
Provides access to the parameters of a remote call context.
Definition: RemoteCallContext.hpp:108