GCS  0.2.3
Data Structures | Typedefs | Enumerations | Functions | Variables
gu Namespace Reference

Data Structures

class  Allocator
 
class  Atomic
 
class  Backtrace
 
struct  CompileAssert
 
class  Cond
 
class  Config
 
class  CRC32C
 
class  Critical
 
class  DeleteObject
 
class  Exception
 
class  FastHash
 
class  FileDescriptor
 
struct  Fmt
 
class  Hexdump
 
class  Lock
 
class  Logger
 
class  MemPool
 
class  MemPool< true >
 
class  MMap
 
class  MMH3
 
class  Monitor
 
class  Mutex
 
class  NotFound
 
class  NotSet
 
class  RecordSet
 
class  RecordSetIn
 
class  RecordSetInBase
 
class  RecordSetOut
 
class  RecordSetOutBase
 
class  RecursiveMutex
 
class  RegEx
 
class  ReservedAllocator
 
class  ReservedContainer
 
class  Serializable
 
class  String
 
class  StringBase
 
class  ThrowBase
 
class  ThrowError
 
class  ThrowFatal
 
class  UnorderedHash
 
class  UnorderedMap
 
class  UnorderedMultimap
 
class  UnorderedSet
 
class  URI
 Utility class to parse URIs. More...
 
class  Vector
 
class  VectorBase
 
class  VectorDerived
 
class  VLA
 

Typedefs

typedef struct gu_buf Buf
 
typedef std::vector< byte_t > Buffer
 
typedef boost::shared_ptr< Buffer > SharedBuffer
 
typedef MMH3 Hash
 
typedef void(* LogCallback )(int, const char *)
 
typedef std::vector< void * > MemPoolVector
 
typedef MemPool< false > MemPoolUnsafe
 
typedef MemPool< true > MemPoolSafe
 
typedef gu_byte_t byte_t
 
typedef std::multimap
< std::string, std::string > 
URIQueryList
 URIQueryList. More...
 

Enumerations

enum  LogLevel {
  LOG_FATAL, LOG_ERROR, LOG_WARN, LOG_INFO,
  LOG_DEBUG, LOG_MAX
}
 

Functions

std::ostream & operator<< (std::ostream &os, const Allocator::BaseName &bn)
 
template<typename T >
gtoh (const T &val)
 
template<>
GU_FORCE_INLINE uint8_t gtoh (const uint8_t &val)
 
template<>
GU_FORCE_INLINE uint16_t gtoh (const uint16_t &val)
 
template<>
GU_FORCE_INLINE unsigned int gtoh (const unsigned int &val)
 
template<>
GU_FORCE_INLINE unsigned long gtoh (const unsigned long &val)
 
template<>
GU_FORCE_INLINE unsigned long long gtoh (const unsigned long long &val)
 
template<typename T >
htog (const T &val)
 
std::ostream & operator<< (std::ostream &, const gu::Config &)
 
template<typename FROM , typename TO >
TO convert (const FROM &from, const TO &to)
 
template<>
long long convert (const unsigned long long &from, const long long &to)
 
template<>
unsigned long long convert (const long long &from, const unsigned long long &to)
 
template<>
long convert (const unsigned long &from, const long &to)
 
template<>
unsigned long convert (const long &from, const unsigned long &to)
 
template<>
int convert (const unsigned int &from, const int &to)
 
template<>
unsigned int convert (const int &from, const unsigned int &to)
 
std::ostream & operator<< (std::ostream &os, const Hexdump &h)
 
template<bool thread_safe>
std::ostream & operator<< (std::ostream &os, const MemPool< thread_safe > &mp)
 
template<typename T >
size_t serial_size (const T &t)
 
template<>
size_t serial_size (const uint8_t &b)
 
template<>
size_t serial_size (const uint16_t &b)
 
template<>
size_t serial_size (const uint32_t &b)
 
template<>
size_t serial_size (const uint64_t &b)
 
template<typename TO , typename FROM >
size_t __private_serialize (const FROM &f, void *const buf, size_t const buflen, size_t const offset)
 
