B2BITS FIX Antenna HFT  1.0.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Utils Namespace Reference

Utils namespace. More...

Namespaces

 Log
 Logging system namespace.
 
 LogImpl
 

Classes

class  ArrayAutoPtr
 std::auto_ptr analogue to operate with dynamic arrays. More...
 
class  AutoPtr
 std::auto_ptr analogue with ability to delete object by object's method. More...
 
class  AutoPtr2
 std::auto_ptr analogue with ability to delete object by object's method. More...
 
struct  CiStringCompare
 Meyer's case-insensitive comparison functor. More...
 
struct  ConstMethodResolver
 Returns pointer to the mutable method of the class. More...
 
struct  ConstMethodResolver< const T >
 Returns pointer to the const method of the class. More...
 
struct  CStrCaseSensLess
 Meyer's case-insensitive comparision functor. More...
 
class  CTGuard
 
struct  DeleteArrayObject
 
struct  DeleteFirst
 Deletes the first member of std::pair. More...
 
struct  DeleteObject
 Deletes the given object. More...
 
struct  DeleteSecond
 Deletes the second member of std::pair. More...
 
class  DGuard
 Debug helper template class. More...
 
class  Emptily
 Represents entity with two states - initialized and not initialized. More...
 
class  EmptyValue
 Class for empty value. More...
 
class  Exception
 Generic application exception. More...
 
class  FilePropertiesT
 This class represents a persistent set of properties. More...
 
class  Guard
 This template class employs a C++ idiom (described by Bjarne Stroustrup) that uses the constructor to acquire a resource automatically when an object of the class is created and uses the destructor to release the resource automatically when it goes out of scope. More...
 
class  InvalidParameterException
 Invalid parameter Exception. More...
 
class  NullableValue
 Represents entity with three states - undefined, empty and assigned. More...
 
class  NullPtr
 
class  Properties
 This class represents a persistent set of properties. More...
 
struct  PropertyDecoder
 Provides the encryption function for properties. More...
 
class  PropVariant
 
class  RawBuffer
 'Quick' buffer for a sequence of bytes . More...
 
class  ReferenceCounter
 A generic reference counter. More...
 
struct  ReleaseObject
 Decrements the number of references to the given object. More...
 
struct  ReleaseSecond
 Decrements the number of references to the given object. More...
 
class  StringUtils
 Encapsulates generic std::string processing methods. More...
 
class  StringUtils< char >
 Encapsulates ASCII std::string processing methods. More...
 
class  StringUtils< wchar_t >
 Encapsulates Unicode std::string processing methods. More...
 
struct  StrToDouble
 
struct  TakeFirst
 Returns the first member of std::pair. More...
 
struct  TakeSecond
 Returns the second member of std::pair. More...
 
struct  ThreadAttrs
 Thread configuration parameters. More...
 
class  ThreadsPool
 The pool of threads. More...
 
struct  ThreadsPoolListener
 The ThreadsPool listener interface. More...
 
class  UndefinedValue
 Class for undefined value. More...
 
class  Unlocker
 Used to temporary unlock mutex Unlocker<Mutex> unlocker (lock_); // guard constructor releases m_lock. More...
 

Typedefs

typedef DGuard< System::Mutex_DMGuard
 
typedef Guard< System::EngMutex_EngMGuard
 
typedef Guard< System::EngMutex_EngMGuard2
 
typedef Guard< System::Mutex_MGuard
 
typedef Unlocker< System::Mutex_MUnlocker
 
typedef Guard< System::OldMutex_OldMGuard
 
typedef Guard< System::SpinMutex_SMGuard
 
typedef FilePropertiesT
< System::FileEx
FileProperties
 
typedef std::map< const char
*, const char
*, CStrCaseSensLess
StringProperties
 
typedef std::vector< std::string > Strings
 

Enumerations

enum  ValueState { vsUndefined, vsEmpty, vsAssigned }
 Enumerates state of the NullableValue. More...
 

Functions

bool areDigitsOnly (const std::string &str)
 Returns 'true' if the given std::string contains only digits, otherwise - 'false'. More...
 
System::i32 atoi32 (char const *pBuf, char const **end) throw ()
 
System::i32 atoi32 (wchar_t const *pBuf, wchar_t const **end) throw ()
 
System::i64 atoi64 (const char *str)
 Converts a std::string to a 64-bit integer. More...
 
System::i64 atoi64 (char const *pBuf, char const **end) throw ()
 
