openModeller  Version 1.5.0
os_specific.hh File Reference
#include <vector>
#include <string>
#include <unistd.h>
Include dependency graph for os_specific.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UNUSED(symbol)
 
#define Sleep(x)   usleep((x)*1000)
 

Typedefs

typedef void * DLLHandle
 

Functions

DLLHandle dllOpen (char const *dll_file_name)
 
void * dllFunction (DLLHandle, char const *function_name)
 
int dllClose (DLLHandle)
 
const char * dllError (DLLHandle)
 
dllexp void setupExternalResources ()
 
dllexp std::string omDataPath (std::string dir="")
 
std::vector< std::string > initialPluginPath ()
 
std::vector< std::string > scanDirectory (std::string dir)
 
dllexp int initRandom (unsigned int new_seed=0)
 
std::string getWorkingPath ()
 
bool pathExists (const std::string path)
 
bool createPath (const std::string path)
 

Macro Definition Documentation

#define Sleep (   x)    usleep((x)*1000)

Definition at line 70 of file os_specific.hh.

Referenced by EnvironmentImpl::changeMask(), and EnvironmentImpl::loadLayers().

#define UNUSED (   symbol)

Declaration of OS specific functions.

Author
Mauro E S Muņoz (mauro.nosp@m.@cri.nosp@m.a.org.nosp@m..br)
Date
2004-03-19
Id:
os_specific.hh 5986 2014-07-17 14:41:25Z rdg

LICENSE INFORMATION

Copyright(c) 2003 by CRIA - Centro de Referencia em Informacao Ambiental

http://www.cria.org.br

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:

http://www.gnu.org/copyleft/gpl.html #ifdef WIN32 #define dllexp __declspec(dllimport) #define OM_XML_DLL_EXPORT __declspec(dllimport) #define OM_ALG_DLL_EXPORT __declspec(dllexport) #endif

Definition at line 55 of file os_specific.hh.

Referenced by SvmAlgorithm::_setConfiguration(), OpenModeller::calculateModelStatistics(), main(), EnvironmentImpl::makeLayer(), AlgorithmImpl::setConfiguration(), OccurrencesImpl::setConfiguration(), and OpenModeller::setProjectionConfiguration().

Typedef Documentation

typedef void* DLLHandle

Definition at line 81 of file os_specific.hh.

Function Documentation

bool createPath ( const std::string  path)

Creates (recursively) the specified path. path Path to be created

Returns
Succeeded or not.

Definition at line 421 of file os_specific.cpp.

References createPath(), and pathExists().

Referenced by CacheManager::cache(), createPath(), CacheManager::initialize(), and CacheManager::isCached().

Here is the call graph for this function:

int dllClose ( DLLHandle  )

Definition at line 79 of file os_specific.cpp.

Referenced by AlgorithmFactory::DLL::~DLL().

const char* dllError ( DLLHandle  )

Definition at line 88 of file os_specific.cpp.

References error.

void* dllFunction ( DLLHandle  ,
char const *  function_name 
)

Definition at line 70 of file os_specific.cpp.

DLLHandle dllOpen ( char const *  dll_file_name)

Definition at line 61 of file os_specific.cpp.

std::string getWorkingPath ( )

Returns the current working path.

Returns
Working path.

Definition at line 398 of file os_specific.cpp.

Referenced by CacheManager::initialize().

std::vector<std::string> initialPluginPath ( )

Retrieve initial library path.

Returns
Vector of directories.

Definition at line 140 of file os_specific.cpp.

References Settings::count(), Log::debug(), Settings::get(), AlgorithmFactory::getDefaultAlgDir(), and Log::instance().

Referenced by AlgorithmFactory::searchDefaultDirs().

Here is the call graph for this function:

dllexp int initRandom ( unsigned int  new_seed = 0)

Generates a pseudo-random seed and initializes the system random sequence generator. The seed is based in the micro-seconds of the current machine time.

Parameters
new_seedOptional seed that can be explicitly provided.
Returns
Not zero if the generator was initiated.

Definition at line 353 of file os_specific.cpp.

References Log::debug(), and Log::instance().

Referenced by Random::Random(), and splitOccurrences().

Here is the call graph for this function:

dllexp std::string omDataPath ( std::string  dir = "")

Return the om data directory, optionally setting it through the parameter.

Parameters
dirDefault directory.
Returns
dir openModeller data directory.

Definition at line 102 of file os_specific.cpp.

References Settings::count(), and Settings::get().

Referenced by AquaMaps::_readSpeciesData(), and setupExternalResources().

Here is the call graph for this function:

bool pathExists ( const std::string  path)

Indicates if the specified path exists in the file system. path Path to be tested

Returns
Yes or no.

Definition at line 407 of file os_specific.cpp.

Referenced by createPath(), and CacheManager::initialize().

std::vector<std::string> scanDirectory ( std::string  dir)

Scan directory entries.

Parameters
dirPath of the directory to be scanned. (pass by value, routine needs local copy).
Returns
A null terminated array of allocated strings with the directory scanned entries. Return null if an error occurs.
dllexp void setupExternalResources ( )

Set up external resources (GDAL & proj4 configuration, om algorithms & data paths).

Definition at line 95 of file os_specific.cpp.

References omDataPath(), and AlgorithmFactory::setDefaultAlgDir().

Referenced by main().

Here is the call graph for this function: