All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlatformUtils.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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 
34 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS
35 #include "WinUtils.h"
36 
37 #elif TE_PLATFORM == TE_PLATFORMCODE_LINUX || TE_PLATFORM == TE_PLATFORMCODE_APPLE
38 #include "LinuxUtils.h"
39 
40 #else
41  #error "Platform not supported yet! Please contact terralib-team@dpi.inpe.br"
42 #endif
43 
44 #include <vector>
45 #include <string>
46 
47 namespace te
48 {
49  namespace common
50  {
51  /*!
52  \brief Returns the amount of free physical memory (bytes).
53 
54  \return The amount of free physical memory (bytes).
55  */
56  TECOMMONEXPORT unsigned long int GetFreePhysicalMemory();
57 
58  /*!
59  \brief Returns the amount of total physical memory (bytes).
60 
61  \return The amount of total physical memory (bytes).
62  */
63  TECOMMONEXPORT unsigned long int GetTotalPhysicalMemory();
64 
65  /*!
66  \brief Returns the amount of used virtual memory (bytes) for the current process (physical + swapped).
67 
68  \return The amount of free virtual memory (bytes).
69  */
70  TECOMMONEXPORT unsigned long int GetUsedVirtualMemory();
71 
72  /*!
73  \brief Returns the amount of total virtual memory (bytes) that can be claimed by the current process (physical + swapped).
74 
75  \return The amount of total virtual memory (bytes).
76  */
77  TECOMMONEXPORT unsigned long int GetTotalVirtualMemory();
78 
79  /*!
80  \brief Returns the number of physical processors.
81 
82  \return The number of physical processors.
83  */
84  TECOMMONEXPORT unsigned int GetPhysProcNumber();
85 
86  /*!
87  \brief Returns the system PATH enviroment variable, decomposed into directory names, or an empty vector if no values were found.
88 
89  \param paths The decomposed PATH.
90  */
91  TECOMMONEXPORT void GetDecompostedPathEnvVar( std::vector< std::string >& paths );
92 
93  /*!
94  \brief Returns the system LD_LIBRARY_PATH enviroment variable, decomposed into directory names, or an empty vector if no values were found.
95 
96  \param paths The decomposed PATH.
97  */
98  TECOMMONEXPORT void GetDecompostedLDPathEnvVar( std::vector< std::string >& paths );
99 
100  } // end namespace common
101 } // end namespace te
102 
103 #endif //__TERRALIB_COMMON_INTERNAL_PLATFORMUTILS_H
This file contains several utility functions when dealing with Linux specific API.
void GetDecompostedPathEnvVar(std::vector< std::string > &paths)
Returns the system PATH enviroment variable, decomposed into directory names, or an empty vector if n...
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:455
unsigned int GetPhysProcNumber()
Returns the number of physical processors.
void GetDecompostedLDPathEnvVar(std::vector< std::string > &paths)
Returns the system LD_LIBRARY_PATH enviroment variable, decomposed into directory names...
unsigned long int GetFreePhysicalMemory()
Returns the amount of free physical memory (bytes).
unsigned long int GetTotalPhysicalMemory()
Returns the amount of total physical memory (bytes).
This file contains several utility functions when dealing with Microsoft Windows specific API...
unsigned long int GetUsedVirtualMemory()
Returns the amount of used virtual memory (bytes) for the current process (physical + swapped)...
unsigned long int GetTotalVirtualMemory()
Returns the amount of total virtual memory (bytes) that can be claimed by the current process (physic...
Configuration flags for the TerraLib Common Runtime module.