cisst-saw
Loading...
Searching...
No Matches
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 Author(s): Peter Kazanzides
6 Created on: 2010-09-07
7
8 (C) Copyright 2010-2023 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17*/
18
24
25#ifndef _mtsComponentViewer_h
26#define _mtsComponentViewer_h
27
28
35
36// Always include last!
38
40{
42
43private:
44
45 // Utility method that sends the whole string except the '\0'
46 void WriteString(osaPipeExec & pipe, const std::string & s, double timeoutInSec = 0.1);
47
48protected:
49
52 std::string UDrawResponse;
53
56
57 // Use a separate reader thread because osaPipeExec::Read is blocking.
58 // This could be eliminated if a non-blocking Read is implemented.
64 static void ParseArgs(const std::string &input, std::string &arg1, std::string &arg2);
65 static bool ParseProcessAndComponent(const std::string &input, std::string &processName,
66 std::string &componentName);
67 virtual void ProcessResponse(void);
68
70
71 virtual void SendAllInfo(void);
73
74 std::string GetComponentInUDrawGraphFormat(const std::string & processName, const std::string & componentName,
75 const mtsComponentState & componentState) const;
76 std::string GetStateInUDrawGraphFormat(const mtsComponentState &componentState) const;
77 std::string GetConnectionInUDrawGraphFormat(const mtsDescriptionConnection &connection) const;
78
80 void ChangeComponentBorder(const std::string &processName, const std::string &componentName, BorderType border);
81
82 // Event Handlers
83 virtual void AddComponentHandler(const mtsDescriptionComponent &componentInfo);
84 virtual void ChangeStateHandler(const mtsComponentStateChange &componentStateChange);
85 virtual void AddConnectionHandler(const mtsDescriptionConnection &connectionInfo);
86 virtual void RemoveConnectionHandler(const mtsDescriptionConnection &connectionInfo);
87
88public:
89
90 mtsComponentViewer(const std::string & name);
91
93 void Configure(const std::string & CMN_UNUSED(filename)) override {}
94 void Startup(void) override;
95 void Run(void) override;
96 void Cleanup(void) override;
97};
98
100
101#endif // _mts_ComponentViewer.h
Definition mtsParameterTypes.h:869
Definition mtsComponentState.h:34
Definition mtsComponentViewer.h:40
mtsComponentViewer(const std::string &name)
virtual void AddComponentHandler(const mtsDescriptionComponent &componentInfo)
void Cleanup(void) override
void Configure(const std::string &CMN_UNUSED(filename)) override
Definition mtsComponentViewer.h:93
std::string GetStateInUDrawGraphFormat(const mtsComponentState &componentState) const
virtual void ChangeStateHandler(const mtsComponentStateChange &componentStateChange)
void Run(void) override
osaThreadSignal ReadyToRead
Definition mtsComponentViewer.h:60
BorderType
Definition mtsComponentViewer.h:79
@ BORDER_NONE
Definition mtsComponentViewer.h:79
@ BORDER_DOUBLE
Definition mtsComponentViewer.h:79
@ BORDER_SINGLE
Definition mtsComponentViewer.h:79
std::string GetComponentInUDrawGraphFormat(const std::string &processName, const std::string &componentName, const mtsComponentState &componentState) const
void ChangeComponentBorder(const std::string &processName, const std::string &componentName, BorderType border)
osaPipeExec UDrawPipe
Definition mtsComponentViewer.h:50
static void ParseArgs(const std::string &input, std::string &arg1, std::string &arg2)
virtual void ProcessResponse(void)
osaThread ReaderThread
Definition mtsComponentViewer.h:59
bool ConnectToUDrawGraph(void)
virtual ~mtsComponentViewer()
bool UDrawPipeConnected
Definition mtsComponentViewer.h:51
virtual void RemoveConnectionHandler(const mtsDescriptionConnection &connectionInfo)
bool ConnectionStarted
Definition mtsComponentViewer.h:54
static bool ParseProcessAndComponent(const std::string &input, std::string &processName, std::string &componentName)
void * ReadFromUDrawGraph(int)
mtsDescriptionConnection ConnectionRequest
Definition mtsComponentViewer.h:55
bool ReaderThreadFinished
Definition mtsComponentViewer.h:62
void ActivateMenuItems(void)
std::string UDrawResponse
Definition mtsComponentViewer.h:52
bool WaitingForResponse
Definition mtsComponentViewer.h:63
virtual void AddConnectionHandler(const mtsDescriptionConnection &connectionInfo)
virtual void SendAllInfo(void)
void Startup(void) override
std::string GetConnectionInUDrawGraphFormat(const mtsDescriptionConnection &connection) const
Definition mtsParameterTypes.h:58
Definition mtsParameterTypes.h:624
mtsTaskFromSignal(const std::string &name, unsigned int sizeStateTable=256)
Definition osaPipeExec.h:32
Define a thread object.
Definition osaThread.h:168
Definition osaThreadSignal.h:41
const int CMN_DYNAMIC_CREATION_ONEARG
Definition cmnClassRegisterMacros.h:330
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
#define CISST_EXPORT
Definition cmnExportMacros.h:50
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
#define CMN_UNUSED(argument)
Definition cmnPortability.h:497
Rules of exporting.
Declaration of Base Class for Manager Components.
Defines a task with a Run method trigger by signals (any queued command or event).
Declaration of osaThread.