![]() |
Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
General-purpose building blocks and platform abstraction layer. More...
Classes | |
class | AlignedStorage |
Fixed-size maximum-aligned storage. More... | |
class | AlignOps |
Alignment operations. More... | |
class | Array |
Dynamic array. More... | |
class | Atomic |
Atomic integer. Provides sequential consistency. For a fine-grained memory order control, see AtomicOps. More... | |
class | Atomic< T * > |
Atomic pointer. Provides sequential consistency. For a fine-grained memory order control, see AtomicOps. More... | |
class | AtomicOps |
Atomic operations. This wrapper exists because on non-C11 compilers we use another implementation. More... | |
class | Buffer |
Buffer. More... | |
class | BufferFactory |
Buffer factory. More... | |
class | Cond |
Condition variable. More... | |
class | Console |
Console. More... | |
class | CrashHandler |
Crash handler. More... | |
class | CustomAllocation |
Allocation policy for objects (de)allocated using custom functions. More... | |
class | EndianOps |
Endian operations. More... | |
class | errno_to_str |
Convert errno to string. More... | |
class | FactoryAllocation |
Allocation policy for objects (de)allocated using speciailized factory. More... | |
class | Hashmap |
Intrusive hash table. More... | |
class | HashmapNode |
Base class for hashmap element. More... | |
class | HeapAllocator |
Heap allocator implementation. More... | |
class | IAllocator |
Memory allocator interface. More... | |
class | List |
Intrusive doubly-linked list. More... | |
class | ListNode |
Base class for list element. More... | |
class | LogBackend |
Log backend. More... | |
class | Logger |
Logger. More... | |
struct | LogMessage |
Log message. More... | |
class | MpscQueue |
Thread-safe lock-free node-based intrusive multi-producer single-consumer queue. More... | |
class | MpscQueueNode |
MpscQueue node. More... | |
class | Mutex |
Mutex. More... | |
class | NonCopyable |
Base class for non-copyable objects. More... | |
struct | NoOwnership |
No ownership. More... | |
class | Optional |
Optionally constructed object. More... | |
class | Printer |
Printer. More... | |
class | RateLimiter |
Rate limiter. More... | |
class | RefCounted |
Base class for reference counted object. More... | |
struct | RefCountedOwnership |
Reference counted object ownership. More... | |
class | ScopedLock |
RAII mutex lock. More... | |
class | ScopedPtr |
Unique ownrship pointer. More... | |
class | Semaphore |
Semaphore. More... | |
class | Seqlock |
Seqlock. More... | |
class | SharedPtr |
Shared ownership intrusive pointer. More... | |
class | Singleton |
Singleton. More... | |
class | SlabPool |
Slab pool. More... | |
class | Slice |
Slice. More... | |
class | StandardAllocation |
Allocation policy for objects (de)allocated using IAllocator. More... | |
class | StringBuffer |
String buffer. More... | |
class | StringBuilder |
String builder. More... | |
class | StringList |
Dynamic list of strings. More... | |
class | TempFile |
Temporary file. More... | |
class | Thread |
Base class for thread objects. More... | |
class | Ticker |
Ticker. More... | |
class | Timer |
Thread-safe timer. More... | |
class | UsageCounter |
Base class for object with usage counter. More... | |
Typedefs | |
typedef size_t | hashsum_t |
Hash type. | |
typedef void(* | LogHandler) (const LogMessage &message, void **args) |
Log handler. | |
typedef uint32_t | seqlock_version_t |
Type for holding seqlock value version. Version is changed each value update. May wrap. | |
typedef int64_t | nanoseconds_t |
Nanoseconds. | |
Enumerations | |
enum | ColorsMode { ColorsAuto , ColorsEnabled , ColorsDisabled } |
Colors mode. More... | |
enum | LocationMode { LocationEnabled , LocationDisabled } |
Location mode. More... | |
enum | Color { Color_None , Color_None , Color_White , Color_Gray , Color_Red , Color_Green , Color_Yellow , Color_Blue , Color_Magenta , Color_Cyan } |
Color ID. More... | |
enum | Color { Color_None , Color_None , Color_White , Color_Gray , Color_Red , Color_Green , Color_Yellow , Color_Blue , Color_Magenta , Color_Cyan } |
Color ID. More... | |
enum | clock_t { ClockMonotonic , ClockUnix } |
Clock identifier. More... | |
Functions | |
void | print_backtrace_full () |
Print backtrace to stderr. | |
void | print_backtrace_safe () |
Print backtrace to stderr (emergency mode). | |
const char * | demangle_symbol (const char *mangled, char *&demangled_buf, size_t &demangled_size) |
Demangle symbol name. | |
uint16_t | ntoh16u (uint16_t v) |
Network to host byte order (unsigned 16-bit). | |
int16_t | ntoh16s (int16_t v) |
Network to host byte order (signed 16-bit). | |
uint32_t | ntoh32u (uint32_t v) |
Network to host byte order (unsigned 32-bit). | |
int32_t | ntoh32s (int32_t v) |
Network to host byte order (signed 32-bit). | |
uint64_t | ntoh64u (uint64_t v) |
Network to host byte order (unsigned 64-bit). | |
int64_t | ntoh64s (int64_t v) |
Network to host byte order (signed 64-bit). | |
uint16_t | hton16u (uint16_t v) |
Host to network byte order (unsigned 16-bit). | |
int16_t | hton16s (int16_t v) |
Host to network byte order (signed 16-bit). | |
uint32_t | hton32u (uint32_t v) |
Host to network byte order (unsigned 32-bit). | |
int32_t | hton32s (int32_t v) |
Host to network byte order (signed 32-bit). | |
uint64_t | hton64u (uint64_t v) |
Host to network byte order (unsigned 64-bit). | |
int64_t | hton64s (int64_t v) |
Host to network byte order (signed 64-bit). | |
hashsum_t | hashsum_int (int16_t) |
Compute hash for 16-bit integer. | |
hashsum_t | hashsum_int (uint16_t) |
Compute hash for 16-bit integer. | |
hashsum_t | hashsum_int (int32_t) |
Compute hash for 32-bit integer. | |
hashsum_t | hashsum_int (uint32_t) |
Compute hash for 32-bit integer. | |
hashsum_t | hashsum_int (int64_t) |
Compute hash for 64-bit integer. | |
hashsum_t | hashsum_int (uint64_t) |
Compute hash for 64-bit integer. | |
hashsum_t | hashsum_str (const char *str) |
Compute hash for zero-terminated string. | |
hashsum_t | hashsum_mem (const void *data, size_t size) |
Compute hash for byte range. | |
void | panic (const char *module, const char *file, int line, const char *format,...) |
Print error message and terminate program gracefully. | |
bool | parse_duration (const char *string, nanoseconds_t &result) |
Parse duration from string. | |
void | print_buffer (const uint8_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const uint16_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const uint32_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const uint64_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const int8_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const int16_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const int32_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const int64_t *data, size_t size) |
Print buffer. | |
void | print_buffer (const float *data, size_t size) |
Print floats buffer. | |
void | print_buffer (const double *data, size_t size) |
Print floats buffer. | |
void | print_buffer_slice (const uint8_t *inner, size_t inner_size, const uint8_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const uint16_t *inner, size_t inner_size, const uint16_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const uint32_t *inner, size_t inner_size, const uint32_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const uint64_t *inner, size_t inner_size, const uint64_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const int8_t *inner, size_t inner_size, const int8_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const int16_t *inner, size_t inner_size, const int16_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const int32_t *inner, size_t inner_size, const int32_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const int64_t *inner, size_t inner_size, const int64_t *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const float *inner, size_t inner_size, const float *outer, size_t outer_size) |
Print a slice of a buffer. | |
void | print_buffer_slice (const double *inner, size_t inner_size, const double *outer, size_t outer_size) |
Print a slice of a buffer. | |
bool | seqlock_version_is_dirty (seqlock_version_t ver) |
Check if given seqlock version corresponds to dirty value. | |
template<class T1 , class T2 > | |
bool | operator== (const SharedPtr< T1 > &a, const SharedPtr< T2 > &b) |
Equality check. | |
void | cpu_relax () |
CPU pause instruction. | |
void | die_fast (int code) |
Terminate program. | |
void | die_gracefully (const char *message, bool full_backtrace) |
Terminate program with error message and backtrace. | |
uint32_t | fast_random (uint32_t from, uint32_t to) |
Get a random integer from a non cryptographically secure, but fast PRNG. Thread-safe. | |
nanoseconds_t | timestamp (clock_t clock) |
Get current timestamp in nanoseconds. | |
void | sleep_until (clock_t clock, nanoseconds_t timestamp) |
Sleep until the specified absolute time point has been reached. | |
void | sleep_for (clock_t clock, nanoseconds_t duration) |
Sleep specified amount of time. | |
std::tm | nanoseconds_2_tm (nanoseconds_t timestamp) |
Convert timestamp in nanoseconds format to broken-down time. | |
nanoseconds_t | tm_2_nanoseconds (std::tm tm) |
Convert timestamp from broken-down time to nanoseconds format. | |
Variables | |
const nanoseconds_t | Nanosecond = 1 |
One nanosecond represented in nanoseconds. | |
const nanoseconds_t | Microsecond = 1000 * Nanosecond |
One microsecond represented in nanoseconds. | |
const nanoseconds_t | Millisecond = 1000 * Microsecond |
One millisecond represented in nanoseconds. | |
const nanoseconds_t | Second = 1000 * Millisecond |
One second represented in nanoseconds. | |
const nanoseconds_t | Minute = 60 * Second |
One minute represented in nanoseconds. | |
const nanoseconds_t | Hour = 60 * Minute |
One hour represented in nanoseconds. | |
const nanoseconds_t | Day = 24 * Hour |
One day represented in nanoseconds. | |
General-purpose building blocks and platform abstraction layer.
typedef size_t roc::core::hashsum_t |
typedef void(* roc::core::LogHandler) (const LogMessage &message, void **args) |
typedef int64_t roc::core::nanoseconds_t |
typedef uint32_t roc::core::seqlock_version_t |
enum roc::core::clock_t |
Clock identifier.
enum roc::core::Color |
enum roc::core::Color |
|
inline |
CPU pause instruction.
Definition at line 46 of file cpu_instructions.h.
const char * roc::core::demangle_symbol | ( | const char * | mangled, |
char *& | demangled_buf, | ||
size_t & | demangled_size | ||
) |
Demangle symbol name.
demangled_buf
and demangled_size
specify the buffer for demangled name. When necessary, this function malloc()s or realloc()s demangled_buf
and updates demangled_size
accordingly. The buffer may be NULL. The buffer may be resused across several calls. The user should manually free() the buffer when it's not needed anymore. void roc::core::die_fast | ( | int | code | ) |
Terminate program.
void roc::core::die_gracefully | ( | const char * | message, |
bool | full_backtrace | ||
) |
Terminate program with error message and backtrace.
uint32_t roc::core::fast_random | ( | uint32_t | from, |
uint32_t | to | ||
) |
Get a random integer from a non cryptographically secure, but fast PRNG. Thread-safe.
hashsum_t roc::core::hashsum_int | ( | int16_t | ) |
Compute hash for 16-bit integer.
hashsum_t roc::core::hashsum_int | ( | int32_t | ) |
Compute hash for 32-bit integer.
hashsum_t roc::core::hashsum_int | ( | int64_t | ) |
Compute hash for 64-bit integer.
hashsum_t roc::core::hashsum_int | ( | uint16_t | ) |
Compute hash for 16-bit integer.
hashsum_t roc::core::hashsum_int | ( | uint32_t | ) |
Compute hash for 32-bit integer.
hashsum_t roc::core::hashsum_int | ( | uint64_t | ) |
Compute hash for 64-bit integer.
hashsum_t roc::core::hashsum_mem | ( | const void * | data, |
size_t | size | ||
) |
Compute hash for byte range.
hashsum_t roc::core::hashsum_str | ( | const char * | str | ) |
Compute hash for zero-terminated string.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
std::tm roc::core::nanoseconds_2_tm | ( | nanoseconds_t | timestamp | ) |
Convert timestamp in nanoseconds format to broken-down time.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Equality check.
Definition at line 131 of file shared_ptr.h.
void roc::core::panic | ( | const char * | module, |
const char * | file, | ||
int | line, | ||
const char * | format, | ||
... | |||
) |
Print error message and terminate program gracefully.
bool roc::core::parse_duration | ( | const char * | string, |
nanoseconds_t & | result | ||
) |
Parse duration from string.
void roc::core::print_backtrace_full | ( | ) |
Print backtrace to stderr.
void roc::core::print_backtrace_safe | ( | ) |
Print backtrace to stderr (emergency mode).
void roc::core::print_buffer | ( | const double * | data, |
size_t | size | ||
) |
Print floats buffer.
void roc::core::print_buffer | ( | const float * | data, |
size_t | size | ||
) |
Print floats buffer.
void roc::core::print_buffer | ( | const int16_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer | ( | const int32_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer | ( | const int64_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer | ( | const int8_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer | ( | const uint16_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer | ( | const uint32_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer | ( | const uint64_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer | ( | const uint8_t * | data, |
size_t | size | ||
) |
Print buffer.
void roc::core::print_buffer_slice | ( | const double * | inner, |
size_t | inner_size, | ||
const double * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const float * | inner, |
size_t | inner_size, | ||
const float * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const int16_t * | inner, |
size_t | inner_size, | ||
const int16_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const int32_t * | inner, |
size_t | inner_size, | ||
const int32_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const int64_t * | inner, |
size_t | inner_size, | ||
const int64_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const int8_t * | inner, |
size_t | inner_size, | ||
const int8_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const uint16_t * | inner, |
size_t | inner_size, | ||
const uint16_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const uint32_t * | inner, |
size_t | inner_size, | ||
const uint32_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const uint64_t * | inner, |
size_t | inner_size, | ||
const uint64_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
void roc::core::print_buffer_slice | ( | const uint8_t * | inner, |
size_t | inner_size, | ||
const uint8_t * | outer, | ||
size_t | outer_size | ||
) |
Print a slice of a buffer.
|
inline |
void roc::core::sleep_for | ( | clock_t | clock, |
nanoseconds_t | duration | ||
) |
Sleep specified amount of time.
duration
specifies number of nanoseconds to sleep. void roc::core::sleep_until | ( | clock_t | clock, |
nanoseconds_t | timestamp | ||
) |
Sleep until the specified absolute time point has been reached.
timestamp
specifies absolute time point in nanoseconds. nanoseconds_t roc::core::timestamp | ( | clock_t | clock | ) |
Get current timestamp in nanoseconds.
nanoseconds_t roc::core::tm_2_nanoseconds | ( | std::tm | tm | ) |
Convert timestamp from broken-down time to nanoseconds format.
const nanoseconds_t roc::core::Day = 24 * Hour |
const nanoseconds_t roc::core::Hour = 60 * Minute |
const nanoseconds_t roc::core::Microsecond = 1000 * Nanosecond |
const nanoseconds_t roc::core::Millisecond = 1000 * Microsecond |
const nanoseconds_t roc::core::Minute = 60 * Second |
const nanoseconds_t roc::core::Nanosecond = 1 |
const nanoseconds_t roc::core::Second = 1000 * Millisecond |