VTK  9.1.0
vtkExecutableRunner.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkExecutableRunner.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15#ifndef vtkExecutableRunner_h
16#define vtkExecutableRunner_h
17
18#include "vtkCommonSystemModule.h" // For export macro
19#include "vtkObject.h"
20
21#include "vtksys/Process.h" // For class vtksysProcess
22
23#include <string> // fot class std::string
24
32class VTKCOMMONSYSTEM_EXPORT vtkExecutableRunner : public vtkObject
33{
34public:
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
40 ~vtkExecutableRunner() override = default;
41
46 void Execute();
47
49
55 vtkSetMacro(Timeout, double);
56 vtkGetMacro(Timeout, double);
58
60
65 vtkSetMacro(RightTrimResult, bool);
66 vtkGetMacro(RightTrimResult, bool);
67 vtkBooleanMacro(RightTrimResult, bool);
69
71
77
79
85
91 vtkGetMacro(ReturnValue, int);
92
93protected:
94 vtkSetMacro(StdOut, std::string);
95 vtkSetMacro(StdErr, std::string);
96
97 int ExitProcess(vtksysProcess* process);
98
99private:
101 void operator=(const vtkExecutableRunner&) = delete;
102
103 bool RightTrimResult = true;
104 double Timeout = 5;
105 std::string Command;
106 int ReturnValue = -1;
107
108 std::string StdOut;
109 std::string StdErr;
110};
111
112#endif // vtkExecutableRunner_h
Launch a process on the current machine and get its output.
static vtkExecutableRunner * New()
int ExitProcess(vtksysProcess *process)
void Execute()
Execute the command currently set if any.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGetCharFromStdStringMacro(StdOut)
Get output of the previously run command.
~vtkExecutableRunner() override=default
vtkGetCharFromStdStringMacro(Command)
Set/Get command to execute.
vtkExecutableRunner()=default
vtkSetStdStringFromCharMacro(Command)
vtkGetCharFromStdStringMacro(StdErr)
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:82