System::i64 atoi64 (wchar_t const *pBuf, wchar_t const **end) throw ()
 
std::size_t atos (char const *pBuf, char const **end) throw ()
 
int atosi (char const *pBuf, char const **end) throw ()
 
int atosi (wchar_t const *pBuf, wchar_t const **end) throw ()
 
System::u32 atou32 (std::string const &value) throw ()
 
System::u32 atou32 (char const *pBuf, char const **end) throw ()
 
System::u32 atou32 (char const *pBuf, std::size_t size) throw ()
 
System::u32 atou32 (wchar_t const *pBuf, wchar_t const **end) throw ()
 
System::u64 atou64 (char const *pBuf, char const **end) throw ()
 
System::u64 atou64 (wchar_t const *pBuf, wchar_t const **end) throw ()
 
unsigned int atoui (char const *pBuf, char const **end) throw ()
 
unsigned int atoui (wchar_t const *pBuf, wchar_t const **end) throw ()
 
std::string b2str (bool val)
 
int ciStrCmp (const char *dst, const char *src) throw ()
 Perform a lowercase comparison of ASCII strings. More...
 
template<typename InputIterator , typename OutputIterator , typename Predicate >
OutputIterator copy_if (InputIterator begin, InputIterator end, OutputIterator destBegin, Predicate p)
 Increments the number of references to the second member of std::pair. More...
 
template<typename T , int N>
static std::size_t count_of (T const (&)[N])
 Returns number of characters in the array. More...
 
template<typename MapType , typename KeyArgType , typename ValueArgtype >
MapType::iterator efficientAddOrUpdateMap (MapType &m, const KeyArgType &k, const ValueArgtype &v)
 It efficiently adds or updates elements in STL map. More...
 
std::string f2str (double aV)
 
void f2str (double aV, Utils::RawBuffer *rez)
 
std::string format (int src, std::size_t grp=3, const std::string &sep=" ")
 Formats number. More...
 
std::string format (std::size_t src, std::size_t grp=3, const std::string &sep=" ")
 
std::string format (const std::string &src, std::size_t grp=3, const std::string &sep=" ")
 
System::u64 htonll (System::u64 value) throw ()
 
std::string i2str (int aV)
 
void i2str (int aV, Utils::RawBuffer *rez)
 
std::string i2str (int aV, const char *format)
 
int i2str (char *pBuf, int value)
 Converts binary int to ASCII std::string by base 10. More...
 
char * i32toa (char *pBuf, std::size_t buf_size, System::i32 value) throw ()
 
char * i64toa (char *pBuf, std::size_t buf_size, System::i64 value) throw ()
 
char * i64toa (char *pBuf, char *end, System::i64 value) throw ()
 
bool isDigit (int ch)
 
std::string lli2str (long long int aV)
 
void lli2str (long long int aV, Utils::RawBuffer *rez)
 
void makeSnId (const std::string &aSender, const std::string &aTarget, std::string *res)
 Makes an identification number from m_sender and m_target. More...
 
std::string makeSnId (const std::string &aSender, const std::string &aTarget)
 
static void * memmem (const void *aS1, std::size_t aN1, const void *aS2, std::size_t aN2) throw ()
 The function searches for the first sequence of elements in the array arrray1 that matches the sequence of elements in the array array2. More...
 
unsigned long long ntohll (unsigned long long value) throw ()
 
template<typename T >
bool operator!= (T *obj, NullPtr const &)
 
template<typename T >
bool operator!= (NullPtr const &, T *obj)
 
template<class Elem , class Traits , typename T >
std::basic_ostream< Elem,
Traits > & 
operator<< (std::basic_ostream< Elem, Traits > &s, const NullableValue< T > &rv)
 
template<typename T >
std::ostream & operator<< (std::ostream &s, const Emptily< T > &rv)
 
template<typename T >
bool operator== (T *obj, NullPtr const &)
 
template<typename T >
bool operator== (NullPtr const &, T *obj)
 
std::string peel (const std::string &source, const char *husk)
 Peels source std::string. More...
 
char * sizetoa (char *pBuf, std::size_t buf_size, std::size_t value) throw ()
 
int split (const std::string &inStr, char delimiter, Strings *out)
 Splits a std::string into a collection of strings. More...
 
template<typename Functor , typename Context >
void split (std::string const &str, char const *delimeter, Functor f, Context *context)
 
int split (const std::string &inStr, const std::string &delimiter, Strings *out)
 Splits a std::string into a collection of strings. More...
 
bool str2b (const std::string &val)
 
int stricmp (const char *string1, const char *string2)
 Performs a lowercase comparison of strings. More...
 
int strnicmp (const char *string1, const char *string2, std::size_t count)
 This function is called to make a case-insensitive comparison of two ANSI strings. More...
 
std::string toString (System::u32 value)
 
std::string toString (System::i32 value)
 
std::string toString (System::u64 value)
 
std::string toString (System::i64 value)
 
std::string const & toString (std::string const &value)
 
void trimWhiteSpace (std::string *apStr)
 
template<typename ToT , typename FromT >
ToT truncateTo (FromT val)
 Returns either passed value or maximum possible value for required type. More...
 
std::string u2str (std::size_t aV)
 
void u2str (std::size_t aV, Utils::RawBuffer *rez)
 
char * u32toa (char *pBuf, std::size_t buf_size, System::u32 value) throw ()
 
char * u32toa (char *pBuf, char *end, System::u32 value) throw ()
 
char * u64toa (char *pBuf, std::size_t buf_size, System::u64 value) throw ()
 
char * u64toa (char *pBuf, char *end, System::u64 value) throw ()
 
int wstrnicmp (const wchar_t *string1, const wchar_t *string2, std::size_t count)
 Compare characters of two strings without regard to case. More...
 
int wstrtoi (const wchar_t *string)
 Converts a wide-character std::string to an integer. More...
 
System::i64 wstrtoi64 (const wchar_t *str)
 Converts a std::string to a 64-bit integer. More...
 

Variables

EmptyValue empty
 Represents empty value. More...
 
static std::size_t const MAX_INT32_STR_SIZE = sizeof( "-2147483647" ) - 1
 Size of the maximum int32 value in std::string representation. More...
 
static std::size_t const MAX_INT64_STR_SIZE = sizeof( "-9223372036854775808" ) - 1
 Size of the maximum int64 value in std::string representation. More...
 
static std::size_t const MAX_SIZE_T_STR_SIZE = MAX_UINT64_STR_SIZE
 Size of the maximum uint64 value in std::string representation. More...
 
static std::size_t const MAX_UINT32_STR_SIZE = sizeof( "4294967296" ) - 1
 Size of the maximum uint32 value in std::string representation. More...
 
static std::size_t const MAX_UINT64_STR_SIZE = sizeof( "18446744073709551616" ) - 1
 Size of the maximum uint64 value in std::string representation. More...
 
UndefinedValue undefined
 Represents undefined value. More...
 

Detailed Description

Utils namespace.

This class used for placing raw message content in toRaw method from all messgaes classes.

Utility namespace.

FIX Antenna Utils framework.

Typedef Documentation

typedef std::map< const char*, const char*, CStrCaseSensLess > Utils::StringProperties
typedef std::vector<std::string> Utils::Strings

Enumeration Type Documentation

Enumerates state of the NullableValue.

Enumerator
vsUndefined 
vsEmpty 
vsAssigned 

Function Documentation

bool Utils::areDigitsOnly ( const std::string &  str)

Returns 'true' if the given std::string contains only digits, otherwise - 'false'.

System::i32 Utils::atoi32 ( char const *  pBuf,
char const **  end 
)
throw (
)
System::i32 Utils::atoi32 ( wchar_t const *  pBuf,
wchar_t const **  end 
)
throw (
)
System::i64 Utils::atoi64 ( const char *  str)

Converts a std::string to a 64-bit integer.

Referenced by Utils::StringUtils< char >::toInt64().

System::i64 Utils::atoi64 ( char const *  pBuf,
char const **  end 
)
throw (
)
System::i64 Utils::atoi64 ( wchar_t const *  pBuf,
wchar_t const **  end 
)
throw (
)
std::size_t Utils::atos ( char const *  pBuf,
char const **  end 
)
throw (
)
int Utils::atosi ( char const *  pBuf,
char const **  end 
)
throw (
)
int Utils::atosi ( wchar_t const *  pBuf,
wchar_t const **  end 
)
throw (
)
System::u32 Utils::atou32 ( std::string const &  value)
throw (
)
System::u32 Utils::atou32 ( char const *  pBuf,
char const **  end 
)
throw (
)
System::u32 Utils::atou32 ( char const *  pBuf,
std::size_t  size 
)
throw (
)
System::u32 Utils::atou32 ( wchar_t const *  pBuf,
wchar_t const **  end 
)
throw (
)
System::u64 Utils::atou64 ( char const *  pBuf,
char const **  end 
)
throw (
)
System::u64 Utils::atou64 ( wchar_t const *  pBuf,
wchar_t const **  end 
)
throw (
)
unsigned int Utils::atoui ( char const *  pBuf,
char const **  end 
)
throw (
)
unsigned int Utils::atoui ( wchar_t const *  pBuf,
wchar_t const **  end 
)
throw (
)
std::string Utils::b2str ( bool  val)
int Utils::ciStrCmp ( const char *  dst,
const char *  src 
)
throw (
)

