vrpn  07.33
Virtual Reality Peripheral Network
vrpn_ConnectionPtr Class Reference

A shared pointer class for holding on to vrpn_Connection instances, using the existing "intrusive reference counting" automatically. More...

#include <vrpn_ConnectionPtr.h>

Public Member Functions

 vrpn_ConnectionPtr (vrpn_Connection *c=NULL)
 Explicit constructor from a non-smart connection pointer. More...
 
 vrpn_ConnectionPtr (vrpn_ConnectionPtr const &other)
 Copy constructor from smart pointer. More...
 
vrpn_ConnectionPtroperator= (vrpn_ConnectionPtr const &other)
 Assignment operator from smart pointer. More...
 
vrpn_ConnectionPtroperator= (vrpn_Connection *other)
 Assignment operator from non-smart pointer. More...
 
 ~vrpn_ConnectionPtr ()
 Destructor - decrements the contained reference count, if applicable. More...
 
void reset ()
 Clears the contained pointer and decrements the reference count, if applicable. More...
 
vrpn_Connectionget () const
 Gets the contained "non-smart" pointer. You are responsible for calling vrpn_Connection::addReference() if you want to affect connection lifetime with this pointer! (Included VRPN devices take care of this by default) More...
 
bool operator! () const
 
Smart Pointer operators
vrpn_Connectionoperator* ()
 
vrpn_Connection const & operator* () const
 
vrpn_Connectionoperator-> ()
 
vrpn_Connection const * operator-> () const
 

Static Public Member Functions

Connection creation functions

Use these function, rather than initializing a vrpn_ConnectionPtr with results of vrpn_create_server_connection() - this will correctly handle the default reference added by the vrpn_create_server_connection() function. Identical signatures are provided for your convenience

static vrpn_ConnectionPtr create_server_connection (int port=vrpn_DEFAULT_LISTEN_PORT_NO, const char *local_in_logfile_name=NULL, const char *local_out_logfile_name=NULL, const char *NIC_NAME=NULL)
 
static vrpn_ConnectionPtr create_server_connection (const char *cname, const char *local_in_logfile_name=NULL, const char *local_out_logfile_name=NULL)
 

Related Functions

(Note that these are not member functions.)

bool operator== (const vrpn_ConnectionPtr &lhs, const vrpn_ConnectionPtr &rhs)
 Equality operator for connection smart pointers. More...
 
bool operator!= (const vrpn_ConnectionPtr &lhs, const vrpn_ConnectionPtr &rhs)
 Inequality operator for connection smart pointers. More...
 

Safe Bool Idiom

typedef vrpn_Connection *vrpn_ConnectionPtr::* unspecified_bool_type
 
 operator unspecified_bool_type () const
 

Detailed Description

A shared pointer class for holding on to vrpn_Connection instances, using the existing "intrusive reference counting" automatically.

Definition at line 34 of file vrpn_ConnectionPtr.h.

Member Typedef Documentation

◆ unspecified_bool_type

Definition at line 120 of file vrpn_ConnectionPtr.h.

Constructor & Destructor Documentation

◆ vrpn_ConnectionPtr() [1/2]

vrpn_ConnectionPtr::vrpn_ConnectionPtr ( vrpn_Connection c = NULL)
inlineexplicit

Explicit constructor from a non-smart connection pointer.

Definition at line 37 of file vrpn_ConnectionPtr.h.

References vrpn_Connection::addReference().

Referenced by create_server_connection().

Here is the call graph for this function:

◆ vrpn_ConnectionPtr() [2/2]

vrpn_ConnectionPtr::vrpn_ConnectionPtr ( vrpn_ConnectionPtr const &  other)
inline

Copy constructor from smart pointer.

Definition at line 46 of file vrpn_ConnectionPtr.h.

References vrpn_Connection::addReference().

Here is the call graph for this function:

◆ ~vrpn_ConnectionPtr()

vrpn_ConnectionPtr::~vrpn_ConnectionPtr ( )
inline

Destructor - decrements the contained reference count, if applicable.

Definition at line 87 of file vrpn_ConnectionPtr.h.

References reset().

Here is the call graph for this function:

Member Function Documentation

