CLRX  1
An unofficial OpenCL extensions designed for Radeon GPUs
Classes | Namespaces | Typedefs | Enumerations | Functions
Utilities.h File Reference

utilities for other libraries and programs More...

#include <CLRX/Config.h>
#include <exception>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <mutex>
#include <atomic>
#include <CLRX/utils/Containers.h>
#include <CLRX/utils/CString.h>

Go to the source code of this file.

Classes

struct  CLRX::NonCopyableAndNonMovable
 non copyable and non movable base structure (class) More...
 
class  CLRX::Exception
 exception class More...
 
class  CLRX::ParseException
 parse exception class More...
 
class  CLRX::DynLibrary
 dynamic library class More...
 
struct  CLRX::CStringLess
 function class that returns true if first C string is less than second More...
 
struct  CLRX::CStringCaseLess
 function class that returns true if first C string is less than second (ignore case) More...
 
struct  CLRX::CStringEqual
 function class that returns true if C strings are equal More...
 
struct  CLRX::CStringHash
 generate hash function for C string More...
 
struct  CLRX::UInt128
 Unsigned 128-bit integer. More...
 
class  CLRX::RefCountable
 reference countable object More...
 
class  CLRX::FastRefCountable
 reference countable object (only for single threading usage) More...
 
class  CLRX::RefPtr< T >
 reference pointer based on Glibmm refptr More...
 

Namespaces

 CLRX
 main namespace
 

Typedefs

typedef uint64_t CLRX::LineNo
 line number type
 
typedef size_t CLRX::ColNo
 column number type
 
typedef uint32_t CLRX::Flags
 type for declaring various flags
 

Enumerations

enum  : Flags { FLAGS_ALL = 0xffffffffU }
 
enum  : Flags {
  CLRX::DYNLIB_LOCAL = 0, CLRX::DYNLIB_LAZY = 1, CLRX::DYNLIB_NOW = 2, DYNLIB_MODE1_MASK = 7,
  CLRX::DYNLIB_GLOBAL = 8
}
 

Functions

bool CLRX::isSpace (unsigned char c)
 check whether character is space
 
bool CLRX::isODigit (unsigned char c)
 check whether character is digit
 
bool CLRX::isDigit (unsigned char c)
 check whether character is digit
 
bool CLRX::isXDigit (unsigned char c)
 check whether character is hexadecimal digit
 
bool CLRX::isAlpha (unsigned char c)
 check whether character is digit
 
bool CLRX::isAlnum (unsigned char c)
 check whether character is digit
 
const char * CLRX::skipSpaces (const char *s)
 skip spaces from cString
 
const char * CLRX::skipSpacesAtEnd (const char *s, size_t length)
 skip spaces from cString
 
template<typename T >
CLRX::cstrtovCStyle (const char *str, const char *inend, const char *&outend)
 parses integer or float point formatted looks like C-style More...
 
template<typename T >
CLRX::parseEnvVariable (const char *envVar, const T &defaultValue=T())
 parse environment variable More...
 
template cxuchar CLRX::parseEnvVariable< cxuchar > (const char *envVar, const cxuchar &defaultValue)
 parse environment variable of cxuchar type
 
template cxchar CLRX::parseEnvVariable< cxchar > (const char *envVar, const cxchar &defaultValue)
 parse environment variable of cxchar type
 
template cxuint CLRX::parseEnvVariable< cxuint > (const char *envVar, const cxuint &defaultValue)
 parse environment variable of cxuint type
 
template cxint CLRX::parseEnvVariable< cxint > (const char *envVar, const cxint &defaultValue)
 parse environment variable of cxint type
 
template cxushort CLRX::parseEnvVariable< cxushort > (const char *envVar, const cxushort &defaultValue)
 parse environment variable of cxushort type
 
template cxshort CLRX::parseEnvVariable< cxshort > (const char *envVar, const cxshort &defaultValue)
 parse environment variable of cxshort type
 
template cxulong CLRX::parseEnvVariable< cxulong > (const char *envVar, const cxulong &defaultValue)
 parse environment variable of cxulong type
 
template cxlong CLRX::parseEnvVariable< cxlong > (const char *envVar, const cxlong &defaultValue)
 parse environment variable of cxlong type
 
template cxullong CLRX::parseEnvVariable< cxullong > (const char *envVar, const cxullong &defaultValue)
 parse environment variable of cxullong type
 
