32 #include <vapor/common.h>
36 void *
operator new (
size_t sz);
37 void *
operator new[] (
size_t sz);
43 #pragma warning(disable : 4251)
71 typedef void (*ErrMsgCB_T) (
const char *msg,
int err_code);
72 typedef void (*DiagMsgCB_T) (
const char *msg);
87 static void SetErrMsg(
const char *format, ...);
99 static void SetErrMsg(
int errcode,
const char *format, ...);
180 static void SetDiagMsg(
const char *format, ...);
245 bool prev = Enabled; Enabled = enable;
return (prev);
267 static void _SetErrMsg(
char **msg,
int *sz,
const char *format, va_list args);
326 const std::string &s,
char delim, std::vector<std::string> &elems
329 const std::string &s,
char delim, std::vector<size_t> &elems
332 const std::string &s,
char delim, std::vector<int> &elems
335 const std::string &s,
char delim, std::vector<float> &elems
350 unsigned long long targ,
365 unsigned long long targ,
368 unsigned long long src
373 return ((X)>0)?((int)(X+0.5)):((
int)(X-0.5));
395 #define FSEEK64 fseek
398 #if defined(Linux) || defined(AIX)
399 #define FSEEK64 fseeko64
403 #define FSEEK64 fseeko
407 #define FSEEK64 fseek64
417 #if defined(WIN32) || defined(Darwin)
418 #define FOPEN64 fopen
422 #define FOPEN64 fopen64
437 #define STAT64_T _stat
442 #define STAT64_T stat
447 #define STAT64_T stat64
448 #define STAT64 stat64
454 #define TIME64_T __int64
456 #define TIME64_T int64_t
static const char * GetDiagMsg()
static FILE * ErrMsgFilePtr
static bool EnableErrMsg(bool enable)
static void SetDiagMsgCB(DiagMsgCB_T cb)
COMMON_API void StrRmWhiteSpace(string &s)
Remove white space from a string.
const string & getClassName() const
COMMON_API int IsPowerOfTwo(unsigned int x)
Return true if power of two.
COMMON_API double ran1(long *)
COMMON_API double LogBaseN(double x, double n)
COMMON_API unsigned long long SetBits64(unsigned long long targ, int pos, int n, unsigned long long src)
static DiagMsgCB_T DiagMsgCB
COMMON_API double Max(double a, double b)
static const char * GetErrMsg()
COMMON_API int StrCmpNoCase(const string &s, const string &t)
Case-insensitive string comparison.
COMMON_API unsigned long long GetBits64(unsigned long long targ, int pos, int n)
static const FILE * SetErrMsgFilePtr()
COMMON_API void StrToWordVec(const string &s, vector< string > &v)
Parse a string, returning a vector of words.
static ErrMsgCB_T ErrMsgCB
COMMON_API double Min(double a, double b)
std::vector< float > & SplitString(const std::string &s, char delim, std::vector< float > &elems)
COMMON_API int IsOdd(int x)
static void SetDiagMsgFilePtr(FILE *fp)
static int GetErrCode()
Retrieve the current error code.
void SetClassName(const string &name)
COMMON_API int ILog2(int n)
static DiagMsgCB_T GetDiagMsgCB()
static FILE * DiagMsgFilePtr
static void SetErrMsgFilePtr(FILE *fp)
static void SetErrCode(int err_code)
Record an error code.
static void SetErrMsgCB(ErrMsgCB_T cb)
static ErrMsgCB_T GetErrMsgCB()