Remote Call Framework 3.0
RcfClient.hpp
Go to the documentation of this file.
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2018, 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.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
20 
21 #ifndef INCLUDE_RCF_RCFCLIENT_HPP
22 #define INCLUDE_RCF_RCFCLIENT_HPP
23 
24 #include <functional>
25 #include <map>
26 #include <memory>
27 
28 #include <RCF/Export.hpp>
29 #include <RCF/RcfFwd.hpp>
30 #include <RCF/Exception.hpp>
31 
32 namespace RCF {
33 
34 
35  RCF_EXPORT void setCurrentCallDesc(std::string& desc, RCF::MethodInvocationRequest& request, const char * szFunc, const char * szArity);
36 
37  // Returns the runtime name of the given RCF interface.
38  template<typename Interface>
39  inline std::string getInterfaceName(Interface * = 0)
40  {
41  return Interface::getInterfaceName();
42  }
43 
45  class RCF_EXPORT I_RcfClient
46  {
47  public:
48 
49  virtual ~I_RcfClient();
50 
51  I_RcfClient(const std::string & interfaceName);
52 
54  const std::string & interfaceName,
55  ServerBindingPtr serverStubPtr);
56 
58  const std::string & interfaceName,
59  const Endpoint & endpoint,
60  const std::string & serverBindingName = "");
61 
63  const std::string & interfaceName,
64  ClientTransportUniquePtr clientTransportUniquePtr,
65  const std::string & serverBindingName = "");
66 
68  const std::string & interfaceName,
69  const ClientStub & clientStub,
70  const std::string & serverBindingName = "");
71 
73  const std::string & interfaceName,
74  const I_RcfClient & rhs);
75 
76  I_RcfClient & operator=(const I_RcfClient & rhs);
77 
78  void swap(I_RcfClient & rhs);
79 
80  void setClientStubPtr(ClientStubPtr clientStubPtr);
81 
83  ClientStub & getClientStub();
84 
86  const ClientStub & getClientStub() const;
87 
88  ClientStubPtr getClientStubPtr() const;
89  ServerBindingPtr getServerStubPtr() const;
90  ServerBinding & getServerStub();
91 
92  protected:
93 
94  ClientStubPtr mClientStubPtr;
95  ServerBindingPtr mServerStubPtr;
96  std::string mInterfaceName;
97 
98  typedef Void V;
99  };
100 
101  typedef std::shared_ptr<I_RcfClient> RcfClientPtr;
102 
103  // some meta-programming functionality needed by the macros in IDL.hpp
104 
105  typedef char (&yes_type)[1];
106  typedef char (&no_type)[2];
107 
108  template<typename U> static yes_type RCF_hasRcfClientTypedef(typename U::RcfClientT *);
109  template<typename U> static no_type RCF_hasRcfClientTypedef(...);
110 
111  template<typename T>
112  struct GetRcfClient
113  {
114  typedef typename T::RcfClientT type;
115  };
116 
117  template<typename T>
118  struct Identity
119  {
120  typedef T type;
121  };
122 
123  template<typename T>
124  struct GetInterface
125  {
126  // tried eval_if here, but got some weird errors with vc71
127  typedef typename If<
128  Bool< sizeof(yes_type) == sizeof(RCF_hasRcfClientTypedef<T>(0)) >,
129  GetRcfClient<T>,
130  Identity<T> >::type type0;
131 
132  typedef typename type0::type type;
133  };
134 
135  class default_ { char a[1]; };
136  class defined_ { char a[2]; };
137  template<typename T> class Dummy {};
138 
139 } // namespace RCF
140 
141 #endif // ! INCLUDE_RCF_RCFCLIENT_HPP
Base class of all RcfClient<> templates.
Definition: RcfClient.hpp:45
Represents the binding of a server-side servant object to a RCF interface.
Definition: ServerStub.hpp:326
Controls the client side of a RCF connection.
Definition: ClientStub.hpp:69
std::unique_ptr< ClientTransport > ClientTransportUniquePtr
Unique pointer wrapper for RCF::ClientTransport.
Definition: RcfFwd.hpp:43
std::shared_ptr< ServerBinding > ServerBindingPtr
Reference counted wrapper for RCF::ServerBinding.
Definition: RcfFwd.hpp:246
Base class for all network endpoint types.
Definition: Endpoint.hpp:41
Definition: AmiIoHandler.hpp:24