cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsComponentViewer.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Peter Kazanzides
7  Created on: 2010-09-07
8 
9  (C) Copyright 2010-2011 Johns Hopkins University (JHU), All Rights Reserved.
10 
11 --- begin cisst license - do not edit ---
12 
13 This software is provided "as is" under an open source license, with
14 no warranty. The complete license can be found in license.txt and
15 http://www.cisst.org/cisst/license.txt.
16 
17 --- end cisst license ---
18 */
19 
26 #ifndef _mtsComponentViewer_h
27 #define _mtsComponentViewer_h
28 
29 
36 
37 // Always include last!
39 
41 {
43 
44 private:
45 
46  // Utility method that sends the whole string except the '\0'
47  void WriteString(osaPipeExec & pipe, const std::string & s, double timeoutInSec = 0.1);
48 
49 protected:
50 
53  std::string UDrawResponse;
55 
58 
59  // Use a separate reader thread because osaPipeExec::Read is blocking.
60  // This could be eliminated if a non-blocking Read is implemented.
63  void *ReadFromUDrawGraph(int);
66  static void ParseArgs(const std::string &input, std::string &arg1, std::string &arg2);
67  static bool ParseProcessAndComponent(const std::string &input, std::string &processName,
68  std::string &componentName);
69  virtual void ProcessResponse(void);
70 
71  bool ConnectToUDrawGraph(void);
72 
73  virtual void SendAllInfo(void);
74  void ActivateMenuItems(void);
75 
76  std::string GetComponentInUDrawGraphFormat(const std::string & processName, const std::string & componentName,
77  const mtsComponentState & componentState) const;
78  std::string GetStateInUDrawGraphFormat(const mtsComponentState &componentState) const;
79  std::string GetConnectionInUDrawGraphFormat(const mtsDescriptionConnection &connection) const;
80 
81  enum BorderType { BORDER_NONE, BORDER_SINGLE, BORDER_DOUBLE };
82  void ChangeComponentBorder(const std::string &processName, const std::string &componentName, BorderType border);
83 
84  // Event Handlers
85  virtual void AddComponentHandler(const mtsDescriptionComponent &componentInfo);
86  virtual void ChangeStateHandler(const mtsComponentStateChange &componentStateChange);
87  virtual void AddConnectionHandler(const mtsDescriptionConnection &connectionInfo);
88  virtual void RemoveConnectionHandler(const mtsDescriptionConnection &connectionInfo);
89 
90 public:
91 
92  mtsComponentViewer(const std::string & name);
93 
94  virtual ~mtsComponentViewer();
95 
96  virtual void Configure(const std::string & CMN_UNUSED(filename)) {}
97 
98  virtual void Startup(void);
99 
100  virtual void Run(void);
101 
102  virtual void Cleanup(void);
103 
104 };
105 
107 
108 #endif // _mts_ComponentViewer.h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
osaPipeExec UDrawPipe
Definition: mtsComponentViewer.h:51
bool WaitingForResponse
Definition: mtsComponentViewer.h:65
mtsDescriptionConnection ConnectionRequest
Definition: mtsComponentViewer.h:57
Definition: mtsParameterTypes.h:100
#define CMN_UNUSED(argument)
Definition: cmnPortability.h:479
Defines a task with a Run method trigger by signals (any queued command or event).
Declaration of osaThread.
Define a thread object.
Definition: osaThread.h:164
const int CMN_DYNAMIC_CREATION_ONEARG
Definition: cmnClassRegisterMacros.h:333
Declaration of Base Class for Manager ComponentsIn the networked configuration, the communication bet...
virtual void Configure(const std::string &CMN_UNUSED(filename))
Definition: mtsComponentViewer.h:96
virtual void Startup(void)
Definition: mtsComponent.h:262
Definition: mtsTaskFromSignal.h:40
bool ConnectionStarted
Definition: mtsComponentViewer.h:56
Definition: mtsParameterTypes.h:533
Definition: mtsComponentState.h:34
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
Definition: mtsComponentViewer.h:40
BorderType
Definition: mtsComponentViewer.h:81
std::string UDrawResponse
Definition: mtsComponentViewer.h:53
virtual void Run(void)=0
Rules of exporting.
Definition: osaThreadSignal.h:40
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition: cmnClassRegisterMacros.h:202
virtual void Cleanup(void)
Definition: mtsComponent.h:267
Definition: osaPipeExec.h:31
bool UDrawPipeConnected
Definition: mtsComponentViewer.h:52
Definition: mtsParameterTypes.h:769
bool ShowProxies
Definition: mtsComponentViewer.h:54
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76
bool ReaderThreadFinished
Definition: mtsComponentViewer.h:64
osaThread ReaderThread
Definition: mtsComponentViewer.h:61
osaThreadSignal ReadyToRead
Definition: mtsComponentViewer.h:62