CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
process.h
1
2#ifndef _aspose_system_diagnostics_process_h_
3#define _aspose_system_diagnostics_process_h_
4
5#include <stdio.h>
6#include "fwd.h"
7#include "system/object.h"
8#include "system/string.h"
9#include "system/io/stream_reader.h"
10#include "system/diagnostics/process_start_info.h"
11
12#if !_WIN32
13#include <sys/types.h>
14#endif
15
16namespace System { namespace Diagnostics {
17
22class ASPOSECPP_SHARED_CLASS Process : public System::Object //Component
23{
24public:
26 virtual ASPOSECPP_SHARED_API ~Process();
27
30 static ASPOSECPP_SHARED_API SharedPtr<Process> GetCurrentProcess();
31
33 ASPOSECPP_SHARED_API bool Start();
34
39 static ASPOSECPP_SHARED_API SharedPtr<Process> Start(const String& filename, const String& arguments = String::Empty);
43 static ASPOSECPP_SHARED_API SharedPtr<Process> Start(const SharedPtr<ProcessStartInfo>& start_info);
44
48 ASPOSECPP_SHARED_API bool WaitForExit(int milliseconds);
50 ASPOSECPP_SHARED_API void WaitForExit();
51
54 ASPOSECPP_SHARED_API String get_ProcessName() const;
55
62 ASPOSECPP_SHARED_API int get_ExitCode() const;
65 ASPOSECPP_SHARED_API SharedPtr<ProcessStartInfo> get_StartInfo() const;
68 ASPOSECPP_SHARED_API int64_t get_PrivateMemorySize64() const;
71 ASPOSECPP_SHARED_API int64_t get_WorkingSet64() const;
72
75 ASPOSECPP_SHARED_API String GetOutputText() const;
76
78 ASPOSECPP_SHARED_API bool get_EnableRaisingEvents() const;
80 ASPOSECPP_SHARED_API void set_EnableRaisingEvents(bool enable_raising_events);
81
82private:
84 ASPOSECPP_SHARED_API void ResetPipe();
85
87 SharedPtr<ProcessStartInfo> m_process_start_info = System::MakeObject<ProcessStartInfo>();
89 FILE* m_pipe = nullptr;
91 std::string m_output;
93 int m_exit_code = 0;
95 bool m_enable_raising_events = false;
96#if _WIN32
98 void* m_process_handle = 0x0;
99#else
100 pid_t m_pid = 0;
101#endif
102};
103
104}}
105#endif
Encapsulates process information and manipulation. Objects of this class should only be allocated usi...
Definition: process.h:23
void set_EnableRaisingEvents(bool enable_raising_events)
Sets whether the event Exited should be raised when the process terminates.
SharedPtr< ProcessStartInfo > get_StartInfo() const
Gets process start information.
String get_ProcessName() const
Gets process name.
int get_ExitCode() const
Gets process exit code.
String GetOutputText() const
Gets process output text.
SharedPtr< System::IO::StreamReader > get_StandardError() const
Provides reader to read from process error output. Not implemented.
static SharedPtr< Process > Start(const SharedPtr< ProcessStartInfo > &start_info)
Starts process with specified path and arguments.
static SharedPtr< Process > Start(const String &filename, const String &arguments=String::Empty)
Starts process with specified path and arguments.
virtual ~Process()
Destructor.
int64_t get_PrivateMemorySize64() const
Gets process private memory set size.
bool WaitForExit(int milliseconds)
Waits for process to exit. Not implemented.
SharedPtr< System::IO::StreamReader > get_StandardOutput() const
Provides reader to read from process standard output. Not implemented.
void WaitForExit()
Waits for process to exit, doesn't return until it's over.
bool get_EnableRaisingEvents() const
Gets whether the event Exited should be raised when the process terminates.
bool Start()
Starts process with pre-defined parameters.
static SharedPtr< Process > GetCurrentProcess()
Gets information on current process. Windows only.
int64_t get_WorkingSet64() const
Gets process memory working set size.
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
static const String Empty
Empty string.
Definition: string.h:894
Definition: db_command.h:9