| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

Functions
Mathematical functions
General purpose utilitary 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:

  filename | The 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:

  inputFileName1 | The input full file 1 name.
  inputFileName2 | The 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:

  inputFileName | The input full file name.
  outputFileName | The 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:

  inputStringFileName | The input full file name.
  inputStringSize | Input string size.

Returns:
  The generated hash value.

double TeCubicRoot | ( | double | x | ) | `[inline]`

Cubic root from x.

Parameters:

  x | X.

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:

  filename | The 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:

  filename | The 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:

  inputFileName | The input full file name.
  inputFileName | The output full file name.
  oldSubString | The sub-string to be replaced from the input file.
  newSubString | The new sub-string.

Returns:
  true if OK, false if not.

int TeRound | ( | double | val | ) | `[inline]`

Rounds a double to int.

Examples:
  TePDICorrelationMatching_test.cpp, TePDIMIMatching_test.cpp, TePDIMMIOMatching_test.cpp, and TePDIOFMatching_test.cpp.

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