vrpn 07.35
Virtual Reality Peripheral Network
|
Singleton class that keeps track of all known VRPN connections and makes sure they're deleted on shutdown. More...
#include <vrpn_Connection.h>
Public Member Functions | |
~vrpn_ConnectionManager (void) | |
vrpn_Connection * | getByName (const char *name) |
Searches through d_kcList but NOT d_anonList (Connections constructed with no name) | |
void | addConnection (vrpn_Connection *, const char *name) |
NB implementation is not particularly efficient; we expect to have O(10) connections, not O(1000). | |
void | deleteConnection (vrpn_Connection *) |
Static Public Member Functions | |
static vrpn_ConnectionManager & | instance (void) |
The only way to get access to an instance of this class. Guarantees that there is only one, global object. Also guarantees that it will be constructed the first time this function is called, and (hopefully?) destructed when the program terminates. | |
Singleton class that keeps track of all known VRPN connections and makes sure they're deleted on shutdown.
We make it static to guarantee that the destructor is called on program close so that the destructors of all the vrpn_Connections that have been allocated are called so that all open logs are flushed to disk. Each connection should add itself to this list in its constructor and should remove itself from this list in its destructor.
Definition at line 1136 of file vrpn_Connection.h.
vrpn_ConnectionManager::~vrpn_ConnectionManager | ( | void | ) |
Definition at line 1480 of file vrpn_Connection.C.
References vrpn_Semaphore::p(), and vrpn_Semaphore::v().
void vrpn_ConnectionManager::addConnection | ( | vrpn_Connection * | c, |
const char * | name | ||
) |
NB implementation is not particularly efficient; we expect to have O(10) connections, not O(1000).
Definition at line 1526 of file vrpn_Connection.C.
References vrpn_strcpy().
Referenced by vrpn_Connection_IP::vrpn_Connection_IP(), vrpn_Connection_Loopback::vrpn_Connection_Loopback(), and vrpn_File_Connection::vrpn_File_Connection().
void vrpn_ConnectionManager::deleteConnection | ( | vrpn_Connection * | c | ) |
Definition at line 1548 of file vrpn_Connection.C.
References deleteConnection().
Referenced by deleteConnection(), vrpn_Connection::~vrpn_Connection(), and vrpn_File_Connection::~vrpn_File_Connection().
vrpn_Connection * vrpn_ConnectionManager::getByName | ( | const char * | name | ) |
Searches through d_kcList but NOT d_anonList (Connections constructed with no name)
Definition at line 1583 of file vrpn_Connection.C.
|
static |
The only way to get access to an instance of this class. Guarantees that there is only one, global object. Also guarantees that it will be constructed the first time this function is called, and (hopefully?) destructed when the program terminates.
Definition at line 1514 of file vrpn_Connection.C.
Referenced by vrpn_Connection_IP::vrpn_Connection_IP(), vrpn_Connection_Loopback::vrpn_Connection_Loopback(), vrpn_File_Connection::vrpn_File_Connection(), vrpn_Connection::~vrpn_Connection(), and vrpn_File_Connection::~vrpn_File_Connection().