//***************************************************************************** // 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 _RCF_ENDPOINTPAIRFACTORY_HPP_ #define _RCF_ENDPOINTPAIRFACTORY_HPP_ #include #include #include #include namespace RCF { typedef std::pair< boost::shared_ptr, boost::shared_ptr > EndpointPair; class I_EndpointPairFactory { public: virtual ~I_EndpointPairFactory() {} virtual EndpointPair createEndpointPair() = 0; }; typedef boost::shared_ptr EndpointPairFactoryPtr; class TcpEndpointFactory : public I_EndpointPairFactory { public: EndpointPair createEndpointPair() { int port = util::Ports::getNext(); return EndpointPair( boost::shared_ptr(new TcpEndpoint(port)), boost::shared_ptr(new TcpEndpoint("localhost", port))); } }; class UdpEndpointFactory : public I_EndpointPairFactory { public: EndpointPair createEndpointPair() { int port = util::Ports::getNext(); return EndpointPair( boost::shared_ptr(new UdpEndpoint(port)), boost::shared_ptr(new UdpEndpoint("127.0.0.1", port))); } }; extern std::vector< boost::shared_ptr > endpointPairFactories; } // namespace RCF #endif // ! _RCF_ENDPOINTPAIRFACTORY_HPP_