Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWSockAddrFactory


RWSockAddrFactoryRWSockAddrFactoryBaseRWSockAddrBase

Module

Networking Tools: Network Communication Classes (net library)

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Member Functions

Synopsis

#include <rw/toolpro/sockfact.h>

Required Libraries

net, tls (and possibly std)

Description

RWSockAddrFactory builds addresses of any (registered) type. This class is used by the network communication classes implementation and is not normally used explicitly. The global object rwSockAddrFactory is used by functions like RWSocket::getsockname, which do not know the type of socket address they need to build.

There are two stages to building an address using this factory. First, the type of address is determined. Next, the type of address is used to look up an RWSockAddrFactoryBase object, which is used to actually construct the address. Note that since an RWSockAddrFactory is itself an RWSockAddrFactoryBase, this scheme can be used in a hierarchical fashion.

The types are indicated to the factory by either the address family integer identifier (as defined by the C sockets API) or by a string. From there, the factory invokes a factory that is specific to the address family. It finds the specific factory using a dictionary kept with the factory.

Specific address factory objects need to be registered with the factory via the general factory's register() method. Check RWInetAddrFactory for an example of a specific address family factory.

These singleton objects are constructed explicitly rather than relying on static initialization. This way we have no dependence on order of static initialization.

Public Constructors

RWSockAddrFactory();

Public Member Functions

void 
registerWithFactory(const RWSockType& family, 
                    RWSockAddrFactoryBase *factory);
void 
registerWithFactory(int family, 
                    RWSockAddrFactoryBase *factory);
void 
registerWithFactory(const RWCString& family, 
                    RWSockAddrFactoryBase *factory);
void 
unRegister(const RWSockType&);
void 
unRegister(int family);
void 
unRegister(const RWCString& family);

Public Member Operators

virtual RWSockAddrBase* 
operator()(struct sockaddr *addr, int addrLen) const;
virtual RWSockAddrBase* 
operator()(struct sockaddr *addr, int addrLen, int type) 
           const;
virtual RWSockAddrBase* 
operator()(const RWCString& str) const;

Static Member Function

static RWGenSockAddrFactory& 
theGlobalRWSockAddrFactory();


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.