MProcess.h
1 /*****************************************************************************
2  **
3  ** Header file for Muster API process object
4  **
5  ** Name : MError.h
6  ** Author : Leonardo Bernardini
7 ** Version : Alpha 9.0 Wed May 17th 2017
8  **
9  ** Copyright 2000-2017, Virtual Vertex
10  ** All Rights Reserved.
11  **
12  ** This file contains UNPUBLISHED PROPRIETARY SOURCE CODE.
13  ** The contents of this file may not be disclosed to third parties, copied
14  ** or duplicated in any form, in whole or in part, without the prior written
15  ** permission of the author.
16  **
17  *****************************************************************************/
18 #ifndef MPROCESS_H
19 #define MPROCESS_H
20 
21 #ifdef WIN32
22 
23 // Disable STL Export warning, member is private, we don't need direct access from the DLL client
24 #if defined(_WIN32)
25 #pragma warning(disable: 4251)
26 #endif // _WIN32
27 
28 // Windows definitions
29 #ifdef MCLIENTLIB_EXPORTS
30 #define MCLIENTLIB_API __declspec(dllexport)
31 #else
32 #define MCLIENTLIB_API __declspec(dllimport)
33 #endif
34 #else
35 
36 #ifndef MCLIENTLIB_EXPORTS
37 #ifdef LINUX
38 #define MCLIENTLIB_API
39 #else
40 #define MCLIENTLIB_API
41 #endif
42 #else
43 #define MCLIENTLIB_API
44 #endif
45 #endif
46 
47 #include <string>
48 #include <map>
49 #include <vector>
50 
51 #include "MFramework/framework.h"
52 
53 #ifdef WIN32
54  typedef unsigned long MPid ;
55  typedef HWND MWinHandle;
56 #else
57  typedef pid_t MPid;
58  typedef unsigned long MWinHandle;
59 #endif
60 
61 namespace MClientLib {
62 
73  typedef struct {
74  std::string procName;
75  MPid pid;
76  MPid ppid;
78 
82  class MCLIENTLIB_API MEnvironment {
83  public:
84  MEnvironment();
85  MEnvironment(bool _fromRunningEnvironment);
86  void setValue(const std::string& key, const std::string& value);
87  void unsetValue(const std::string& key);
88  std::string getValue(const std::string& key);
89  bool hasValue(const std::string& key);
90  void clearValues();
91  void purgeEnvironment(const char* username);
92  std::map<std::string, std::string> map;
93  private:
94  static MEnvironment createFromRunningEnvironment();
95  std::string resolveEnvironmentString(const std::string& str) ;
96  };
97 
98  typedef std::vector <MProcessSnapshot*> processesSnapshot;
99 
101 }
102 
103 #endif
Class holding a process entry in a processes snapshot.
Definition: MProcess.h:73