00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 13129 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "mitkSocketClient.h" 00019 #include <itkObjectFactory.h> 00020 #include <itkOutputWindow.h> 00021 #include <itkCommand.h> 00022 00023 namespace mitk 00024 { 00025 00026 SocketClientImplementation* SocketClient::m_Implementation = NULL; 00027 SocketClient* SocketClient::m_Instance = NULL; 00028 00029 void SocketClient::open( const char* ipAdress, unsigned short port ) 00030 { 00031 if (m_Implementation) 00032 { 00033 m_Implementation->open( ipAdress, port ); 00034 } 00035 } 00036 00037 void SocketClient::setMaxConnectionAdvance( int maxConnectionAdvance ) 00038 { 00039 if (m_Implementation) 00040 { 00041 m_Implementation->setMaxConnectionAdvance( maxConnectionAdvance ); 00042 } 00043 } 00044 00045 bool SocketClient::send( unsigned int messagetype, unsigned int bodySize, char* body ) 00046 { 00047 if (m_Implementation) 00048 { 00049 return m_Implementation->send( messagetype, bodySize, body); 00050 } 00051 else 00052 { 00053 return false; 00054 } 00055 } 00056 00057 void SocketClient::SetImplementationInstance(SocketClientImplementation* implementation) 00058 { 00059 if ( m_Implementation == implementation ) 00060 { 00061 return; 00062 } 00063 m_Implementation = implementation; 00064 } 00065 00066 SocketClient* SocketClient::GetInstance() 00067 { 00068 if (m_Instance == NULL) 00069 { 00070 m_Instance = new SocketClient(); 00071 } 00072 00073 return m_Instance; 00074 } 00075 00076 SocketClient::SocketClient() 00077 { 00078 } 00079 00080 SocketClient::~SocketClient() 00081 { 00082 } 00083 }//end namespace mitk