Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm Namespace Reference

Namespaces

 array
 
 avl
 
 block
 
 checksum
 
 color
 
 concept
 
 datastruct
 
 genstruct
 
 imm
 
 inhstruct
 
 ini
 
 io
 
 log
 
 net
 
 option
 
 serial
 
 serial2
 
 stree
 
 sys
 
 t
 
 util
 
 win
 
 xom
 

Classes

struct  _if
 
struct  _if< false, T, E >
 
struct  _n
 
class  AbstractBlockAllocatorWithGC
 
class  AbstractClass
 
class  ArrayDelegate
 
struct  asis_t
 
class  AssocComparator
 
class  AssocEquiv
 
class  AutoCleaner
 
class  AutoComparator
 
class  AutoDestructor
 
class  AutoPartialComparator
 
class  AutoPtr
 
class  AutoString
 
class  AutoStringStartup
 
class  BadAlloc
 
class  BitVector
 
class  BlockAllocator
 
class  BlockAllocatorWithGC
 
class  Class
 
class  class_t
 
class  Cleaner
 
class  CleanList
 
class  Comparator
 
class  Comparator< cstring >
 
class  Comparator< Pair< K, T > >
 
class  Comparator< string >
 
class  CompareComparator
 
class  CompareEquiv
 
class  CrashHandler
 
class  CString
 
class  Default
 
struct  default_t
 
class  DefaultAllocator
 
class  DefaultField
 
class  DelegateComparator
 
class  Deletor
 
struct  dtable
 
struct  enum_info
 
struct  enum_t
 
class  EqualsEquiv
 
class  Equiv
 
class  Equiv< Pair< K, T > >
 
class  ErrorBase
 
class  ErrorHandler
 
class  Exception
 
class  Field
 
class  GDBCrashHandler
 
class  HashKey
 
class  HashKey< const T & >
 
class  HashKey< const void * >
 
class  HashKey< CString >
 
class  HashKey< int >
 
class  HashKey< String >
 
class  HashKey< T & >
 
class  HashKey< void * >
 
class  IdAdapter
 
class  IndexedIterator
 
class  Initializer
 
class  ListQueue
 
class  Lock
 
class  MapDelegate
 
class  MessageException
 
class  NoCrashHandler
 
class  Option
 
class  OptionalNone
 
class  OrderedInitializer
 
class  Pair
 
class  PairAdapter
 
class  PreIterator
 
struct  ptr_t
 
class  Ref
 
struct  ref_t
 
class  RefPair
 
class  ReverseComparator
 
class  rtti_t
 
struct  scalar_t
 
struct  signed_info
 
class  SimpleGC
 
class  SortedList
 
class  StackAllocator
 
class  String
 
class  StringBuffer
 
struct  table
 
class  TestCase
 
class  TestSet
 
struct  ti
 
class  type_info
 
struct  type_info< bool >
 
struct  type_info< char >
 
struct  type_info< const T & >
 
struct  type_info< const T * >
 
struct  type_info< cstring >
 
struct  type_info< double >
 
struct  type_info< float >
 
struct  type_info< long double >
 
struct  type_info< signed char >
 
struct  type_info< signed int >
 
struct  type_info< signed long >
 
struct  type_info< signed long long >
 
struct  type_info< signed short >
 
struct  type_info< string >
 
struct  type_info< T & >
 
struct  type_info< T * >
 
struct  type_info< unsigned char >
 
struct  type_info< unsigned int >
 
struct  type_info< unsigned long >
 
struct  type_info< unsigned long long >
 
struct  type_info< unsigned short >
 
struct  type_t
 
struct  unsigned_info
 
class  value_t
 
class  VarArg
 
class  Version
 
class  WAHVector
 

Typedefs

typedef CString cstring
 
typedef String string
 
typedef elm::sys::Path Path
 
typedef struct elm::default_t default_t
 
typedef elm::type_t type_t
 
typedef elm::scalar_t scalar_t
 
typedef elm::ptr_t ptr_t
 
typedef elm::ref_t ref_t
 
typedef elm::enum_t enum_t
 
typedef enum elm::error_level_t error_level_t
 
typedef xom::String xstring
 
typedef WAHVector::word_t word_t
 

Enumerations

enum  error_level_t {
  level_none = 0, level_info, level_warning, level_error,
  level_fatal
}
 

Functions

void crash (void)
 
template<class T >
const T & min (const T &x, const T &y)
 
