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