This namespace contains utility classes. More...
Classes | |
class | buffered_sink |
A decorator class that adds a write buffer to an otherwise unbuffered sink. More... | |
class | buffered_source |
A decorator class that adds a read buffer to an otherwise unbuffered source. More... | |
struct | closeable |
Describes a closeable input and/or output channel. More... | |
class | comparable |
Barton-Nackman trick for all comparsion operators. More... | |
class | const_buffer |
Holds a buffer that cannot be modified. More... | |
class | deserializer |
Deserializes objects from a given source. More... | |
class | future |
Describes a simple synchronous future value. More... | |
class | id_generator |
Utility class that generates continuous ID numbers. More... | |
struct | mock_mutex |
Implements the Lockable concepts without any behavior. To use this "mutex" means to disable thread safety. More... | |
class | read_buffer |
An immutable buffer that could be used as a source. More... | |
class | serializer |
Serializes objects to a given sink. More... | |
class | single_reader_queue |
A thread safe single-reader-many-writer queue implementation. More... | |
struct | sink |
Describes an abstract (binary) data sink. More... | |
struct | source |
Describes an abstract (binary) data source. More... | |
struct | unit |
Marker class used in templates as "void" type. More... | |
class | write_buffer |
A mutable (growing) buffer that could be used as a sink. More... | |
Functions | |
template<typename T > | |
bool | atomic_cas (volatile T **ptr, T *ptr_expected, T *ptr_new) |
boost::int32_t | add_and_fetch (volatile boost::int32_t *ptr, boost::int32_t value) |
This namespace contains utility classes.
boost::int32_t hamcast::util::add_and_fetch | ( | volatile boost::int32_t * | ptr, | |
boost::int32_t | value | |||
) |
Atomically increase the content of ptr
by value
and return the new content of ptr
.
ptr | Memory location of the variable. | |
value | The value you want to add to ptr . |
ptr
. bool hamcast::util::atomic_cas | ( | volatile T ** | ptr, | |
T * | ptr_expected, | |||
T * | ptr_new | |||
) |
Atomically compare the content of ptr
to ptr_expected
and, if they are the same, modify it to ptr_new
.
Platform dependent, atomic compare-and-swap operation.
ptr | Memory location of the variable | |
ptr_expected | The value you expect *ptr to be | |
ptr_new | The value which should be stored in *ptr |
ptr
was set to ptr_new
; otherwise false