template cxllong CLRX::parseEnvVariable< cxllong > (const char *envVar, const cxllong &defaultValue)
 parse environment variable of cxllong type
 
template float CLRX::parseEnvVariable< float > (const char *envVar, const float &defaultValue)
 parse environment variable of float type
 
template double CLRX::parseEnvVariable< double > (const char *envVar, const double &defaultValue)
 parse environment variable of double type
 
template std::string CLRX::parseEnvVariable< std::string > (const char *envVar, const std::string &defaultValue)
 parse environment variable of string type
 
template bool CLRX::parseEnvVariable< bool > (const char *envVar, const bool &defaultValue)
 parse environment variable of boolean type
 
cxuint CLRX::CLZ32 (uint32_t v)
 counts leading zeroes for 32-bit unsigned integer. For zero behavior is undefined
 
cxuint CLRX::CLZ64 (uint64_t v)
 counts leading zeroes for 64-bit unsigned integer. For zero behavior is undefined
 
template<typename T , typename T2 >
bool CLRX::usumGt (T a, T b, T2 c)
 safely compares sum of two unsigned integers with other unsigned integer
 
template<typename T , typename T2 >
bool CLRX::usumGe (T a, T b, T2 c)
 safely compares sum of two unsigned integers with other unsigned integer
 
std::string CLRX::escapeStringCStyle (size_t strSize, const char *str)
 escapes string into C-style string
 
std::string CLRX::escapeStringCStyle (const std::string &str)
 escape string into C-style string
 
std::string CLRX::escapeStringCStyle (const CString &str)
 escape string into C-style string
 
size_t CLRX::escapeStringCStyle (size_t strSize, const char *str, size_t outMaxSize, char *outStr, size_t &outSize)
 escapes string into C-style string More...
 
cxuint CLRX::cstrtoui (const char *str, const char *inend, const char *&outend)
 parses unsigned integer regardless locales More...
 
int64_t CLRX::cstrtoiXCStyle (const char *str, const char *inend, const char *&outend, cxuint bits)
 parse 64-bit signed integer
 
uint64_t CLRX::cstrtouXCStyle (const char *str, const char *inend, const char *&outend, cxuint bits)
 parse 64-bit unsigned integer
 
uint64_t CLRX::cstrtofXCStyle (const char *str, const char *inend, const char *&outend, cxuint expBits, cxuint mantisaBits)
 parse 64-bit float value
 
UInt128 CLRX::cstrtou128CStyle (const char *str, const char *inend, const char *&outend)
 parse 128-bit unsigned integer
 
template<>
cxuchar CLRX::cstrtovCStyle< cxuchar > (const char *str, const char *inend, const char *&outend)
 parse cxuchar value from string
 
template<>
cxchar CLRX::cstrtovCStyle< cxchar > (const char *str, const char *inend, const char *&outend)
 parse cxchar value from string
 
template<>
cxuint CLRX::cstrtovCStyle< cxuint > (const char *str, const char *inend, const char *&outend)
 parse cxuint value from string
 
template<>
cxint CLRX::cstrtovCStyle< cxint > (const char *str, const char *inend, const char *&outend)
 parse cxint value from string
 
template<>
cxushort CLRX::cstrtovCStyle< cxushort > (const char *str, const char *inend, const char *&outend)
 parse cxushort value from string
 
template<>
cxshort CLRX::cstrtovCStyle< cxshort > (const char *str, const char *inend, const char *&outend)
 parse cxshort value from string
 
template<>
cxulong CLRX::cstrtovCStyle< cxulong > (const char *str, const char *inend, const char *&outend)
 parse cxulong value from string
 
template<>
cxlong CLRX::cstrtovCStyle< cxlong > (const char *str, const char *inend, const char *&outend)
 parse cxlong value from string
 
template<>
cxullong CLRX::cstrtovCStyle< cxullong > (const char *str, const char *inend, const char *&outend)
 parse cxullong value from string
 
template<>
cxllong CLRX::cstrtovCStyle< cxllong > (const char *str, const char *inend, const char *&outend)
 parse cxllong value from string
 
template<>
UInt128 CLRX::cstrtovCStyle< UInt128 > (const char *str, const char *inend, const char *&outend)
 parse UInt128 value from string
 
template<>
float CLRX::cstrtovCStyle< float > (const char *str, const char *inend, const char *&outend)
 parse float value from string
 
template<>
double CLRX::cstrtovCStyle< double > (const char *str, const char *inend, const char *&outend)
 parse double value from string
 
cxushort CLRX::cstrtohCStyle (const char *str, const char *inend, const char *&outend)
 parses half float formatted looks like C-style More...
 
size_t CLRX::uXtocstrCStyle (uint64_t value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format unsigned value to string
 
size_t CLRX::iXtocstrCStyle (int64_t value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 formast signed value to string
 
template<typename T >
size_t CLRX::itocstrCStyle (T value, char *str, size_t maxSize, cxuint radix=10, cxuint width=0, bool prefix=true)
 formats an integer More...
 
template<>
size_t CLRX::itocstrCStyle< cxuchar > (cxuchar value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxuchar value to string
 
template<>
size_t CLRX::itocstrCStyle< cxchar > (cxchar value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxchar value to string
 
template<>
size_t CLRX::itocstrCStyle< cxushort > (cxushort value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxushort value to string
 
template<>
size_t CLRX::itocstrCStyle< cxshort > (cxshort value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxshort value to string
 
template<>
size_t CLRX::itocstrCStyle< cxuint > (cxuint value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxuint value to string
 
template<>
size_t CLRX::itocstrCStyle< cxint > (cxint value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxint value to string
 
template<>
size_t CLRX::itocstrCStyle< cxulong > (cxulong value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxulong value to string
 
template<>
size_t CLRX::itocstrCStyle< cxlong > (cxlong value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxlong value to string
 
template<>
size_t CLRX::itocstrCStyle< cxullong > (cxullong value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxullong value to string
 
template<>
size_t CLRX::itocstrCStyle< cxllong > (cxllong value, char *str, size_t maxSize, cxuint radix, cxuint width, bool prefix)
 format cxllong value to string
 
size_t CLRX::fXtocstrCStyle (uint64_t value, char *str, size_t maxSize, bool scientific, cxuint expBits, cxuint mantisaBits)
 format float value to string
 
size_t CLRX::htocstrCStyle (cxushort value, char *str, size_t maxSize, bool scientific=false)
 formats half float in C-style More...
 
size_t CLRX::ftocstrCStyle (float value, char *str, size_t maxSize, bool scientific=false)
 formats single float in C-style More...
 
size_t CLRX::dtocstrCStyle (double value, char *str, size_t maxSize, bool scientific=false)
 formats double float in C-style More...
 
bool CLRX::isDirectory (const char *path)
 returns true if path refers to directory
 
bool CLRX::isFileExists (const char *path)
 returns true if file exists
 
Array< cxbyte > CLRX::loadDataFromFile (const char *filename)
 load data from file (any regular or pipe or device) More...
 
void CLRX::filesystemPath (char *path)
 convert to filesystem from unified path (with slashes)
 
void CLRX::filesystemPath (std::string &path)
 convert to filesystem from unified path (with slashes)
 
std::string CLRX::joinPaths (const std::string &path1, const std::string &path2)
 join two paths
 
uint64_t CLRX::getFileTimestamp (const char *filename)
 get file timestamp in nanosecond since Unix epoch
 
std::string CLRX::getHomeDir ()
 get user's home directory
 
void CLRX::makeDir (const char *dirname)
 create directory
 
Array< cxbyte > CLRX::runExecWithOutput (const char *program, const char **argv)
 run executable with output, returns array of output
 
std::string CLRX::findAmdOCL ()
 find amdocl library, returns path if found, otherwise returns empty string
 
std::string CLRX::findMesaOCL ()
 find Mesa OpenCL library, returns path if found, otherwise returns empty string
 
std::string CLRX::findLLVMConfig ()
 find LLVM config, returns path if found, otherwise returns empty string
 
char CLRX::toLower (char c)
 convert character to lowercase
 
void CLRX::toLowerString (std::string &string)
 convert string to lowercase
 
void CLRX::toLowerString (char *cstr)
 convert string to lowercase
 
void CLRX::toLowerString (CString &string)
 convert string to lowercase
 
char CLRX::toUpper (char c)
 convert character to uppercase
 
void CLRX::toUpperString (std::string &string)
 convert string to uppercase
 
void CLRX::toUpperString (char *cstr)
 convert string to uppercase
 
void CLRX::toUpperString (CString &string)
 convert string to uppercase
 

Detailed Description

utilities for other libraries and programs