AGXDynamics
2.35.0.2
ExternalProcess.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2022. Algoryx Simulation AB.
3
4
All AGX source code, intellectual property, documentation, sample code,
5
tutorials, scene files and technical white papers, are copyrighted, proprietary
6
and confidential material of Algoryx Simulation AB. You may not download, read,
7
store, distribute, publish, copy or otherwise disseminate, use or expose this
8
material unless having a written signed agreement with Algoryx Simulation AB, or having been
9
advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10
valid commercial license from Algoryx Simulation AB.
11
12
Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13
from using this software, unless otherwise stated in written agreements with
14
Algoryx Simulation AB.
15
*/
16
17
#ifndef AGXOSG_EXTERNALPROCESS_H
18
#define AGXOSG_EXTERNALPROCESS_H
19
20
#include <
agxOSG/export.h
>
21
#include <
agx/Referenced.h
>
22
#include <thread>
23
#include <memory>
24
#include <atomic>
25
#include <
agx/String.h
>
26
28
namespace
detail
29
{
30
class
Process;
31
}
33
34
namespace
agxOSG
35
{
36
AGX_DECLARE_POINTER_TYPES
(
ExternalProcess
);
40
class
AGXOSG_EXPORT
ExternalProcess
:
public
agx::Referenced
41
{
42
public
:
44
ExternalProcess
(
const
agx::String
& processTag =
""
);
45
46
/*
47
Launch an external process with a shell command.
48
\param command The shell command to be executed
49
\param workingDir The working directory where the process will be executed
50
\return True if process is still running
51
*/
52
bool
startProcess(
const
agx::StringVector
& commandVector,
const
agx::String
& workingDir);
53
58
int
waitUntilExit();
59
64
int
closeAndWaitForExit();
65
67
void
killProcess();
68
70
bool
isRunning()
const
;
71
72
ExternalProcess
(
const
ExternalProcess
&) =
delete
;
73
protected
:
74
virtual
~
ExternalProcess
();
75
76
bool
startProcess(
const
agx::String
& command,
const
agx::String
& workingDir);
77
78
private
:
79
const
agx::String
m_processTag;
80
std::unique_ptr<detail::Process> m_externalProcess;
81
std::thread m_processThread;
82
std::atomic_bool m_processIsRunning;
83
int
m_exitStatus;
84
};
85
}
86
87
#endif
Referenced.h
agx::Vector< AgXString< std::string > >
agxOSG
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agx::Referenced
Base class providing referencing counted objects.
Definition:
Referenced.h:113
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:248
agxOSG::ExternalProcess
Cross-platform utility class for wrapping and launching external processes.
Definition:
ExternalProcess.h:40
export.h
String.h
agx::AgXString< std::string >
AGXOSG_EXPORT
#define AGXOSG_EXPORT
include
agxOSG
ExternalProcess.h
Generated on Mon Jan 30 2023 15:44:12 for AGXDynamics by
1.8.17