Perform a lowercase comparison of ASCII strings.

template<typename InputIterator , typename OutputIterator , typename Predicate >
OutputIterator Utils::copy_if ( InputIterator  begin,
InputIterator  end,
OutputIterator  destBegin,
Predicate  p 
)

Increments the number of references to the second member of std::pair.

copy_if algorithm.

template<typename T , int N>
static std::size_t Utils::count_of ( T const   (&)[N])
inlinestatic

Returns number of characters in the array.

template<typename MapType , typename KeyArgType , typename ValueArgtype >
MapType::iterator Utils::efficientAddOrUpdateMap ( MapType &  m,
const KeyArgType &  k,
const ValueArgtype &  v 
)

It efficiently adds or updates elements in STL map.

If key k isn't in map m, efficiently add pair (k,v) to m; otherwise efficiently update to v the value associated with k.

Returns
an iterator to the added or modified pair.
std::string Utils::f2str ( double  aV)
void Utils::f2str ( double  aV,
Utils::RawBuffer rez 
)
std::string Utils::format ( int  src,
std::size_t  grp = 3,
const std::string &  sep = " " 
)

Formats number.

Parameters
srcSource number to be formatted
grpnumber of digits in group
sepstd::string to put between groups
Returns
formatted std::string
Note
Sample: 8101012 -> "8 101 012"
std::string Utils::format ( std::size_t  src,
std::size_t  grp = 3,
const std::string &  sep = " " 
)
std::string Utils::format ( const std::string &  src,
std::size_t  grp = 3,
const std::string &  sep = " " 
)
System::u64 Utils::htonll ( System::u64  value)
throw (
)
inline

Referenced by ntohll().

std::string Utils::i2str ( int  aV)
void Utils::i2str ( int  aV,
Utils::RawBuffer rez 
)
std::string Utils::i2str ( int  aV,
const char *  format 
)
int Utils::i2str ( char *  pBuf,
int  value 
)

Converts binary int to ASCII std::string by base 10.

char* Utils::i32toa ( char *  pBuf,
std::size_t  buf_size,
System::i32  value 
)
throw (
)
char* Utils::i64toa ( char *  pBuf,
std::size_t  buf_size,
System::i64  value 
)
throw (
)
char* Utils::i64toa ( char *  pBuf,
char *  end,
System::i64  value 
)
throw (
)
bool Utils::isDigit ( int  ch)
inline
std::string Utils::lli2str ( long long int  aV)
void Utils::lli2str ( long long int  aV,
Utils::RawBuffer rez 
)
void Utils::makeSnId ( const std::string &  aSender,
const std::string &  aTarget,
std::string *  res 
)

Makes an identification number from m_sender and m_target.

std::string Utils::makeSnId ( const std::string &  aSender,
const std::string &  aTarget 
)
static void* Utils::memmem ( const void *  aS1,
std::size_t  aN1,
const void *  aS2,
std::size_t  aN2 
)
throw (
)
inlinestatic

The function searches for the first sequence of elements in the array arrray1 that matches the sequence of elements in the array array2.

If successful, the function returns the address of the matching first element; otherwise, it returns a NULL pointer.

Parameters
array1- starting address of the first array.
nElements1- the number of elements in the first array.
array2- starting address of the second array.
nElements2- the number of elements in the second array.

Referenced by fix_algo::findTag().

unsigned long long Utils::ntohll ( unsigned long long  value)
throw (
)
inline

References htonll().

