TerraLib 4.1
Mathematical functions

Functions

int TeRound (double val)
 Rounds a double to int.
TL_DLL double TeRoundD (double val, int precision=8)
 Rounds a double value to a given number of decimal digits.
TL_DLL bool TeCompareDouble (double a, double b, int precision)
 Compares two doubles.
TL_DLL double TeAdjustToPrecision (double val, int precision, bool reduce=false)
 Adjust a number to a given precision.
int TeRoundRasterIndex (double val)
 Rounds a double raster element index to an integer.
double TeCubicRoot (double x)
bool TeFPEquals (double d1, double d2, double precision)
TL_DLL unsigned long int TeGetFreePhysicalMemory ()
TL_DLL unsigned long int TeGetTotalPhysicalMemory ()
TL_DLL unsigned long int TeGetUsedVirtualMemory ()
TL_DLL unsigned long int TeGetTotalVirtualMemory ()
TL_DLL unsigned int TeGetPhysProcNumber ()
TL_DLL bool TeGetTempFileName (std::string &filename)
TL_DLL unsigned long int TeGetFileSize (const std::string &filename)
 The file size (bytes).
TL_DLL bool TeCheckFileExistence (const std::string &filename)
 Check the file existence.
TL_DLL bool TeGetDirFullFilesNames (const std::string &path, const bool &recursive, std::vector< std::string > &filesnames)
 Get the full names of all files inside the given directory.
TL_DLL bool TeCopyFile (const std::string &inputFileName, const std::string &outputFileName)
 Creates a copy from the given input file name.
TL_DLL bool TeCompareFiles (const std::string &inputFileName1, const std::string &inputFileName2)
 Compare two files.
TL_DLL bool TeReplaceTextFileSubString (const std::string &inputFileName, const std::string &outputFileName, const std::string &oldSubString, const std::string &newSubString)
 Creates a copy from the given input text file name replacing all ocurrences of.
TL_DLL unsigned long int TeCreateHashFromString (unsigned char const *inputString, const unsigned int &inputStringSize)
 Creates a hash number from an input string.

Function Documentation

TL_DLL double TeAdjustToPrecision ( double  val,
int  precision,
bool  reduce = false 
)

Adjust a number to a given precision.

TL_DLL bool TeCheckFileExistence ( const std::string filename)

Check the file existence.

Parameters:
filenameThe file name.
Returns:
true if the file exists, false if not.
TL_DLL bool TeCompareDouble ( double  a,
double  b,
int  precision 
)

Compares two doubles.

TL_DLL bool TeCompareFiles ( const std::string inputFileName1,
const std::string inputFileName2 
)

Compare two files.

Parameters:
inputFileName1The input full file 1 name.
inputFileName2The input full file 2 name.
Returns:
true if the two files are identical, false if not.
TL_DLL bool TeCopyFile ( const std::string inputFileName,
const std::string outputFileName 
)

Creates a copy from the given input file name.

Parameters:
inputFileNameThe input full file name.
outputFileNameThe output full file name.
Returns:
true if OK, false if not.
TL_DLL unsigned long int TeCreateHashFromString ( unsigned char const *  inputString,
const unsigned int &  inputStringSize 
)

Creates a hash number from an input string.

This algorithm was created for sdbm (a public-domain reimplementation of ndbm) database library. It was found to do well in scrambling bits, causing better distribution of the keys and fewer splits. It also happens to be a good general hashing function with good distribution. the actual function is hash(i) = hash(i - 1) * 65599 + str[i]

Parameters:
inputStringFileNameThe input full file name.
inputStringSizeInput string size.
Returns:
The generated hash value.
double TeCubicRoot ( double  x) [inline]

Cubic root from x.

Parameters:
xX.
Returns:
The cubic root from x.
bool TeFPEquals ( double  d1,
double  d2,
double  precision 
) [inline]

Comparassion of two floating points, considering a given precision

TL_DLL bool TeGetDirFullFilesNames ( const std::string path,
const bool &  recursive,
std::vector< std::string > &  filesnames 
)

Get the full names of all files inside the given directory.

TL_DLL unsigned long int TeGetFileSize ( const std::string filename)

The file size (bytes).

Note:
Throws an exception if file not found.
Parameters:
filenameThe file name.
Returns:
The file size (bytes).
TL_DLL unsigned long int TeGetFreePhysicalMemory ( )

Returns the amount of free physical memory (bytes).

Returns:
The amount of free physical memory (bytes).
TL_DLL unsigned int TeGetPhysProcNumber ( )

Returns the number of physical processors.

Returns:
The number of physical processors.
TL_DLL bool TeGetTempFileName ( std::string filename)

Generates a temporary unique file name.

Parameters:
filenameThe generated file name.
Returns:
true if ok, false errors.
TL_DLL unsigned long int TeGetTotalPhysicalMemory ( )

Returns the amount of total physical memory (bytes).

Returns:
The amount of total physical memory (bytes).
TL_DLL unsigned long int TeGetTotalVirtualMemory ( )

Returns the amount of total virtual memory (bytes) that can be claimed by the current process (physical + swapped).

Returns:
The amount of total virtual memory (bytes).
TL_DLL unsigned long int TeGetUsedVirtualMemory ( )

Returns the amount of used virtual memory (bytes) for the current process (physical + swapped).

Returns:
The amount of free virtual memory (bytes).
TL_DLL bool TeReplaceTextFileSubString ( const std::string inputFileName,
const std::string outputFileName,
const std::string oldSubString,
const std::string newSubString 
)

Creates a copy from the given input text file name replacing all ocurrences of.

Parameters:
inputFileNameThe input full file name.
inputFileNameThe output full file name.
oldSubStringThe sub-string to be replaced from the input file.
newSubStringThe new sub-string.
Returns:
true if OK, false if not.
int TeRound ( double  val) [inline]
TL_DLL double TeRoundD ( double  val,
int  precision = 8 
)

Rounds a double value to a given number of decimal digits.

int TeRoundRasterIndex ( double  val) [inline]

Rounds a double raster element index to an integer.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines