PlatformUtils.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/common/PlatformUtils.h
22 
23  \brief This file is a wrapper around platform specific include files.
24 
25  \ingroup common
26 */
27 
28 #ifndef __TERRALIB_COMMON_INTERNAL_PLATFORMUTILS_H
29 #define __TERRALIB_COMMON_INTERNAL_PLATFORMUTILS_H
30 
31 // TerraLib
32 #include "Config.h"
33 #include "../Defines.h"
34 
35 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS
36 #include "WinUtils.h"
37 
38 #elif TE_PLATFORM == TE_PLATFORMCODE_LINUX || TE_PLATFORM == TE_PLATFORMCODE_APPLE
39 #include "LinuxUtils.h"
40 
41 #else
42  #error "Platform not supported yet! Please contact terralib-team@dpi.inpe.br"
43 #endif
44 
45 // STL
46 #include <vector>
47 #include <string>
48 
49 namespace te
50 {
51  namespace common
52  {
53  /*!
54  \brief Returns the amount of free physical memory (bytes).
55 
56  \return The amount of free physical memory (bytes).
57  */
58  TECOMMONEXPORT unsigned long int GetFreePhysicalMemory();
59 
60  /*!
61  \brief Returns the amount of total physical memory (bytes).
62 
63  \return The amount of total physical memory (bytes).
64  */
65  TECOMMONEXPORT unsigned long int GetTotalPhysicalMemory();
66 
67  /*!
68  \brief Returns the amount of used virtual memory (bytes) for the current process (physical + swapped).
69 
70  \return The amount of free virtual memory (bytes).
71  */
72  TECOMMONEXPORT unsigned long int GetUsedVirtualMemory();
73 
74  /*!
75  \brief Returns the amount of total virtual memory (bytes) that can be claimed by the current process (physical + swapped).
76 
77  \return The amount of total virtual memory (bytes).
78  */
79  TECOMMONEXPORT unsigned long int GetTotalVirtualMemory();
80 
81  /*!
82  \brief Returns the number of physical processors.
83 
84  \return The number of physical processors.
85  */
86  TECOMMONEXPORT unsigned int GetPhysProcNumber();
87 
88  /*!
89  \brief Returns the system PATH enviroment variable, decomposed into directory names, or an empty vector if no values were found.
90 
91  \param paths The decomposed PATH.
92  */
93  TECOMMONEXPORT void GetDecompostedPathEnvVar( std::vector< std::string >& paths );
94 
95  /*!
96  \brief Returns the system LD_LIBRARY_PATH enviroment variable, decomposed into directory names, or an empty vector if no values were found.
97 
98  \param paths The decomposed PATH.
99  */
100  TECOMMONEXPORT void GetDecompostedLDPathEnvVar( std::vector< std::string >& paths );
101 
102  /*!
103  \brief Returns the path relative to a directory or file in the context of TerraLib.
104 
105  \param p A path to be searched in the TerraLib context.
106 
107  \return A complete path to the file or directory if it is found, otherwise returns an empty string.
108  */
109  TECOMMONEXPORT std::string FindInTerraLibPath(const std::string& p);
110 
111  } // end namespace common
112 } // end namespace te
113 
114 #endif //__TERRALIB_COMMON_INTERNAL_PLATFORMUTILS_H
TECOMMONEXPORT std::string FindInTerraLibPath(const std::string &p)
Returns the path relative to a directory or file in the context of TerraLib.
TECOMMONEXPORT unsigned long int GetTotalPhysicalMemory()
Returns the amount of total physical memory (bytes).
TECOMMONEXPORT void GetDecompostedLDPathEnvVar(std::vector< std::string > &paths)
Returns the system LD_LIBRARY_PATH enviroment variable, decomposed into directory names...
TECOMMONEXPORT unsigned long int GetUsedVirtualMemory()
Returns the amount of used virtual memory (bytes) for the current process (physical + swapped)...
Configuration flags for the TerraLib Common Runtime module.
TECOMMONEXPORT unsigned int GetPhysProcNumber()
Returns the number of physical processors.
TECOMMONEXPORT void GetDecompostedPathEnvVar(std::vector< std::string > &paths)
Returns the system PATH enviroment variable, decomposed into directory names, or an empty vector if n...
TECOMMONEXPORT unsigned long int GetFreePhysicalMemory()
Returns the amount of free physical memory (bytes).
URI C++ Library.
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:65
TECOMMONEXPORT unsigned long int GetTotalVirtualMemory()
Returns the amount of total virtual memory (bytes) that can be claimed by the current process (physic...
This file contains several utility functions when dealing with Linux specific API.
This file contains several utility functions when dealing with Microsoft Windows specific API...