Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
igtl::ClientSocket Class Reference

#include <igtlClientSocket.h>

Inheritance diagram for igtl::ClientSocket:
Inheritance graph
[legend]
Collaboration diagram for igtl::ClientSocket:
Collaboration graph
[legend]

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef ClientSocket Self
 
typedef Socket Superclass
 

Public Member Functions

void CloseSocket ()
 
int ConnectToServer (const char *hostname, int port)
 
virtual LightObject::Pointer CreateAnother () const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
virtual void Delete ()
 
int GetConnected ()
 
bool GetDebug () const
 
virtual const char * GetNameOfClass () const
 
virtual int GetReferenceCount () const
 
int GetSocketAddressAndPort (std::string &address, int &port)
 
 igtlNewMacro (igtl::ClientSocket)
 
 igtlNewMacro (igtl::Socket)
 
 igtlTypeMacro (Object, LightObject)
 
void Print (std::ostream &os) const
 
int Receive (void *data, int length, int readFully=1)
 
virtual void Register () const
 
int Send (const void *data, int length)
 
void SetDebug (bool debugFlag) const
 
int SetReceiveBlocking (int sw)
 
int SetReceiveTimeout (int timeout)
 
virtual void SetReferenceCount (int)
 
int SetSendBlocking (int sw)
 
int SetSendTimeout (int timeout)
 
int SetTimeout (int timeout)
 
int Skip (int length, int skipFully=1)
 
virtual void UnRegister () const
 

Static Public Member Functions

static void BreakOnError ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 

Protected Member Functions

int Accept (int socketdescriptor)
 
int BindSocket (int socketdescriptor, int port)
 
 ClientSocket ()
 
void CloseSocket (int socketdescriptor)
 
int Connect (int socketdescriptor, const char *hostname, int port)
 
int CreateSocket ()
 
int GetPort (int socketdescriptor)
 
 igtlGetMacro (SocketDescriptor, int)
 
int Listen (int socketdescriptor)
 
void PrintSelf (std::ostream &os) const
 
int SelectSocket (int socketdescriptor, unsigned long msec)
 
 ~ClientSocket ()
 
virtual void PrintHeader (std::ostream &os) const
 
virtual void PrintTrailer (std::ostream &os) const
 

Static Protected Member Functions

static int SelectSockets (const int *sockets_to_select, int size, unsigned long msec, int *selected_index)
 

Protected Attributes

volatile int m_ReferenceCount
 
SimpleFastMutexLock m_ReferenceCountLock
 
int m_SocketDescriptor
 

Friends

class ServerSocket
 

Detailed Description

Definition at line 41 of file igtlClientSocket.h.

Member Typedef Documentation

Definition at line 47 of file igtlClientSocket.h.

Definition at line 46 of file igtlClientSocket.h.

Definition at line 44 of file igtlClientSocket.h.

Definition at line 45 of file igtlClientSocket.h.

Constructor & Destructor Documentation

igtl::ClientSocket::ClientSocket ( )
protected
igtl::ClientSocket::~ClientSocket ( )
protected

Member Function Documentation

int igtl::Socket::Accept ( int  socketdescriptor)
protectedinherited

Accept a connection on a socket. Returns -1 on error. Otherwise the descriptor of the accepted socket.

int igtl::Socket::BindSocket ( int  socketdescriptor,
int  port 
)
protectedinherited

Binds socket to a particular port. Returns 0 on success other -1 is returned.

static void igtl::LightObject::BreakOnError ( )
staticinherited

This method is called when igtlExceptionMacro executes. It allows the debugger to break on error.

void igtl::Socket::CloseSocket ( )
inlineinherited

Close the socket.

Definition at line 78 of file igtlSocket.h.

void igtl::Socket::CloseSocket ( int  socketdescriptor)
protectedinherited

Close the socket.

int igtl::Socket::Connect ( int  socketdescriptor,
const char *  hostname,
int  port 
)
protectedinherited

Connect to a server socket. Returns 0 on success, -1 on error.

int igtl::ClientSocket::ConnectToServer ( const char *  hostname,
int  port 
)

Connects to host. Returns 0 on success, -1 on error.

virtual LightObject::Pointer igtl::Object::CreateAnother ( ) const
virtualinherited

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from igtl::LightObject.

int igtl::Socket::CreateSocket ( )
protectedinherited

Creates an endpoint for communication and returns the descriptor. -1 indicates error.

virtual void igtl::Object::DebugOff ( ) const
virtualinherited

Turn debugging output off.

virtual void igtl::Object::DebugOn ( ) const
virtualinherited

Turn debugging output on.

virtual void igtl::LightObject::Delete ( )
virtualinherited

Delete an igtl object. This method should always be used to delete an object when the new operator was used to create it. Using the C delete method will not work with reference counting.

int igtl::Socket::GetConnected ( )
inlineinherited

Check is the socket is alive.

Definition at line 75 of file igtlSocket.h.

bool igtl::Object::GetDebug ( ) const
inherited

Get the value of the debug flag.

static bool igtl::Object::GetGlobalWarningDisplay ( )
staticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

virtual const char* igtl::LightObject::GetNameOfClass ( ) const
inlinevirtualinherited

Return the name of this class as a string. Used by the object factory (implemented in New()) to instantiate objects of a named type. Also used for debugging and other output information.

Definition at line 84 of file igtlLightObject.h.

int igtl::Socket::GetPort ( int  socketdescriptor)
protectedinherited

Returns the port to which the socket is connected. 0 on error.

virtual int igtl::LightObject::GetReferenceCount ( ) const
inlinevirtualinherited

Gets the reference count on this object.

Definition at line 110 of file igtlLightObject.h.

int igtl::Socket::GetSocketAddressAndPort ( std::string &  address,
int &  port 
)
inherited

Get socket address.

static void igtl::Object::GlobalWarningDisplayOff ( )
inlinestaticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

Definition at line 116 of file igtlObject.h.

References igtl::Object::SetGlobalWarningDisplay().

static void igtl::Object::GlobalWarningDisplayOn ( )
inlinestaticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

Definition at line 114 of file igtlObject.h.

References igtl::Object::SetGlobalWarningDisplay().

igtl::Socket::igtlGetMacro ( SocketDescriptor  ,
int   
)
protectedinherited
igtl::ClientSocket::igtlNewMacro ( igtl::ClientSocket  )
igtl::Socket::igtlNewMacro ( igtl::Socket  )
inherited
igtl::Object::igtlTypeMacro ( Object  ,
LightObject   
)
inherited

Standard part of all igtl objects.

int igtl::Socket::Listen ( int  socketdescriptor)
protectedinherited

Listen for connections on a socket. Returns 0 on success. -1 on error.

static Pointer igtl::Object::New ( )
staticinherited

Method for creation through the object factory.

void igtl::LightObject::Print ( std::ostream &  os) const
inherited

Cause the object to print itself out.

virtual void igtl::LightObject::PrintHeader ( std::ostream &  os) const
protectedvirtualinherited

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

void igtl::ClientSocket::PrintSelf ( std::ostream &  os) const
protectedvirtual

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from igtl::Object.

virtual void igtl::LightObject::PrintTrailer ( std::ostream &  os) const
protectedvirtualinherited

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

int igtl::Socket::Receive ( void *  data,
int  length,
int  readFully = 1 
)
inherited

Receive data from the socket. This call blocks until some data is read from the socket, unless timeout is set by SetTimeout() or SetReceiveTimeout(). When the readFully flag is set, this call will block until all the requested data is read from the socket. The readFully flag will be ignored if the timeout is active. 0 on error, -1 on timeout, else number of bytes read is returned.

virtual void igtl::Object::Register ( ) const
virtualinherited

Return this objects modified time. Update the modification time for this object. Many filters rely on the modification time to determine if they need to recompute their data. Increase the reference count (mark as used by another object).

Reimplemented from igtl::LightObject.

int igtl::Socket::SelectSocket ( int  socketdescriptor,
unsigned long  msec 
)
protectedinherited

Selects a socket ie. waits for it to change status. Returns 1 on success; 0 on timeout; -1 on error. msec=0 implies no timeout.

static int igtl::Socket::SelectSockets ( const int *  sockets_to_select,
int  size,
unsigned long  msec,
int *  selected_index 
)
staticprotectedinherited

Selects set of sockets. Returns 0 on timeout, -1 on error. 1 on success. Selected socket's index is returned thru selected_index

int igtl::Socket::Send ( const void *  data,
int  length 
)
inherited

These methods send data over the socket. Returns 1 on success, 0 on error and raises vtkCommand::ErrorEvent.

void igtl::Object::SetDebug ( bool  debugFlag) const
inherited

Set the value of the debug flag. A non-zero value turns debugging on.

static void igtl::Object::SetGlobalWarningDisplay ( bool  flag)
staticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

Referenced by igtl::Object::GlobalWarningDisplayOff(), and igtl::Object::GlobalWarningDisplayOn().

int igtl::Socket::SetReceiveBlocking ( int  sw)
inherited

Set (psuedo) non-blocking mode for recv(). When sw=1, the time out is set to minimum value (1 microsecond in UNIX, 1 millisecond in Windows) for receiving.

int igtl::Socket::SetReceiveTimeout ( int  timeout)
inherited

Set reciving timeout for the existing socket in millisecond. This function should be called after opening the socket.

virtual void igtl::Object::SetReferenceCount ( int  )
virtualinherited

Sets the reference count (use with care)

Reimplemented from igtl::LightObject.

int igtl::Socket::SetSendBlocking ( int  sw)
inherited

Set (psuedo) non-blocking mode for recv(). When sw=1, the time out is set to minimum value (1 microsecond in UNIX, 1 millisecond in Windows) for sending.

int igtl::Socket::SetSendTimeout ( int  timeout)
inherited

Set sending timeout for the existing socket in millisecond. This function should be called after opening the socket.

int igtl::Socket::SetTimeout ( int  timeout)
inherited

Set sending/receiving timeout for the existing socket in millisecond. This function should be called after opening the socket.

int igtl::Socket::Skip ( int  length,
int  skipFully = 1 
)
inherited

Skip reading data from the socket. The Skip() call has been newly introduced to the igtlSocket, after the class is imported from VTK, thus the call is not available in vtkSocket class.

virtual void igtl::Object::UnRegister ( ) const
virtualinherited

Decrease the reference count (release by another object).

Reimplemented from igtl::LightObject.

Friends And Related Function Documentation

friend class ServerSocket
friend

Definition at line 61 of file igtlClientSocket.h.

Member Data Documentation

volatile int igtl::LightObject::m_ReferenceCount
mutableprotectedinherited

Number of uses of this object by other objects.

Definition at line 131 of file igtlLightObject.h.

SimpleFastMutexLock igtl::LightObject::m_ReferenceCountLock
mutableprotectedinherited

Mutex lock to protect modification to the reference count

Definition at line 134 of file igtlLightObject.h.

int igtl::Socket::m_SocketDescriptor
protectedinherited

Definition at line 130 of file igtlSocket.h.


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

Generated at Wed Dec 4 2013 11:11:31 for OpenIGTLink by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2012