template<typename FROM , typename TO >
size_t __private_unserialize (const void *const buf, size_t const buflen, size_t const offset, TO &t)
 
template<typename T >
GU_FORCE_INLINE size_t serialize1 (const T &t, void *const buf, size_t const buflen, size_t const offset)
 
template<typename T >
GU_FORCE_INLINE size_t unserialize1 (const void *const buf, size_t const buflen, size_t const offset, T &t)
 
template<typename T >
GU_FORCE_INLINE size_t serialize2 (const T &t, void *const buf, size_t const buflen, size_t const offset)
 
template<typename T >
GU_FORCE_INLINE size_t unserialize2 (const void *const buf, size_t const buflen, size_t const offset, T &t)
 
template<typename T >
GU_FORCE_INLINE size_t serialize4 (const T &t, void *const buf, size_t const buflen, size_t const offset)
 
template<typename T >
GU_FORCE_INLINE size_t unserialize4 (const void *const buf, size_t const buflen, size_t const offset, T &t)
 
template<typename T >
GU_FORCE_INLINE size_t serialize8 (const T &t, void *const buf, size_t const buflen, size_t const offset)
 
template<typename T >
GU_FORCE_INLINE size_t unserialize8 (const void *const buf, size_t const buflen, size_t const offset, T &t)
 
template<typename ST >
size_t __private_serial_size (const Buffer &sb)
 
GU_FORCE_INLINE size_t serial_size1 (const Buffer &sb)
 
GU_FORCE_INLINE size_t serial_size2 (const Buffer &sb)
 
GU_FORCE_INLINE size_t serial_size4 (const Buffer &sb)
 
GU_FORCE_INLINE size_t serial_size8 (const Buffer &sb)
 
template<typename ST >
size_t __private_serialize (const Buffer &b, void *const buf, size_t const buflen, size_t offset)
 
template<typename ST >
size_t __private_unserialize (const void *const buf, size_t const buflen, size_t offset, Buffer &b)
 
GU_FORCE_INLINE size_t serialize1 (const Buffer &b, void *const buf, size_t const buflen, size_t const offset)
 
GU_FORCE_INLINE size_t unserialize1 (const void *const buf, size_t const buflen, size_t const offset, Buffer &b)
 
GU_FORCE_INLINE size_t serialize2 (const Buffer &b, void *const buf, size_t const buflen, size_t const offset)
 
GU_FORCE_INLINE size_t unserialize2 (const void *const buf, size_t const buflen, size_t const offset, Buffer &b)
 
GU_FORCE_INLINE size_t serialize4 (const Buffer &b, void *const buf, size_t const buflen, size_t const offset)
 
GU_FORCE_INLINE size_t unserialize4 (const void *const buf, size_t const buflen, size_t const offset, Buffer &b)
 
GU_FORCE_INLINE size_t serialize8 (const Buffer &b, void *const buf, size_t const buflen, size_t const offset)
 
GU_FORCE_INLINE size_t unserialize8 (const void *const buf, size_t const buflen, size_t const offset, Buffer &b)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const gu::StringBase< T > &s)
 
std::vector< std::string > strsplit (const std::string &s, char sep= ' ')
 Split string into tokens using given separator. More...
 
std::vector< std::string > tokenize (const std::string &s, char sep= ' ', char esc= '\\', bool empty=false)
 Split string into tokens using given separator and escape. More...
 
void trim (std::string &s)
 
template<typename K >
size_t HashValue (const K &key)
 
std::ostream & operator<< (std::ostream &os, const URI &uri)
 
template<typename T >
std::string to_string (const T &x, std::ios_base &(*f)(std::ios_base &)=std::dec)
 
template<>
std::string to_string< bool > (const bool &x, std::ios_base &(*f)(std::ios_base &))
 
template<>
std::string to_string< double > (const double &x, std::ios_base &(*f)(std::ios_base &))
 
template<typename T >
from_string (const std::string &s, std::ios_base &(*f)(std::ios_base &)=std::dec)
 