template<class T >
const T & max (const T &x, const T &y)
 
void trace (CString file, int line, CString fun)
 
template<class T >
elm_spy (cstring comment, T value)
 
int msb (t::uint32 i)
 
int msb (t::int32 i)
 
int msb (t::uint64 i)
 
int msb (t::int64 i)
 
int ones (t::uint8 i)
 
int ones (t::uint16 i)
 
int ones (t::uint32 i)
 
int ones (t::uint64 i)
 
t::uint32 roundup (t::uint32 v, t::uint32 m)
 
t::uint32 rounddown (t::uint32 v, t::uint32 m)
 
t::uint32 abs (t::int32 v)
 
t::uint32 leastUpperPowerOf2 (t::uint32 v)
 
t::uint64 leastUpperPowerOf2 (t::uint64 v)
 
t::uint32 mult (t::uint32 a, t::uint32, bool &over)
 
t::uint64 mult (t::uint64 a, t::uint64, bool &over)
 
value_t value (CString name, int value)
 
template<class T >
Field< T > field (CString name, T &value)
 
template<class T >
DefaultField< T > field (CString name, T &value, const T &def)
 
CString _unqualify (CString name)
 
template<class T >
AutoStringoperator<< (CString str, const T &value)
 
template<class T >
AutoStringoperator<< (const String &str, const T &value)
 
template<class T >
io::StringInput operator>> (const string &str, T &val)
 
template<class T >
io::StringInput operator>> (cstring str, T &val)
 
bool operator== (const CString &s1, const CString &s2)
 
bool operator!= (const CString &s1, const CString &s2)
 
bool operator< (const CString s1, const CString s2)
 
bool operator<= (const CString s1, const CString s2)
 
bool operator> (const CString s1, const CString s2)
 
bool operator>= (const CString s1, const CString s2)
 
bool operator== (const String &s1, const CString s2)
 
bool operator!= (const String &s1, const CString s2)
 
bool operator< (const String &s1, const CString s2)
 
bool operator<= (const String &s1, const CString s2)
 
bool operator> (const String &s1, const CString s2)
 
bool operator>= (const String &s1, const CString s2)
 
bool operator== (const String &s1, const String &s2)
 
bool operator!= (const String &s1, const String &s2)
 
bool operator< (const String &s1, const String &s2)
 
bool operator<= (const String &s1, const String &s2)
 
bool operator> (const String &s1, const String &s2)
 
bool operator>= (const String &s1, const String &s2)
 
bool operator== (const CString s1, const String &s2)
 
bool operator!= (const CString s1, const String &s2)
 
bool operator< (const CString s1, const String &s2)
 
bool operator<= (const CString s1, const String &s2)
 
bool operator> (const CString s1, const String &s2)
 
bool operator>= (const CString s1, const String &s2)
 
bool operator== (const String &s1, const char *s2)
 
bool operator!= (const String &s1, const char *s2)
 
bool operator< (const String &s1, const char *s2)
 
bool operator<= (const String &s1, const char *s2)
 
bool operator> (const String &s1, const char *s2)
 
bool operator>= (const String &s1, const char *s2)
 
bool operator== (const CString s1, const char *s2)
 
bool operator!= (const CString s1, const char *s2)
 
bool operator< (const CString s1, const char *s2)
 
bool operator<= (const CString s1, const char *s2)
 
bool operator> (const CString s1, const char *s2)
 
bool operator>= (const CString s1, const char *s2)
 
bool operator== (const char *s1, const CString s2)
 
bool operator!= (const char *s1, const CString s2)
 
bool operator< (const char *s1, const CString s2)
 
bool operator<= (const char *s1, const CString s2)
 
bool operator> (const char *s1, const CString s2)
 
bool operator>= (const char *s1, const CString s2)
 
bool operator== (const char *s1, const String &s2)
 
bool operator!= (const char *s1, const String &s2)
 
bool operator< (const char *s1, const String &s2)
 
bool operator<= (const char *s1, const String &s2)
 
bool operator> (const char *s1, const String &s2)
 
bool operator>= (const char *s1, const String &s2)
 
String operator+ (const CString s1, const CString s2)
 
String operator+ (const CString s1, const char *s2)
 
String operator+ (const CString s1, const String &s2)
 
String operator+ (const String &s1, const CString s2)
 
String operator+ (const String &s1, const char *s2)
 
String operator+ (const String &s1, const String &s2)
 
