basic.h File Reference

Basic definitions. More...

#include <stdint.h>
#include <memory>
#include <stdexcept>
#include <cfloat>
#include <map>
#include <string>
#include <cstring>

Go to the source code of this file.

Classes

class  ccgl::NotCopyable
 Base class for classes that cannot be copied. More...
 
class  ccgl::Object
 Base of all classes. More...
 
class  ccgl::Interface
 Base type of all interfaces. More...
 
class  ccgl::ModelException
 Print the exception message. More...
 

Namespaces

namespace  ccgl
 Common Cross-platform Geographic Library (CCGL)
 

Macros

#define _DEBUG
 NDEBUG or _DEBUG mean not build on DEBUG mode.
 
#define stringcat   strcat
 
#define stringcpy   strcpy
 
#define strprintf   snprintf
 
#define stringtoken   strtok_r
 
#define stringscanf   sscanf
 
#define NOEXCEPT   throw()
 A compatible reference to noexcept or throw() if not supported by the compiler.
 
#define OVERRIDE
 A compatible reference to override or blank if not supported by the compiler.
 
#define LLD   "%lld"
 
#define LLU   "%llu"
 
#define NODATA_VALUE   (-9999.)
 Global utility definitions. More...
 
#define MISSINGFLOAT   (-1 * FLT_MAX)
 Missing float value.
 
#define MAXIMUMFLOAT   FLT_MAX
 Maximum float value.
 
#define PATH_MAX   1024
 Maximum length of full file path.
 
#define UTIL_ZERO   1.0e-6
 A approximation of Zero.
 
#define PI   3.14159265358979323846
 A approximation of PI.
 
#define MINI_SLOPE   0.0001
 Minimum slope(radian) value.
 
#define SEP   '/'
 
#define SEPSTR   "/"
 
#define LIBPREFIX   "lib"
 
#define POSTFIX   "d"
 A reference to the postfix of executable file for DEBUG mode.
 
#define CVT_INT(param)   static_cast<int>((param))
 A reference to the postfix of executable file for RELWITHDEBINFO mode. More...
 
#define CVT_SIZET(param)   static_cast<size_t>((param))
 Convert to size_t size_t
 
#define CVT_FLT(param)   static_cast<float>((param))
 Convert to float float
 
#define CVT_DBL(param)   static_cast<double>((param))
 Convert to double double
 
#define CVT_TIMET(param)   static_cast<time_t>((param))
 Convert to time_t time_t
 
#define CVT_CHAR(param)   static_cast<char>((param))
 Convert to char char
 
#define CVT_STR(param)   static_cast<string>((param))
 Convert to string string
 
#define CVT_VINT(param)   static_cast<vint>((param))
 Convert to 8-byte (64-bit) signed integer vint
 
#define CVT_VSINT(param)   static_cast<vsint>((param))
 Convert to 8-byte (64-bit) signed integer vsint
 
#define CVT_VUINT(param)   static_cast<vuint>((param))
 Convert to 8-byte (64-bit) unsigned integer vuint
 
#define CVT_VUINT64(param)   static_cast<vuint64_t>((param))
 Convert to 8-byte (64-bit) unsigned integer vuint64_t
 
#define ITOA_S   _itoa_s
 
#define ITOW_S   _itow_s
 
#define I64TOA_S   _i64toa_s
 
#define I64TOW_S   _i64tow_s
 
#define UITOA_S   _ui64toa_s
 
#define UITOW_S   _ui64tow_s
 
#define UI64TOA_S   _ui64toa_s
 
#define UI64TOW_S   _ui64tow_s
 

Typedefs

typedef int8_t ccgl::vint8_t
 
typedef uint8_t ccgl::vuint8_t
 
typedef int16_t ccgl::vint16_t
 
typedef uint16_t ccgl::vuint16_t
 
typedef int32_t ccgl::vint32_t
 
typedef uint32_t ccgl::vuint32_t
 
typedef int64_t ccgl::vint64_t
 
typedef uint64_t ccgl::vuint64_t
 
typedef vint32_t ccgl::vint
 
typedef vint32_t ccgl::vsint
 
typedef vuint32_t ccgl::vuint
 
typedef vint64_t ccgl::pos_t
 Signed integer representing position.
 
typedef std::map< string, string > ccgl::STRING_MAP
 Map of string key and string value.
 
typedef std::map< string, double > ccgl::STRDBL_MAP
 Map of string key and double value.
 

Functions

bool ccgl::IsIpAddress (const char *ip)
 Check if the IP address is valid. More...
 
void ccgl::Log (const string &msg, const string &logpath="debugInfo.log")
 Writes an entry to the log file. More...
 
int ccgl::GetAvailableThreadNum ()
 Detect the available threads number. More...
 
void ccgl::SetDefaultOpenMPThread ()
 Set the default omp thread number if necessary. More...
 
void ccgl::SetOpenMPThread (int n)
 Set the omp thread number by given thread number. More...
 
void ccgl::StatusMessage (const char *msg)
 Print status messages for Debug. More...
 
void ccgl::StatusMessage (const string &msg)
 Print status messages for Debug. More...
 
void ccgl::SleepMs (const int millisecs)
 Sleep milliseconds. More...
 

Detailed Description

Basic definitions.

Part of the Common Cross-platform Geographic Library (CCGL)

Remarks
  • 1. 2018-05-02 - lj - Initially implementation.
  • 2. 2018-06-21 - lj - Test on Intel C++ compiler.
  • 3. 2018-08-21 - lj - Doxygen comment style check.
Author
Liangjun Zhu, zlj(at)lreis.ac.cn
Version
1.1

Macro Definition Documentation

◆ CVT_INT

#define CVT_INT (   param)    static_cast<int>((param))

A reference to the postfix of executable file for RELWITHDEBINFO mode.

A reference to the postfix of executable file for MINSIZEREL mode

A reference to the postfix of executable file for RELEASE mode Use static_cast<T>(a) instead (T)a or T(a) to convert datetypes

Convert to integer int

◆ NODATA_VALUE

#define NODATA_VALUE   (-9999.)

Global utility definitions.

Default NoData value for raster data etc.