◆ create_server_connection() [1/2]

static vrpn_ConnectionPtr vrpn_ConnectionPtr::create_server_connection ( const char *  cname,
const char *  local_in_logfile_name = NULL,
const char *  local_out_logfile_name = NULL 
)
inlinestatic

Definition at line 146 of file vrpn_ConnectionPtr.h.

References vrpn_ConnectionPtr(), and vrpn_create_server_connection().

Here is the call graph for this function:

◆ create_server_connection() [2/2]

static vrpn_ConnectionPtr vrpn_ConnectionPtr::create_server_connection ( int  port = vrpn_DEFAULT_LISTEN_PORT_NO,
const char *  local_in_logfile_name = NULL,
const char *  local_out_logfile_name = NULL,
const char *  NIC_NAME = NULL 
)
inlinestatic

Definition at line 134 of file vrpn_ConnectionPtr.h.

References vrpn_ConnectionPtr(), and vrpn_create_server_connection().

Here is the call graph for this function:

◆ get()

vrpn_Connection* vrpn_ConnectionPtr::get ( ) const
inline

Gets the contained "non-smart" pointer. You are responsible for calling vrpn_Connection::addReference() if you want to affect connection lifetime with this pointer! (Included VRPN devices take care of this by default)

Definition at line 103 of file vrpn_ConnectionPtr.h.

Referenced by operator!=(), and operator==().

◆ operator unspecified_bool_type()

vrpn_ConnectionPtr::operator unspecified_bool_type ( ) const
inline

Definition at line 121 of file vrpn_ConnectionPtr.h.

◆ operator!()

bool vrpn_ConnectionPtr::operator! ( ) const
inline

Definition at line 116 of file vrpn_ConnectionPtr.h.

◆ operator*() [1/2]

vrpn_Connection& vrpn_ConnectionPtr::operator* ( )
inline

Definition at line 107 of file vrpn_ConnectionPtr.h.

◆ operator*() [2/2]

vrpn_Connection const& vrpn_ConnectionPtr::operator* ( ) const
inline

Definition at line 109 of file vrpn_ConnectionPtr.h.

◆ operator->() [1/2]

vrpn_Connection* vrpn_ConnectionPtr::operator-> ( )
inline

Definition at line 111 of file vrpn_ConnectionPtr.h.

◆ operator->() [2/2]

vrpn_Connection const* vrpn_ConnectionPtr::operator-> ( ) const
inline

Definition at line 113 of file vrpn_ConnectionPtr.h.

◆ operator=() [1/2]

vrpn_ConnectionPtr& vrpn_ConnectionPtr::operator= ( vrpn_Connection other)
inline

Assignment operator from non-smart pointer.

self-assignment is a no-op

Definition at line 71 of file vrpn_ConnectionPtr.h.

References vrpn_Connection::addReference(), and reset().

Here is the call graph for this function:

◆ operator=() [2/2]

vrpn_ConnectionPtr& vrpn_ConnectionPtr::operator= ( vrpn_ConnectionPtr const &  other)
inline

Assignment operator from smart pointer.

self-assignment is a no-op

Definition at line 55 of file vrpn_ConnectionPtr.h.

References vrpn_Connection::addReference(), and reset().

Here is the call graph for this function:

◆ reset()

void vrpn_ConnectionPtr::reset ( void  )
inline

Clears the contained pointer and decrements the reference count, if applicable.

Definition at line 91 of file vrpn_ConnectionPtr.h.

References vrpn_Connection::removeReference().

Referenced by operator=(), and ~vrpn_ConnectionPtr().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=()

bool operator!= ( const vrpn_ConnectionPtr lhs,
const vrpn_ConnectionPtr rhs 
)
related

Inequality operator for connection smart pointers.

Definition at line 186 of file vrpn_ConnectionPtr.h.

References get().

Here is the call graph for this function:

◆ operator==()

bool operator== ( const vrpn_ConnectionPtr lhs,
const vrpn_ConnectionPtr rhs 
)
related

Equality operator for connection smart pointers.

Definition at line 178 of file vrpn_ConnectionPtr.h.

References get().

Here is the call graph for this function:

The documentation for this class was generated from the following file: