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
MessageHandler * m_CurrentMessageHandler
std::vector< MessageHandler *> m_MessageHandlerList
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
const char * GetHostname()
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
void SetHostname(const char *str)
#define IGTLCommon_EXPORT
igtl::MessageHeader::Pointer m_Header
Socket::Pointer m_Socket
SmartPointer< Self > Pointer
igtl::TimeStamp::Pointer m_TimeStamp
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
Base class for most igtl classes.
Definition: igtlObject.h:60
SmartPointer< const Self > ConstPointer

Generated at Sat Apr 15 2017 02:30:07 for OpenIGTLink by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2012