template<typename T >
bool Utils::operator!= ( T *  obj,
NullPtr const &   
)
template<typename T >
bool Utils::operator!= ( NullPtr const &  ,
T *  obj 
)
template<class Elem , class Traits , typename T >
std::basic_ostream<Elem, Traits>& Utils::operator<< ( std::basic_ostream< Elem, Traits > &  s,
const NullableValue< T > &  rv 
)
inline
template<typename T >
std::ostream& Utils::operator<< ( std::ostream &  s,
const Emptily< T > &  rv 
)
inline
template<typename T >
bool Utils::operator== ( T *  obj,
NullPtr const &   
)
template<typename T >
bool Utils::operator== ( NullPtr const &  ,
T *  obj 
)
std::string Utils::peel ( const std::string &  source,
const char *  husk 
)

Peels source std::string.

Removes from begin and from and any characters listed in husk.

Returns
Peeled std::string.
char* Utils::sizetoa ( char *  pBuf,
std::size_t  buf_size,
std::size_t  value 
)
throw (
)
int Utils::split ( const std::string &  inStr,
char  delimiter,
Strings *  out 
)

Splits a std::string into a collection of strings.

Returns
the number of strings in the collection.
template<typename Functor , typename Context >
void Utils::split ( std::string const &  str,
char const *  delimeter,
Functor  f,
Context *  context 
)
int Utils::split ( const std::string &  inStr,
const std::string &  delimiter,
Strings *  out 
)

Splits a std::string into a collection of strings.

Returns
the number of strings in the collection.
bool Utils::str2b ( const std::string &  val)
int Utils::stricmp ( const char *  string1,
const char *  string2 
)

Performs a lowercase comparison of strings.

int Utils::strnicmp ( const char *  string1,
const char *  string2,
std::size_t  count 
)

This function is called to make a case-insensitive comparison of two ANSI strings.

Referenced by Utils::StringUtils< char >::strnicmp().

std::string Utils::toString ( System::u32  value)
std::string Utils::toString ( System::i32  value)
std::string Utils::toString ( System::u64  value)
std::string Utils::toString ( System::i64  value)
std::string const& Utils::toString ( std::string const &  value)
inline
void Utils::trimWhiteSpace ( std::string *  apStr)
template<typename ToT , typename FromT >
ToT Utils::truncateTo ( FromT  val)
inline

Returns either passed value or maximum possible value for required type.

std::string Utils::u2str ( std::size_t  aV)
void Utils::u2str ( std::size_t  aV,
Utils::RawBuffer rez 
)
char* Utils::u32toa ( char *  pBuf,
std::size_t  buf_size,
System::u32  value 
)
throw (
)
char* Utils::u32toa ( char *  pBuf,
char *  end,
System::u32  value 
)
throw (
)
char* Utils::u64toa ( char *  pBuf,
std::size_t  buf_size,
System::u64  value 
)
throw (
)
char* Utils::u64toa ( char *  pBuf,
char *  end,
System::u64  value 
)
throw (
)
int Utils::wstrnicmp ( const wchar_t *  string1,
const wchar_t *  string2,
std::size_t  count 
)

Compare characters of two strings without regard to case.

Referenced by Utils::StringUtils< wchar_t >::strnicmp().

int Utils::wstrtoi ( const wchar_t *  string)

Converts a wide-character std::string to an integer.

Referenced by Utils::StringUtils< wchar_t >::toInt32().

System::i64 Utils::wstrtoi64 ( const wchar_t *  str)

Converts a std::string to a 64-bit integer.

Referenced by Utils::StringUtils< wchar_t >::toInt64().

Variable Documentation

EmptyValue Utils::empty

Represents empty value.

Referenced by __attribute__().

std::size_t const Utils::MAX_INT32_STR_SIZE = sizeof( "-2147483647" ) - 1
static

Size of the maximum int32 value in std::string representation.

Referenced by Utils::FilePropertiesT< FileT >::setInt().

std::size_t const Utils::MAX_INT64_STR_SIZE = sizeof( "-9223372036854775808" ) - 1
static

Size of the maximum int64 value in std::string representation.

std::size_t const Utils::MAX_SIZE_T_STR_SIZE = MAX_UINT64_STR_SIZE
static

Size of the maximum uint64 value in std::string representation.

std::size_t const Utils::MAX_UINT32_STR_SIZE = sizeof( "4294967296" ) - 1
static

Size of the maximum uint32 value in std::string representation.

Referenced by Utils::FilePropertiesT< FileT >::setInt().

std::size_t const Utils::MAX_UINT64_STR_SIZE = sizeof( "18446744073709551616" ) - 1
static

Size of the maximum uint64 value in std::string representation.

UndefinedValue Utils::undefined

Represents undefined value.