String operator+ (const char *s1, const CString s2)
 
String operator+ (const char *s1, const String &s2)
 
io::Outputoperator<< (io::Output &out, const BitVector &bvec)
 
t::hash hash_string (const char *chars, int length)
 
t::hash hash_cstring (const char *chars)
 
t::hash hash_jenkins (const void *block, int size)
 
bool hash_equals (const void *p1, const void *p2, int size)
 
template<class T >
void swap (T &x, T &y)
 
template<class T >
Option< T > some (T val)
 
template<class T1 , class T2 >
Pair< T1, T2 > pair (const T1 &v1, const T2 &v2)
 
template<class T1 , class T2 >
io::Outputoperator<< (io::Output &out, Pair< T1, T2 > &p)
 
template<class T1 , class T2 >
RefPair< T1, T2 > let (T1 &v1, T2 &v2)
 
template<class T >
Outputoperator<< (Output &out, const Ref< T > &ref)
 
io::Outputoperator<< (io::Output &out, const Version &version)
 
io::Outputoperator<< (io::Output &out, const WAHVector &v)
 
static void handle_SIGSEGV (int sig, siginfo_t *info, void *context)
 
static void handle_SIGILL (int sig, siginfo_t *info, void *context)
 
static void handle_SIGABRT (int sig, siginfo_t *info, void *context)
 
static void handle_SIGFPE (int sig, siginfo_t *info, void *context)
 
static void handle_SIGINT (int sig, siginfo_t *info, void *context)
 
io::Output cout (io::out)
 
io::Output cerr (io::err)
 
 STRONG_TYPE (inode_t, ino_t)
 
bool isFill (word_t w)
 
bool isLite (word_t w)
 
bool isOnes (word_t w)
 
bool isZeroes (word_t w)
 
word_t fillCount (word_t w)
 
word_t mask (int n)
 
word_t lite (word_t w)
 
word_t fill (int size, bool init)
 
int times (int v)
 
int div (int v)
 
int mod (int v)
 

Variables

io::Output cout
 
io::Output cerr
 
io::Input cin
 
io::Monitor monitor
 
AutoStringStartup autostr
 
AutoStringStartup_ = autostr
 
const OptionalNone none = OptionalNone()
 
static genstruct::HashTable
< inode_t, sys::FileItem * > * 
files = 0
 
static BitCounter bit_counter
 
static const word_t FILL = 0x80000000
 
static const word_t ONES = 0x40000000
 
static const word_t ALL_ONES = 0x7fffffff
 
static const word_t ALL_ZEROES = 0x00000000
 
static int WORD_SIZE = 31
 

Typedef Documentation

Enumeration Type Documentation

Enumerator
level_none 
level_info 
level_warning 
level_error 
level_fatal 

Function Documentation

CString elm::_unqualify ( CString  name)
t::uint32 elm::abs ( t::int32  v)

Referenced by elm::io::Output::print().

void elm::crash ( void  )

debug Debugging Support

ELM provides several facilities to debug your own application.

crash Automatic Crash Support

As it is a tedious task to restart a program from a debugger after a crash, ELM provides CrashHandler class to associate an action with such an event.

Basically, the behavior of this handler depends on the configuration of the environment. Two environment variable are taken in account :

  • if ELM_DEBUG=yes, the handler is invoked when an error signal is sent,
  • if ELM_INT=yes, the handler is invoked when the program is interrupted (usually by Control-C on Unix platform).

The used handler depends on the configuration of the ELM library. The handler to use is defined by the CRASH_HANDLER definition variable and may be changed in the config.h file at the source root of ELM. As a defaut, the GDBCrashHandler::DEFAULT handler is used on Unix systems. For the time being, there is no other crash handler but the user may provide its own crash handler by calling the method CrashHandler::set().

The GDBCrashHandler invokes the GDB debugger on the current process when a crash arises.

debug_helper Debug Helper Macros

These macros help obtaining log during debugging phase. They are all de-activated as soon as the macro NDEBUG is defined (as for standard C assert macro).

  • TRACE – print current source file, line and container function.
  • HERE – put an empty instruction making easier for the debugger to mark break lines.
  • BREAK(c) – if condition c evaluates to false, executes the following code (HERE for example to get conditional breakpoint).
  • SPY(c, v) – displays string comment followed by the given value and returns this one. Useful to spy values in an expression. This function cause a crash of the program. According the system, it may cause a core dump, GDB invocation or any other debugging solution.

