VTK  9.2.6
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> // for class std::string
24
35class VTKCOMMONSYSTEM_EXPORT vtkExecutableRunner : public vtkObject
36{
37public:
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
43 ~vtkExecutableRunner() override = default;
44
49 void Execute();
50
52
58 vtkSetMacro(Timeout, double);
59 vtkGetMacro(Timeout, double);
61
63
68 vtkSetMacro(RightTrimResult, bool);
69 vtkGetMacro(RightTrimResult, bool);
70 vtkBooleanMacro(RightTrimResult, bool);
72
74
80
82
88
94 vtkGetMacro(ReturnValue, int);
95
96protected:
97 vtkSetMacro(StdOut, std::string);
98 vtkSetMacro(StdErr, std::string);
99
100 int ExitProcess(vtksysProcess* process);
101
102private:
104 void operator=(const vtkExecutableRunner&) = delete;
105
106 bool RightTrimResult = true;
107 double Timeout = 5;
108 std::string Command;
109 int ReturnValue = -1;
110
111 std::string StdOut;
112 std::string StdErr;
113};
114
115#endif // vtkExecutableRunner_h
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:40