fw4spl
System.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWTOOLS_SYSTEM_HPP__
8 #define __FWTOOLS_SYSTEM_HPP__
9 
10 #include <string>
11 
12 #include <boost/filesystem/path.hpp>
13 
14 #include "fwTools/config.hpp"
15 
16 namespace fwTools
17 {
18 
26 class FWTOOLS_CLASS_API System
27 {
28 public:
29 
35  FWTOOLS_API static const ::boost::filesystem::path &getTempPath() noexcept;
36 
45  FWTOOLS_API static const ::boost::filesystem::path getTemporaryFolder(
46  const std::string& subFolderPrefix = "" ) noexcept;
47 
54  FWTOOLS_API static int tempFolderPID(const ::boost::filesystem::path &dir) noexcept;
55 
59  FWTOOLS_API static void cleanZombies(const ::boost::filesystem::path &dir) noexcept;
60 
64  FWTOOLS_API static int getPID() noexcept;
65 
70  FWTOOLS_API static bool isProcessRunning(int pid) noexcept;
71 
77  static void setTempPrefix(const std::string &prefix)
78  {
79  s_tempPrefix = prefix;
80  }
81 
82 protected:
83 
84  static std::string s_tempPrefix;
85 
86 };
87 
88 
89 } // namespace fwTools
90 
91 #endif // __FWTOOLS_SYSTEM_HPP__
The namespace fwTools contains several tools like UUID, factory, dispatche, stringizer, macros, helper.
Provide a system to get a Temporary folder which allow multi-user, multi-instance separation...
Definition: System.hpp:26
static void setTempPrefix(const std::string &prefix)
Sets the temporary folder prefix. The prefix must be set before the first call to getTemporaryFolder...
Definition: System.hpp:77