References elm::CrashHandler::crash().

int elm::div ( int  v)
template<class T >
T elm::elm_spy ( cstring  comment,
value 
)

References cerr, elm::io::endl, and value().

template<class T >
Field<T> elm::field ( CString  name,
T &  value 
)

References value().

template<class T >
DefaultField<T> elm::field ( CString  name,
T &  value,
const T &  def 
)

References value().

word_t elm::fill ( int  size,
bool  init 
)
word_t elm::fillCount ( word_t  w)

References FILL, and ONES.

static void elm::handle_SIGABRT ( int  sig,
siginfo_t *  info,
void *  context 
)
static
static void elm::handle_SIGFPE ( int  sig,
siginfo_t *  info,
void *  context 
)
static
static void elm::handle_SIGILL ( int  sig,
siginfo_t *  info,
void *  context 
)
static
static void elm::handle_SIGINT ( int  sig,
siginfo_t *  info,
void *  context 
)
static
static void elm::handle_SIGSEGV ( int  sig,
siginfo_t *  info,
void *  context 
)
static
t::hash elm::hash_cstring ( const char *  chars)

Use a classical compiler string hashing algorithm (see "The Compilers" by Aho, Sethi, Ullman).

Referenced by elm::HashKey< CString >::hash().

bool elm::hash_equals ( const void *  p1,
const void *  p2,
int  size 
)

Test equality of two memory blocks.

Parameters
p1First memory block.
p2Second memory block.
sizeBlock size.
Returns
True if they equals, byte to byte, false else.

Referenced by elm::HashKey< T >::equals(), elm::HashKey< const T & >::equals(), and elm::HashKey< T & >::equals().

t::hash elm::hash_jenkins ( const void *  block,
int  size 
)
t::hash elm::hash_string ( const char *  chars,
int  length 
)

Use a classical compiler string hashing algorithm (see "The Compilers" by Aho, Sethi, Ullman).

Referenced by elm::HashKey< String >::hash().

bool elm::isFill ( word_t  w)

References FILL.

bool elm::isLite ( word_t  w)

References FILL.

bool elm::isOnes ( word_t  w)

References ONES.

Referenced by elm::WAHVector::isFull().

bool elm::isZeroes ( word_t  w)

References ONES.

Referenced by elm::WAHVector::isEmpty().

template<class T1 , class T2 >
RefPair<T1, T2> elm::let ( T1 &  v1,
T2 &  v2 
)
word_t elm::lite ( word_t  w)
word_t elm::mask ( int  n)
template<class T >
const T& elm::max ( const T &  x,
const T &  y 
)
template<class T >
const T& elm::min ( const T &  x,
const T &  y 
)
int elm::msb ( t::int32  i)

References msb().

int elm::msb ( t::int64  i)

References msb().

int elm::ones ( t::uint32  i)

Count the number of ones in the given word.

Parameters
iWord to count ones in.
Returns
Number of ones in the word.

References ones().

bool elm::operator!= ( const CString &  s1,
const CString &  s2 
)
bool elm::operator!= ( const String &  s1,
const CString  s2 
)
bool elm::operator!= ( const String &  s1,
const String &  s2 
)
bool elm::operator!= ( const CString  s1,
const String &  s2 
)
bool elm::operator!= ( const String &  s1,
const char *  s2 
)
bool elm::operator!= ( const CString  s1,
const char *  s2 
)
bool elm::operator!= ( const char *  s1,
const CString  s2 
)
bool elm::operator!= ( const char *  s1,
const String &  s2 
)
String elm::operator+ ( const CString  s1,
const CString  s2 
)
String elm::operator+ ( const CString  s1,
const char *  s2 
)
String elm::operator+ ( const CString  s1,
const String &  s2 
)
String elm::operator+ ( const String &  s1,
const CString  s2 
)
String elm::operator+ ( const String &  s1,
const char *  s2 
)
String elm::operator+ ( const String &  s1,
const String &  s2 
)
String elm::operator+ ( const char *  s1,
const CString  s2 
)
String elm::operator+ ( const char *  s1,
const String &  s2 
)
bool elm::operator< ( const CString  s1,
const CString  s2 
)
bool elm::operator< ( const String &  s1,
const CString  s2 
)
bool elm::operator< ( const String &  s1,
const String &  s2 
)
bool elm::operator< ( const CString  s1,
const String &  s2 
)
bool elm::operator< ( const String &  s1,
const char *  s2 
)
bool elm::operator< ( const CString  s1,
const char *  s2 
)
bool elm::operator< ( const char *  s1,
const CString  s2 
)
bool elm::operator< ( const char *  s1,
const String &  s2 
)
template<class T >
Output& elm::operator<< ( Output &  out,
const Ref< T > &  ref 
)

