System

“System” is C++ (mostly) template library build from many small classes that are useful, doesn't fit anywhere else and are too small to form a library alone. implements some small, common algorithms, threading helpers, math operations, plugins and more.

library content

available classes/functions are:

  • AtExit – object-oriented wrapper for atexit() standard library call.
  • arraySum*FP – generic algorithm for summing floating points, with minimal loss on precision.
  • AutoCptr – std::auto_ptr<> like wrapper for C-style pointers (allocated with malloc()). it is usefull when working with legacy C code.
  • AutoDescriptor – class behaving just like std::auto_ptr<> but holding descriptors (int): sockets, files, etc…
  • AutoFILE – again std::auto_ptr<> like class, this time for holding C-streams (FILE*).
  • AutoVariable – class for managing user-specified type in std::auto_ptr<> like way. it has been used to write AutoFILE, AutoDescriptor and AutoCptr but is not limited to those 3. it can be used of nearly resource spotted in practice.
  • Average – computes average and standard deviation on given sample of numbers.
  • compareFP – compares floating point numbers withing given precision range.
  • DiskFile – represents file on disk. opens file on disk and returns its descriptor. allows to delete file.
  • DivingStack – template container implementation of diving stack algorithm.
  • Enum – “normal” enum type is very poor in both C and C++. this is a template wrapping user-specified enum type, so that it could be used in more human-readable manner. for example:
class MyEnumType: public Enum<...> {...}
MyEnumType e=MyEnumType::ENUM_VALUE_1;
if(e!=MyEnumType::ENUM_VALUE_2) {...}
...
  • FunctionName.hpp – helper macro that uses standard 'function' or 'pretty function' names, depending on the compiler.
  • GlobalInit – helper to safely initialize libraries, that require some calls to be made before usage (mostly C libraries, but not only). ensures single-initialization, is thread-safe and can be used multiple times safely.
  • ignore – template that does nothing with the argument, except for preventing compiler complaining about unused variable (i.e. when used only in debug for assert()).
  • IterableEnum – extension of Enum class that allows iterating through enum values.
  • MultiLock – locks multiple mutexes in a predefined order (i.e. always the same) to prevent deadlocks.
  • Plugins:: – implementation of generic plugins mechanism with shared-object files.
  • SafeValue – wrapper for non-thread safe values that allows using them in thread-aware environment
  • Singleton – template class implementing Mayer's singleton pattern on user provided type.
  • StateMachine – easy to use representation of state machine. user implements its states and inheritates from this calls. than stepping to another state is done be base-calss call, etc…
  • Sync – class allowing easy master-slave thread synchronization.
  • TempFile – if you need a file and your not interested in details and file should be removed ASAP when not needed TempFile is what you're looking for.
  • Thread – thread wrapper, automatically joining thread when destroyed and catching all runtime errors.
  • keepRange – template function, similar to std::min and std::max, but working on range of values to keep. allows also converting to 'smaller' types (ex.: int to char), doing translation to best-match in new range.
  • nonint_ioctl – ioctl() function wrapper that will not break when EINTR arrives.
  • OneInstanceAtOnce – debug wrapper that checks if given object does is in at most one instance at every time.
  • SharedPtrNotNULL – boost::shared_ptr-like template that ensures pointer held inside is non-NULL. template also provides converting from non-const to const types, and derived to base class pointers.
  • ScopedPtrCustom – boost::scoped_ptr-like template that allows adding self-provided user function to free given pointer.
  • likely.hpp – implements heuristics for branches.
  • SYSTEM_FUNCTION_NAME – wrapper that returns pretty-function name if available, or regular function name if not.
  • SignalRegistrator – C++ helper for registering signal handlers.
  • Timer – boost::timer equivalent for measuring real-time elapsed (instead of CPU-time).
  • Safe-Init-Locking – mechanism that ensures compile-time initialization of (global) mutexes and locking them to ensure thread-safe initialization.

requirements

System requires build_process in recent version. to make life easier it has been included in download package.

you will need to have boost library installed too.

download

get latest version of system library via github. you can download stable versions using proper tag as well.

prjs/system/system.txt · Last modified: 2013/05/17 19:08 (external edit)
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0