Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlSessionManager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: OpenIGTLink Library
4  Module: git@github.com:openigtlink/OpenIGTLink.git
5  Language: C++
6 
7  Copyright (c) Insight Software Consortium. All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 =========================================================================*/
14 
15 #ifndef __igtlSessionManager_h
16 #define __igtlSessionManager_h
17 
18 #include "igtlObject.h"
19 #include "igtlMacro.h"
20 #include "igtlMessageHandler.h"
21 
22 
23 #include <vector>
24 
25 namespace igtl
26 {
27 
29 {
30  public:
31 
33  typedef Object Superclass;
36 
39 
40  public:
41  enum {
43  MODE_CLIENT
44  };
45 
46  void SetHostname(const char * str) {this->m_Hostname = str; this->m_ConfigurationUpdated = true; }
47  const char * GetHostname() { return this->m_Hostname.c_str(); }
48  void SetPort(int p) { this->m_Port = p; this->m_ConfigurationUpdated = true; }
49  int GetPort() { return this->m_Port; }
50 
51  // Description:
52  // Set the role of session manager. Either MODE_SERVER or MODE_CLIENT
53  void SetMode(int m) {this->m_Mode = m; this->m_ConfigurationUpdated = true; }
54  int GetMode() {return this->m_Mode; }
55 
56  // Description:
57  // Register / Unregister a message handler
58  int AddMessageHandler(MessageHandler*);
59  int RemoveMessageHandler(MessageHandler*);
60 
61  // Description:
62  // Functions to manage the session
63  int Connect();
64  int Disconnect();
65  int ProcessMessage();
66  int PushMessage(MessageBase*);
67 
68  protected:
70  ~SessionManager();
71 
72  protected:
74  std::string m_Hostname;
75  int m_Port;
76  int m_Mode;
77 
78  // Description:
79  // m_CurrentReadIndex is used to save the current position of the message.
80  // The index becomes >0 when message transfer is interrupted and only a part
81  // of message has arrived.
84 
86 
87  std::vector< MessageHandler* > m_MessageHandlerList;
89 
90  igtl::MessageHeader::Pointer m_Header;
92 
93 };
94 
95 }
96 #endif // __igtlSessionManager_h
igtl::MessageHandler
Definition: igtlMessageHandler.h:26
igtl::SessionManager::m_TimeStamp
igtl::TimeStamp::Pointer m_TimeStamp
Definition: igtlSessionManager.h:91
igtlMacro.h
igtl::SessionManager::MODE_SERVER
@ MODE_SERVER
Definition: igtlSessionManager.h:42
igtlNewMacro
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
igtl::SessionManager::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlSessionManager.h:35
igtlMessageHandler.h
igtl::SessionManager::SetPort
void SetPort(int p)
Definition: igtlSessionManager.h:48
igtl::SessionManager::m_Header
igtl::MessageHeader::Pointer m_Header
Definition: igtlSessionManager.h:90
igtl::SessionManager::GetPort
int GetPort()
Definition: igtlSessionManager.h:49
igtl::SessionManager::SetMode
void SetMode(int m)
Definition: igtlSessionManager.h:53
igtl::MessageBase
Definition: igtlMessageBase.h:55
igtl::Object
Base class for most igtl classes.
Definition: igtlObject.h:60
igtl
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
Definition: igtlBindMessage.h:25
IGTLCommon_EXPORT
#define IGTLCommon_EXPORT
Definition: igtlWin32Header.h:151
igtl::SessionManager::m_Mode
int m_Mode
Definition: igtlSessionManager.h:76
igtl::SessionManager::GetHostname
const char * GetHostname()
Definition: igtlSessionManager.h:47
igtl::SessionManager::GetMode
int GetMode()
Definition: igtlSessionManager.h:54
igtl::SessionManager::m_MessageHandlerList
std::vector< MessageHandler * > m_MessageHandlerList
Definition: igtlSessionManager.h:87
igtl::SessionManager::SetHostname
void SetHostname(const char *str)
Definition: igtlSessionManager.h:46
igtl::SessionManager::m_HeaderDeserialized
int m_HeaderDeserialized
Definition: igtlSessionManager.h:83
igtl::SessionManager::m_CurrentMessageHandler
MessageHandler * m_CurrentMessageHandler
Definition: igtlSessionManager.h:85
igtl::SessionManager::m_ConfigurationUpdated
bool m_ConfigurationUpdated
Definition: igtlSessionManager.h:73
igtl::SessionManager::Superclass
Object Superclass
Definition: igtlSessionManager.h:33
igtl::SessionManager::Self
SessionManager Self
Definition: igtlSessionManager.h:32
igtl::SessionManager
Definition: igtlSessionManager.h:28
igtl::SessionManager::m_Socket
Socket::Pointer m_Socket
Definition: igtlSessionManager.h:88
igtl::SmartPointer< Self >
igtlTypeMacro
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
igtlObject.h
igtl::SessionManager::Pointer
SmartPointer< Self > Pointer
Definition: igtlSessionManager.h:34
igtl::SessionManager::m_CurrentReadIndex
int m_CurrentReadIndex
Definition: igtlSessionManager.h:82
igtl::SessionManager::m_Port
int m_Port
Definition: igtlSessionManager.h:75
igtl::SessionManager::m_Hostname
std::string m_Hostname
Definition: igtlSessionManager.h:74

Generated for OpenIGTLink by Doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2012