References elm::io::out.

template<class T1 , class T2 >
io::Output& elm::operator<< ( io::Output &  out,
Pair< T1, T2 > &  p 
)

References elm::io::out.

io::Output & elm::operator<< ( io::Output &  out,
const Version &  version 
)
template<class T >
AutoString& elm::operator<< ( CString  str,
const T &  value 
)

References autostr, and value().

template<class T >
AutoString& elm::operator<< ( const String &  str,
const T &  value 
)

References autostr, and value().

io::Output& elm::operator<< ( io::Output &  out,
const WAHVector &  v 
)
io::Output& elm::operator<< ( io::Output &  out,
const BitVector &  bvec 
)
bool elm::operator<= ( const CString  s1,
const CString  s2 
)
bool elm::operator<= ( const String &  s1,
const CString  s2 
)
bool elm::operator<= ( const String &  s1,
const String &  s2 
)
bool elm::operator<= ( const CString  s1,
const String &  s2 
)
bool elm::operator<= ( const String &  s1,
const char *  s2 
)
bool elm::operator<= ( const CString  s1,
const char *  s2 
)
bool elm::operator<= ( const char *  s1,
const CString  s2 
)
bool elm::operator<= ( const char *  s1,
const String &  s2 
)
bool elm::operator== ( const CString &  s1,
const CString &  s2 
)
bool elm::operator== ( const String &  s1,
const CString  s2 
)
bool elm::operator== ( const String &  s1,
const String &  s2 
)
bool elm::operator== ( const CString  s1,
const String &  s2 
)
bool elm::operator== ( const String &  s1,
const char *  s2 
)
bool elm::operator== ( const CString  s1,
const char *  s2 
)
bool elm::operator== ( const char *  s1,
const CString  s2 
)
bool elm::operator== ( const char *  s1,
const String &  s2 
)
bool elm::operator> ( const CString  s1,
const CString  s2 
)
bool elm::operator> ( const String &  s1,
const CString  s2 
)
bool elm::operator> ( const String &  s1,
const String &  s2 
)
bool elm::operator> ( const CString  s1,
const String &  s2 
)
bool elm::operator> ( const String &  s1,
const char *  s2 
)
bool elm::operator> ( const CString  s1,
const char *  s2 
)
bool elm::operator> ( const char *  s1,
const CString  s2 
)
bool elm::operator> ( const char *  s1,
const String &  s2 
)
bool elm::operator>= ( const CString  s1,
const CString  s2 
)
bool elm::operator>= ( const String &  s1,
const CString  s2 
)
bool elm::operator>= ( const String &  s1,
const String &  s2 
)
bool elm::operator>= ( const CString  s1,
const String &  s2 
)
bool elm::operator>= ( const String &  s1,
const char *  s2 
)
bool elm::operator>= ( const CString  s1,
const char *  s2 
)
bool elm::operator>= ( const char *  s1,
const CString  s2 
)
bool elm::operator>= ( const char *  s1,
const String &  s2 
)
template<class T >
io::StringInput elm::operator>> ( const string &  str,
T &  val 
)

References elm::io::in.

template<class T >
io::StringInput elm::operator>> ( cstring  str,
T &  val 
)

References elm::io::in.

elm::STRONG_TYPE ( inode_t  ,
ino_t   
)
template<class T >
void elm::swap ( T &  x,
T &  y 
)
int elm::times ( int  v)
void elm::trace ( CString  file,
int  line,
CString  fun 
)

References cerr, and elm::io::Output::flush().

Variable Documentation

const word_t elm::ALL_ONES = 0x7fffffff
static
const word_t elm::ALL_ZEROES = 0x00000000
static
BitCounter elm::bit_counter
static
genstruct::HashTable<inode_t, sys::FileItem *>* elm::files = 0
static
const word_t elm::FILL = 0x80000000
static

Referenced by fill(), fillCount(), isFill(), and isLite().

io::Monitor elm::monitor
const word_t elm::ONES = 0x40000000
static

Referenced by fill(), fillCount(), isOnes(), and isZeroes().

int elm::WORD_SIZE = 31
static