Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ProcessInfo.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright Saab AB, 2007-2013 (http://safir.sourceforge.net)
4 *
5 * Created by: Lars Hagström / stlrha
6 *
7 *******************************************************************************
8 *
9 * This file is part of Safir SDK Core.
10 *
11 * Safir SDK Core is free software: you can redistribute it and/or modify
12 * it under the terms of version 3 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * Safir SDK Core is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Safir SDK Core. If not, see <http://www.gnu.org/licenses/>.
22 *
23 ******************************************************************************/
24 
25 #ifndef __PROCESSINFO_H__
26 #define __PROCESSINFO_H__
27 
28 #include <Safir/Utilities/Internal/UtilsExportDefs.h>
29 #include <string>
30 #include <boost/noncopyable.hpp>
31 #include <boost/shared_ptr.hpp>
32 
33 //Get hold of pid_t
34 
35 #if defined(linux) || defined(__linux) || defined(__linux__)
36 # include <sys/types.h>
37 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
38  typedef int pid_t;
39 #else
40 # error You need to get hold of pid_t for this platform
41 #endif
42 
43 #ifdef _MSC_VER
44 #pragma warning(push)
45 #pragma warning(disable: 4275)
46 #endif
47 
48 namespace Safir
49 {
50 namespace Utilities
51 {
52  class LLUF_UTILS_API ProcessInfo:
53  private boost::noncopyable //we probably do not want this to be copyable if it is to be extended in the future.
54  {
55  public:
57  ProcessInfo(const pid_t pid);
58 
60  ~ProcessInfo();
61 
63  static pid_t GetPid();
64 
72  const std::string GetProcessName() const;
73 
78  static const std::string GetProcessDescription();
79  private:
80  const pid_t m_pid;
81  };
82 
83 }
84 }
85 
86 #ifdef _MSC_VER
87 #pragma warning(pop)
88 #endif
89 
90 #endif
91 
92 
Definition: ProcessInfo.h:52