template<>
std::string from_string< std::string > (const std::string &s, std::ios_base &(*f)(std::ios_base &))
 
template<>
void * from_string< void * > (const std::string &s, std::ios_base &(*f)(std::ios_base &))
 
const char * gu_str2bool (const char *str, bool *bl)
 
template<>
bool from_string< bool > (const std::string &s, std::ios_base &(*f)(std::ios_base &))
 
template<typename UI >
size_t uleb128_size (UI value)
 
template<typename UI >
size_t uleb128_encode (UI value, byte_t *buf, size_t buflen, size_t offset)
 
template<typename UI >
size_t uleb128_encode (UI value, byte_t *buf, size_t buflen)
 
void uleb128_decode_checks (const byte_t *buf, size_t buflen, size_t offset, size_t avail_bits)
 
template<typename UI >
size_t uleb128_decode (const byte_t *buf, size_t buflen, size_t offset, UI &value)
 
template<typename UI >
size_t uleb128_decode (const byte_t *buf, size_t buflen, UI &value)
 

Variables

class gu::Lock __attribute__
 

Detailed Description

Byte buffer class. This is thin wrapper to std::vector

ReservedContainer template. It is a wrapper for a container and a reserved buffer to allocate elements from.

For more rationale see http://src.chromium.org/chrome/trunk/src/base/containers/stack_container.h

It is not called "StackContainer" because it is not only for objects allocated on the stack.

Id
gu_reserved_container.hpp 3338 2013-10-30 16:17:18Z alex

Typedef Documentation

typedef std::multimap<std::string, std::string> gu::URIQueryList

URIQueryList.

std::multimap is used to implement query list in URI.

Todo:
This should be changed to real class having get_key(), get_value() methods for iterators and to get rid of std::multimap dependency in header.

Function Documentation

template<typename FROM , typename TO >
TO gu::convert ( const FROM &  from,
const TO &  to 
)
inline

Converts from type FROM to type TO with range checking. Generic template is for the case sizeof(FROM) > sizeof(TO).

Parameters
fromvalue to convert
todestination (provides type TO for template instantiation)
Returns
value cast to TO
template<typename T >
T gu::from_string ( const std::string &  s,
std::ios_base &(*)(std::ios_base &)  f = std::dec 
)
inline

Generic from_string() template. Default base is decimal.

Exceptions
NotFound
template<>
bool gu::from_string< bool > ( const std::string &  s,
std::ios_base &(*)(std::ios_base &)  f 
)
inline

Specialized template for reading bool. Tries both 1|0 and true|false

Exceptions
NotFound
template<>
std::string gu::from_string< std::string > ( const std::string &  s,
std::ios_base &(*)(std::ios_base &)  f 
)
inline

Specialized template for reading strings. This is to avoid throwing NotFound in case of empty string.

template<>
void* gu::from_string< void * > ( const std::string &  s,
std::ios_base &(*)(std::ios_base &)  f 
)
inline

Specialized template for reading pointers. Default base is hex.

Exceptions
NotFound
std::vector<std::string> gu::strsplit ( const std::string &  s,
char  sep = ' ' 
)

Split string into tokens using given separator.

Parameters
septoken separator
template<typename T >
std::string gu::to_string ( const T &  x,
std::ios_base &(*)(std::ios_base &)  f = std::dec 
)
inline

Generic to_string() template function

template<>
std::string gu::to_string< bool > ( const bool &  x,
std::ios_base &(*)(std::ios_base &)  f 
)
inline

Specialized template: make bool translate into 'true' or 'false'

template<>
std::string gu::to_string< double > ( const double &  x,
std::ios_base &(*)(std::ios_base &)  f 
)
inline

Specialized template: make double to print with full precision

std::vector<std::string> gu::tokenize ( const std::string &  s,
char  sep = ' ',
char  esc = '\\',
bool  empty = false 
)

Split string into tokens using given separator and escape.

Parameters
septoken separator
escseparator escape sequence ('\0' to disable escapes)
emptywhether to return empty tokens
void gu::trim ( std::string &  s)

Remove non-alnum symbols from the beginning and end of string