![]() |
Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Basic building blocks. More...
Classes | |
union | MaxAlign |
A union with maximum possible allignment. More... | |
class | Array |
Dynamic array. More... | |
class | Buffer |
Buffer. More... | |
class | BufferPool |
Buffer pool. 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 | NonCopyable |
Base class for non-copyable objects. More... | |
class | SharedPtr |
Shared ownership intrusive pointer. More... | |
struct | RefCntOwnership |
Reference countable object ownership. More... | |
struct | NoOwnership |
No ownership. More... | |
class | Pool |
Pool. More... | |
class | RateLimiter |
Rate limiter. More... | |
class | RefCnt |
Base class for reference countable objects. More... | |
class | ScopedDestructor |
Destroys the object via custom deleter. More... | |
class | ScopedLock |
RAII mutex lock. More... | |
class | Slice |
Slice. More... | |
class | Atomic |
Atomic integer. More... | |
class | Cond |
Condition variable. More... | |
class | Mutex |
Mutex. More... | |
class | Singleton |
Singleton. More... | |
class | Thread |
Base class for thread objects. More... | |
class | CrashHandler |
Crash handler. More... | |
class | errno_to_str |
Convert errno to string. More... | |
class | TempFile |
Temporary file. More... | |
class | Logger |
Logger. More... | |
class | Ticker |
Ticker. More... | |
class | UniquePtr |
Unique ownrship pointer. More... | |
Typedefs | |
typedef void(* | LogHandler) (LogLevel level, const char *module, const char *message) |
Log handler. More... | |
typedef int64_t | nanoseconds_t |
Nanoseconds. More... | |
Enumerations | |
enum | ColorsMode { ColorsDisabled , ColorsEnabled } |
Colors mode. More... | |
Functions | |
size_t | max_align (size_t sz) |
Adjust the given size to be maximum aligned. More... | |
size_t | padding (size_t size, size_t alignment) |
Calculate padding required for given alignment. More... | |
void | print_backtrace () |
Print backtrace to stderr. More... | |
void | print_emergency_backtrace () |
Print backtrace to stderr (emergency mode). More... | |
void | print_emergency_message (const char *str) |
Print message to stderr (emergency mode). More... | |
const char * | demangle (const char *mangled, char *&demangled_buf, size_t &demangled_size) |
Demangle symbol name. More... | |
template<class T1 , class T2 > | |
bool | operator== (const SharedPtr< T1 > &a, const SharedPtr< T2 > &b) |
Equality check. More... | |
bool | colors_available () |
Check if current stderr is connected to a tty. More... | |
bool | format_colored (LogLevel level, const char *str, char *buf, size_t bufsz) |
Fill colored str into buf according to the log level. More... | |
void | crash (const char *message) ROC_ATTR_NORETURN |
Report a crash and abort application. More... | |
uint16_t | ntoh16 (uint16_t v) |
Network to host (16 bits). More... | |
uint32_t | ntoh32 (uint32_t v) |
Network to host (32 bits). More... | |
uint16_t | hton16 (uint16_t v) |
Host to network (16 bits). More... | |
uint32_t | hton32 (uint32_t v) |
Host to network (32 bits). More... | |
void | fast_exit (int code) ROC_ATTR_NORETURN |
Terminate process immediately without calling destructors. More... | |
bool | format_time (char *buf, size_t bufsz) |
Retrieve and format current time. More... | |
unsigned | random (unsigned upper) |
Get random integer. More... | |
unsigned | random (unsigned from, unsigned to) |
Get random integer. More... | |
void | panic (const char *module, const char *file, int line, const char *format,...) ROC_ATTR_NORETURN ROC_ATTR_PRINTF(4 |
Print error message and terminate program gracefully. More... | |
bool | parse_duration (const char *string, nanoseconds_t &result) |
Parse duration from string. More... | |
void | print_buffer (const uint8_t *data, size_t size) |
Print bytes buffer. More... | |
void | print_buffer (const float *data, size_t size) |
Print floats buffer. More... | |
void | print_buffer_slice (const uint8_t *inner, size_t inner_size, const uint8_t *outer, size_t outer_size) |
Print a slice of bytes buffer. More... | |
void | print_buffer_slice (const float *inner, size_t inner_size, const float *outer, size_t outer_size) |
Print a slice of floats buffer. More... | |
nanoseconds_t | timestamp () |
Get current timestamp in nanoseconds. More... | |
void | sleep_until (nanoseconds_t timestamp) |
Sleep until the specified absolute time point has been reached. More... | |
void | sleep_for (nanoseconds_t duration) |
Sleep specified amount of time. More... | |
Variables | |
const LogLevel | DefaultLogLevel = LogError |
Default log level. More... | |
const ColorsMode | DefaultColorsMode = ColorsDisabled |
Default colors mode. More... | |
const nanoseconds_t | Nanosecond = 1 |
One nanosecond represented in nanoseconds. More... | |
const nanoseconds_t | Microsecond = 1000 * Nanosecond |
One microsecond represented in nanoseconds. More... | |
const nanoseconds_t | Millisecond = 1000 * Microsecond |
One millisecond represented in nanoseconds. More... | |
const nanoseconds_t | Second = 1000 * Millisecond |
One second represented in nanoseconds. More... | |
const nanoseconds_t | Minute = 60 * Second |
One minute represented in nanoseconds. More... | |
const nanoseconds_t | Hour = 60 * Minute |
One hour represented in nanoseconds. More... | |
Basic building blocks.
typedef void(* roc::core::LogHandler) (LogLevel level, const char *module, const char *message) |
typedef int64_t roc::core::nanoseconds_t |
bool roc::core::colors_available | ( | ) |
Check if current stderr is connected to a tty.
void roc::core::crash | ( | const char * | message | ) |
Report a crash and abort application.
const char* roc::core::demangle | ( | const char * | mangled, |
char *& | demangled_buf, | ||
size_t & | demangled_size | ||
) |
Demangle symbol name.
This function is not signal-safe.
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
accrodingly. 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::fast_exit | ( | int | code | ) |
Terminate process immediately without calling destructors.
bool roc::core::format_colored | ( | LogLevel | level, |
const char * | str, | ||
char * | buf, | ||
size_t | bufsz | ||
) |
Fill colored str into buf according to the log level.
bool roc::core::format_time | ( | char * | buf, |
size_t | bufsz | ||
) |
Retrieve and format current time.
|
inline |
|
inline |
|
inline |
Adjust the given size to be maximum aligned.
Definition at line 27 of file alignment.h.
|
inline |
|
inline |
|
inline |
Equality check.
Definition at line 124 of file shared_ptr.h.
|
inline |
Calculate padding required for given alignment.
Definition at line 36 of file alignment.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 | ( | ) |
Print backtrace to stderr.
void roc::core::print_buffer | ( | const float * | data, |
size_t | size | ||
) |
Print floats buffer.
void roc::core::print_buffer | ( | const uint8_t * | data, |
size_t | size | ||
) |
Print bytes 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 floats 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 bytes buffer.
void roc::core::print_emergency_backtrace | ( | ) |
Print backtrace to stderr (emergency mode).
void roc::core::print_emergency_message | ( | const char * | str | ) |
Print message to stderr (emergency mode).
unsigned roc::core::random | ( | unsigned | from, |
unsigned | to | ||
) |
Get random integer.
unsigned roc::core::random | ( | unsigned | upper | ) |
Get random integer.
void roc::core::sleep_for | ( | nanoseconds_t | duration | ) |
Sleep specified amount of time.
duration
specifies number of nanoseconds to sleep. void roc::core::sleep_until | ( | 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 | ( | ) |
Get current timestamp in nanoseconds.
const ColorsMode roc::core::DefaultColorsMode = ColorsDisabled |
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 |