//****************************************************************************** // RCF - Remote Call Framework // Copyright (c) 2005 - 2007. All rights reserved. // Consult your license for conditions of use. // Developed by Jarl Lindrud. // Contact: jlindrud@hotmail.com . //****************************************************************************** #ifndef INCLUDE_RCF_RCFCLIENT_HPP #define INCLUDE_RCF_RCFCLIENT_HPP #include #include #include #include #include namespace RCF { class ClientStub; class ServerStub; /// Base class of all RcfClient<> templates. class I_RcfClient { public: /// Virtual destructor. virtual ~I_RcfClient() {} /// Returns a reference to the contained client stub, if one is available, i.e. if the RcfClient<> template is configured as a client stub. virtual ClientStub &getClientStub() = 0; /// Returns a reference to the contained server stub, if one is available, i.e. if the RcfClient<> template is configured as a server stub. virtual ServerStub &getServerStub() = 0; }; typedef boost::shared_ptr RcfClientPtr; // some meta-programming functionality needed by the macros in IDL.hpp #if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER == 1200) template struct GetInterface { typedef typename T::RcfClient type; }; #else typedef char (&yes_type)[1]; typedef char (&no_type)[2]; template static yes_type RCF_hasRcfClientTypedef(typename U::RcfClient *); template static no_type RCF_hasRcfClientTypedef(...); template struct GetRcfClient { typedef typename T::RcfClient type; }; template struct Identity { typedef T type; }; template struct GetInterface { // tried eval_if here, but got some weird errors with vc71 typedef typename boost::mpl::if_c< sizeof(yes_type) == sizeof(RCF_hasRcfClientTypedef(0)), GetRcfClient, Identity >::type type0; typedef typename type0::type type; }; #endif // for broken compilers #define RCF_NON_RCF_PARENT_INTERFACE(interface) \ namespace RCF { \ template<> \ struct GetInterface \ { \ typedef interface type; \ }; \ } class default_ { char a[1]; }; class defined_ { char a[2]; }; template class Dummy {}; } // namespace RCF #endif // ! INCLUDE_RCF_RCFCLIENT_HPP