Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::ConnectionFactory Class Reference
[NetworkNetwork]

Factory for Connections, see. More...

#include <OSGConnectionFactory.h>

List of all members.

Public Member Functions

interface
*GroupConnectioncreateGroup (const std::string &name)
PointConnectioncreatePoint (const std::string &name)
Dump
*void dump (void)

Static Public Member Functions

access
*static ConnectionFactorythe ()

Public Attributes

types
*typedef std::map< std::string,
ConnectionType * > 
TypeMap

Protected Member Functions

Constructors
ConnectionFactory (void)
Destructor
*virtual ~ConnectionFactory (void)
Type information
*void addGroupType (ConnectionType *type)
void addPointType (ConnectionType *type)
void subGroupType (ConnectionType *type)
void subPointType (ConnectionType *type)

Protected Attributes

fields
*TypeMap _groupMap
TypeMap _pointMap

Private Member Functions

 ConnectionFactory (const ConnectionFactory &source)
 prohibit default function (move to 'public' if needed)
void operator= (const ConnectionFactory &source)
 prohibit default function (move to 'public' if needed)

Static Private Attributes

static ConnectionFactory_the = NULL

Friends

class ConnectionType


Detailed Description

The ConnectionFactory knows all types of connections by name. A new connection object could be crated by calling
 Connection *c = ConnectionFactory::the().create("Multicast");
 if(!c)
 {
     SLOG << "Unknown connection:";
 }
 

Each connection type must be registered to the factory. This is done by static initialisation. The following example shows registration of the Multicast connection.

 ConnectionType MulticastConnection::_type(&MulticastConnection::create,
                                             "Multicast");
 

Definition at line 55 of file OSGConnectionFactory.h.


Constructor & Destructor Documentation

ConnectionFactory::ConnectionFactory void   )  [protected]
 

Constructor documentation

Definition at line 84 of file OSGConnectionFactory.cpp.

Referenced by the().

00084                                          :
00085     _groupMap(),
00086     _pointMap()
00087 {
00088 }

ConnectionFactory::~ConnectionFactory void   )  [protected, virtual]
 

Destructor documentation

Definition at line 95 of file OSGConnectionFactory.cpp.

00096 {
00097 }

osg::ConnectionFactory::ConnectionFactory const ConnectionFactory source  )  [private]
 


Member Function Documentation

ConnectionFactory & ConnectionFactory::the void   )  [static]
 

get singelton factory

Definition at line 126 of file OSGConnectionFactory.cpp.

References _the, and ConnectionFactory().

Referenced by osg::ClusterServer::acceptClient(), osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), osg::ConnectionType::ConnectionType(), osg::ClusterWindow::init(), and osg::ConnectionType::~ConnectionType().

00127 {
00128     if(_the == NULL)
00129         _the=new ConnectionFactory();
00130     return *_the;
00131 }

GroupConnection * ConnectionFactory::createGroup const std::string &  name  ) 
 

create group connection by name

Definition at line 104 of file OSGConnectionFactory.cpp.

References _groupMap.

Referenced by osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), and osg::ClusterWindow::init().

00105 {
00106     TypeMap::iterator i=_groupMap.find(name);
00107     if(i == _groupMap.end())
00108         return NULL;
00109     else
00110         return i->second->createGroup();
00111 }

PointConnection * ConnectionFactory::createPoint const std::string &  name  ) 
 

create point connection by name

Definition at line 115 of file OSGConnectionFactory.cpp.

References _pointMap.

Referenced by osg::ClusterNetwork::connectAllGroupToPoint(), and osg::ClusterNetwork::connectAllPointToPoint().

00116 {
00117     TypeMap::iterator i=_pointMap.find(name);
00118     if(i == _pointMap.end())
00119         return NULL;
00120     else
00121         return i->second->createPoint();
00122 }

* void osg::ConnectionFactory::dump void   ) 
 

void ConnectionFactory::addGroupType ConnectionType type  )  [protected]
 

add new group type

Definition at line 138 of file OSGConnectionFactory.cpp.

References _groupMap, osg::ConnectionType::getName(), and SINFO.

Referenced by osg::ConnectionType::ConnectionType().

00139 {
00140     _groupMap[type->getName()]=type;
00141     SINFO << "Group Connection type " << type->getName() << " added" << std::endl;
00142 }

void ConnectionFactory::addPointType ConnectionType type  )  [protected]
 

add new point type

Definition at line 146 of file OSGConnectionFactory.cpp.

References _pointMap, osg::ConnectionType::getName(), and SINFO.

Referenced by osg::ConnectionType::ConnectionType().

00147 {
00148     _pointMap[type->getName()]=type;
00149     SINFO << "Point Connection type " << type->getName() << " added" << std::endl;
00150 }

void ConnectionFactory::subGroupType ConnectionType type  )  [protected]
 

remove group type

Definition at line 165 of file OSGConnectionFactory.cpp.

References _groupMap, osg::ConnectionType::getName(), and SINFO.

Referenced by osg::ConnectionType::~ConnectionType().

00166 {
00167     TypeMap::iterator i=_groupMap.find(type->getName());
00168     if(i != _groupMap.end() && i->second == type)
00169         _groupMap.erase(i);
00170     SINFO << "Group connection type " << type->getName() 
00171           << " removed" << std::endl;
00172 }

void ConnectionFactory::subPointType ConnectionType type  )  [protected]
 

remove point type

Definition at line 154 of file OSGConnectionFactory.cpp.

References _pointMap, osg::ConnectionType::getName(), and SINFO.

Referenced by osg::ConnectionType::~ConnectionType().

00155 {
00156     TypeMap::iterator i=_pointMap.find(type->getName());
00157     if(i != _pointMap.end() && i->second == type)
00158         _pointMap.erase(i);
00159     SINFO << "Point connection type " << type->getName() 
00160           << " removed" << std::endl;
00161 }

void osg::ConnectionFactory::operator= const ConnectionFactory source  )  [private]
 


Friends And Related Function Documentation

friend class ConnectionType [friend]
 

Definition at line 134 of file OSGConnectionFactory.h.


Member Data Documentation

* typedef std::map<std::string,ConnectionType *> osg::ConnectionFactory::TypeMap
 

Definition at line 64 of file OSGConnectionFactory.h.

* TypeMap osg::ConnectionFactory::_groupMap [protected]
 

Definition at line 96 of file OSGConnectionFactory.h.

Referenced by addGroupType(), createGroup(), and subGroupType().

TypeMap osg::ConnectionFactory::_pointMap [protected]
 

Definition at line 97 of file OSGConnectionFactory.h.

Referenced by addPointType(), createPoint(), and subPointType().

ConnectionFactory * ConnectionFactory::_the = NULL [static, private]
 

Definition at line 54 of file OSGConnectionFactory.cpp.

Referenced by the().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:12:51 2005 for OpenSG by  doxygen 1.4.3