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
25namespace igtl
26{
27
29{
30 public:
31
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
60
61 // Description:
62 // Functions to manage the session
63 int Connect();
67
68 protected:
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
Base class for most igtl classes.
Definition igtlObject.h:61
SmartPointer< Self > Pointer
void SetHostname(const char *str)
igtlTypeMacro(SessionManager, Object) igtlNewMacro(SessionManager)
MessageHandler * m_CurrentMessageHandler
igtl::MessageHeader::Pointer m_Header
igtl::TimeStamp::Pointer m_TimeStamp
std::vector< MessageHandler * > m_MessageHandlerList
int AddMessageHandler(MessageHandler *)
int PushMessage(MessageBase *)
SmartPointer< const Self > ConstPointer
int RemoveMessageHandler(MessageHandler *)
Implements transparent reference counting.
#define igtlNewMacro(x)
Definition igtlMacro.h:431
#define IGTLCommon_EXPORT
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...

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