Base module

Base module

The base module contains reusable cross platform tools and utilities.

The base module contains reusable cross platform tools and utilities.

Namespaces

NameDescription
hexHexadecimal encoding and decoding helpers.
ipcClasses for inter-process communication.
testModern unit testing framework.
timeClasses and functions for handling time.
base64Base64 encoding and decoding helpers.
deleterDeleter helpers for objects managed through custom destruction routines.
numericInteger parsing and formatting helpers.
basicInterface classes.
fsCross-platform filesystem path and file helpers.
utilMiscellaneous string, parsing, and version utilities.

Classes

NameDescription
PipeNamed pipe / stdio stream built on uv_pipe_t.
IdlerAsynchronous type that triggers callbacks when the event loop is idle.
QueueThread-safe queue container.
RunnableQueueQueue of runnable tasks for sequential execution.
SyncQueueSyncQueue extends Synchronizer to implement a synchronized FIFO queue which receives T objects from any thread and synchronizes them for safe consumption by the associated event loop.
AsyncQueueAsyncQueue is a thread-based queue which receives packets from any thread source and dispatches them asynchronously.
TimerAsynchronous event based timer.
MutableBufferThe MutableBuffer class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
ConstBufferThe ConstBuffer class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
BitReaderClass for reading binary streams.
BitWriterClass for reading/writing binary streams.
DynamicBitWriterClass for reading/writing dynamically resizable binary streams.
LogWriterLog output stream writer.
AsyncLogWriterThread based log output stream writer.
LoggerLogger class.
LogChannelNamed log output channel with configurable severity level and formatting.
ConsoleChannelLog channel that writes formatted messages to standard output.
FileChannelLog channel that writes formatted messages to a file.
RotatingFileChannelLog channel that writes to time-rotated log files.
RefCountedBase class for intrusive reference counting.
IntrusivePtrIntrusive smart pointer for RefCounted objects.
RandomRandom implements a pseudo random number generator (PRNG) using the Mersenne Twister algorithm (std::mt19937).
RunnerRunner is a virtual interface for implementing asynchronous objects such as threads and futures.
Signal< RT(Args...), MutexT >Thread-safe signal and slot implementation for callback-based event dispatch.
StreamBasic stream type for sockets and pipes.
ThreadPlatform-independent wrapper around an operating system thread.
ProcessSpawns and manages a child process with stdin/stdout/stderr pipes.
TimeoutTimeout counter which expires after a given delay. Delay is specified in milliseconds.
TimedTokenToken that expires after the specified duration.
TimestampA Timestamp stores a monotonic* time value with (theoretical) microseconds resolution. Timestamps can be compared with each other and simple arithmetics are supported.
TimespanA class that represents time spans up to microsecond resolution.
DateTimeThis class represents an instant in time, expressed in years, months, days, hours, minutes, seconds and milliseconds based on the Gregorian calendar. The class is mainly useful for conversions between UTC, Julian day and Gregorian calendar dates.
TimezoneThis class provides information about the current timezone.
LocalDateTimeThis class represents an instant in local time (as opposed to UTC), expressed in years, months, days, hours, minutes, seconds and milliseconds based on the Gregorian calendar.
DateTimeFormatDefinition of date/time formats and various constants used by DateTimeFormatter and DateTimeParser.
DateTimeFormatterThis class converts dates and times into strings, supporting a variety of standard and custom formats.
DateTimeParserThis class provides a method for parsing dates and times from strings. All parsing methods do their best to parse a meaningful result, even from malformed input strings.
StopwatchA simple facility to measure time intervals with microsecond resolution.
ThreadedStreamReaderThreaded stream reader class.
StreamWriterPacket stream writer class.
StateState class for state machines.
StatefulState machine implementation.
IRegistryAbstract interface for object registries.
SingletonHelper template class for managing singleton objects allocated on the heap.
KeyedStoreA keyed store of unique_ptr values with optional lifecycle hooks. Not thread-safe; designed for single-threaded event loop contexts.
KVCollectionA keyed value store (values stored by copy, not pointer).
NVCollectionA storage container for a name value collections. This collection can store multiple entries for each name, and it's getters are case-insensitive.
ApplicationMain icey application class.
SyncPacketQueueSynchronized packet queue for event loop integration.
AsyncPacketQueueThread-based asynchronous packet dispatch queue.
RateLimiterToken bucket rate limiter for throttling message send frequency.
PacketStreamAdapterThis class is a wrapper for integrating external classes with the a PacketStream's data flow and state machine.
PacketProcessorThis class is a virtual interface for creating PacketStreamAdapters which process that and emit the IPacket type.
PacketStreamProcesses and broadcasts IPackets through a configurable adapter graph.
SynchronizerSynchronizer enables any thread to communicate with the associated event loop via synchronized callbacks.
TimedManagerTimed pointer manager
IPacketCreationStrategyAbstract strategy for creating typed packets from raw buffer data.
PacketFactoryPriority-ordered factory that creates typed packets from raw buffers using registered strategies.
StreamManagerManages a named collection of PacketStream instances with lifecycle callbacks.
IDiagnosticAbstract interface for diagnostic information providers.
AsyncDiagnosticAsynchronous diagnostic information collector.
DiagnosticManagerRegistry and manager for diagnostic providers.
PacketTransactionRequest/response transaction with timeout and retry logic.
TaskAbstract base class for implementing asynchronous tasks.
TaskRunnerRunner for tasks that inherit the Task interface.
IPacketThe basic packet type which is passed around the icey system. IPacket can be extended for each protocol to enable polymorphic processing and callbacks using PacketStream and friends.
FlagPacketPacket for sending bitwise flags along the packet stream.
RawPacketRawPacket is the default data packet type which consists of an optionally managed char pointer and a size value.
ConfigurationConfiguration is an abstract base class for managing different kinds of configuration storage back ends such as JSON, XML, or database.
ScopedConfigurationScopedConfiguration provides multiple levels of configuration for a module. Multiple levels means that there is a module level scope, and a default scope. When a property is accessed, the module scope value will be used if available, otherwise the default scope value will be used.
ErrorBasic error type.
LogStreamNo-op log record used when logging is compiled out.
LogVoidifyAdapts a LogStream expression to void so the streaming log macros can short-circuit on the level filter inside a ternary (glog-style): the message arguments are never evaluated for filtered-out levels.
NullSharedMutexNo-op mutex for single-threaded signal usage. When all signal operations occur on a single libuv event loop thread, the shared_mutex is unnecessary overhead.
BitwiseContainer for smart management of bitwise integer flags.
AbstractDelegateAbstract delegate interface.
FunctionDelegateThe FunctionDelegate contains a std::function.
ClassDelegateThe ClassDelegate contains a pointer to a class member.
ConstClassDelegateThe ConstClassDelegate contains a pointer to a const class member.
PolymorphicDelegatePolymorphic function delegate.
OptionParserCommand-line option parser.
ShutdownCmdShutdown command packet for signalling process termination.
PacketAdapterReferenceProvides a reference to a PacketStreamAdapter with optional ownership.
PacketStreamStateState machine states for PacketStream.
PacketCreationStrategyThis template class implements an adapter that sits between an SignalBase and an object receiving notifications from it.
SharedLibraryLoads a shared library at runtime and resolves exported symbols.
DiagnosticStateState definitions for diagnostic providers.
TransactionStateState machine states for PacketTransaction.
IPacketInfoAn abstract interface for packet sources to provide extra information about packets.

Macros


expect

#define expect(x) icy::test::expectImpl(x, #x, __FILE__, __LINE__)

Defined in src/base/include/icy/test.h:67


CLASS_FUNCTION

#define __CLASS_FUNCTION__ _methodName(__PRETTY_FUNCTION__)

Defined in src/base/include/icy/logger.h:624


ICY_LOG_STREAM

#define ICY_LOG_STREAM(lvl) !icy::Logger::levelEnabled(lvl)                                            \
        ? (void)0                                                              \
        : icy::LogVoidify() &                                                  \
            icy::LogStream(lvl, icy::_fileName(__FILE__), __LINE__)

Defined in src/base/include/icy/logger.h:634


STrace

#define STrace ICY_LOG_STREAM(icy::Level::Trace)

Defined in src/base/include/icy/logger.h:640


SDebug

#define SDebug ICY_LOG_STREAM(icy::Level::Debug)

Defined in src/base/include/icy/logger.h:641


SInfo

#define SInfo ICY_LOG_STREAM(icy::Level::Info)

Defined in src/base/include/icy/logger.h:642


SWarn

#define SWarn ICY_LOG_STREAM(icy::Level::Warn)

Defined in src/base/include/icy/logger.h:643


SError

#define SError ICY_LOG_STREAM(icy::Level::Error)

Defined in src/base/include/icy/logger.h:644


ICY_LOG_WRITE

#define ICY_LOG_WRITE(lvl, ...) do {                                                                       \
        if (icy::Logger::levelEnabled(lvl))                                    \
            icy::LogStream(lvl, icy::_fileName(__FILE__), __LINE__)            \
                .write(__VA_ARGS__);                                           \
    } while (0)

Defined in src/base/include/icy/logger.h:646


LTrace

#define LTrace(...) ICY_LOG_WRITE(icy::Level::Trace, __VA_ARGS__)

Defined in src/base/include/icy/logger.h:653


LDebug

#define LDebug(...) ICY_LOG_WRITE(icy::Level::Debug, __VA_ARGS__)

Defined in src/base/include/icy/logger.h:654


LInfo

#define LInfo(...) ICY_LOG_WRITE(icy::Level::Info, __VA_ARGS__)

Defined in src/base/include/icy/logger.h:655


LWarn

#define LWarn(...) ICY_LOG_WRITE(icy::Level::Warn, __VA_ARGS__)

Defined in src/base/include/icy/logger.h:656


LError

#define LError(...) ICY_LOG_WRITE(icy::Level::Error, __VA_ARGS__)

Defined in src/base/include/icy/logger.h:657

Enumerations

NameDescription
LevelLogging severity levels used by Logger and LogChannel.
ByteOrderByte-order policy used when reading or writing multi-byte integers.
PacketRetentionDescribes how an adapter treats incoming packet lifetime beyond the current synchronous call chain.
PacketFlagsFlags which determine how the packet is handled by the PacketStream.

Level

enum Level

Defined in src/base/include/icy/logger.h:38

Logging severity levels used by Logger and LogChannel.

ValueDescription
TraceMost verbose diagnostic output.
DebugDebug-only diagnostic output.
InfoNormal informational output.
WarnWarning output for recoverable problems.
ErrorError output for failed operations.
FatalFatal output immediately before termination.

ByteOrder

enum ByteOrder

Defined in src/base/include/icy/byteorder.h:31

Byte-order policy used when reading or writing multi-byte integers.

ValueDescription
NetworkDefault, use network byte order (big endian).
HostUse the native order of the host.

PacketRetention

enum PacketRetention

Defined in src/base/include/icy/packetstream.h:202

Describes how an adapter treats incoming packet lifetime beyond the current synchronous call chain.

Borrowed adapters must finish using the packet before emit()/process() returns. Cloned and Retained adapters are explicit ownership boundaries: callers may mutate or free borrowed input only after such a boundary, or after the whole synchronous write/emit call has returned.

ValueDescription
BorrowedPacket is only used synchronously during the current emit/process call.
ClonedAdapter makes its own copy before deferred or asynchronous use.
RetainedAdapter retains the original packet object beyond the current call chain.

PacketFlags

enum PacketFlags

Defined in src/base/include/icy/packetstream.h:211

Flags which determine how the packet is handled by the PacketStream.

ValueDescription
NoModifyThe packet should not be modified by processors.
FinalThe final packet in the stream.

Typedefs

ReturnNameDescription
std::vector< char >BufferCore buffer type.
LogChannelNullChannelNull log channel.
Signal< void()>NullSignalZero-argument signal alias used for simple local event notifications.
Signal< RT, std::shared_mutex >ThreadSignalCross-thread signal variant.
Signal< RT, NullSharedMutex >LocalSignalCompatibility alias for the single-threaded fast path.
uv_process_options_tProcessOptionsRaw libuv process spawn options passed through to uv_spawn.
std::map< std::string, std::string >StringMapGeneric string-to-string map used for headers, options, and environment-style metadata.
std::vector< std::string >StringVecGeneric string vector used for argument lists and ordered string collections.
std::map< std::string, std::string >OptionMapCommand Line Option Parser.
Signal< void(IPacket &)>PacketSignalSignal that broadcasts IPacket types.
PacketStreamAdapterPacketSourceFor 0.8.x compatibility.
PacketProcessorIPacketizerCompatibility alias for a packet processor that packetizes stream output.
PacketProcessorIDepacketizerFor 0.8.x compatibility.
std::vector< PacketAdapterReference::Ptr >PacketAdapterVecOrdered list of packet adapter references used for sources and processors.
std::vector< PacketStream * >PacketStreamVecNon-owning list of packet stream pointers used for graph traversal helpers.
std::vector< PacketStream::Ptr >PacketStreamPtrVecOwning list of packet stream handles retained across stream graphs.
std::unique_ptr< IPacketCreationStrategy >PacketCreationStrategyPtrOwning handle for one packet creation strategy.
std::vector< PacketCreationStrategyPtr >PacketCreationStrategyListOrdered list of packet creation strategies consulted by a packet factory.

Buffer

using Buffer = std::vector< char >

Defined in src/base/include/icy/buffer.h:29

Core buffer type.


NullChannel

using NullChannel = LogChannel

Type: LogChannel

Defined in src/base/include/icy/logger.h:447

Null log channel.

Redifine the base LogChannel as NullChannel so it can be logically used as a disabled log channel.


NullSignal

using NullSignal = Signal< void()>

Type: Signal< void()>

Defined in src/base/include/icy/signal.h:636

Zero-argument signal alias used for simple local event notifications.


ThreadSignal

using ThreadSignal = Signal< RT, std::shared_mutex >

Type: Signal< RT, std::shared_mutex >

Defined in src/base/include/icy/signal.h:640

Cross-thread signal variant.


LocalSignal

using LocalSignal = Signal< RT, NullSharedMutex >

Type: Signal< RT, NullSharedMutex >

Defined in src/base/include/icy/signal.h:644

Compatibility alias for the single-threaded fast path.


ProcessOptions

using ProcessOptions = uv_process_options_t

Defined in src/base/include/icy/process.h:28

Raw libuv process spawn options passed through to uv_spawn.


StringMap

using StringMap = std::map< std::string, std::string >

Defined in src/base/include/icy/collection.h:275

Generic string-to-string map used for headers, options, and environment-style metadata.


StringVec

using StringVec = std::vector< std::string >

Defined in src/base/include/icy/collection.h:278

Generic string vector used for argument lists and ordered string collections.


OptionMap

using OptionMap = std::map< std::string, std::string >

Defined in src/base/include/icy/application.h:100

Command Line Option Parser.


PacketSignal

using PacketSignal = Signal< void(IPacket &)>

Type: Signal< void(IPacket &)>

Defined in src/base/include/icy/packetsignal.h:24

Signal that broadcasts IPacket types.


PacketSource

using PacketSource = PacketStreamAdapter

Type: PacketStreamAdapter

Defined in src/base/include/icy/packetstream.h:106

For 0.8.x compatibility.


IPacketizer

using IPacketizer = PacketProcessor

Type: PacketProcessor

Defined in src/base/include/icy/packetstream.h:141

Compatibility alias for a packet processor that packetizes stream output.


IDepacketizer

using IDepacketizer = PacketProcessor

Type: PacketProcessor

Defined in src/base/include/icy/packetstream.h:142

For 0.8.x compatibility.


PacketAdapterVec

using PacketAdapterVec = std::vector< PacketAdapterReference::Ptr >

Type: std::vector< PacketAdapterReference::Ptr >

Defined in src/base/include/icy/packetstream.h:192

Ordered list of packet adapter references used for sources and processors.


PacketStreamVec

using PacketStreamVec = std::vector< PacketStream * >

Type: std::vector< PacketStream * >

Defined in src/base/include/icy/packetstream.h:653

Non-owning list of packet stream pointers used for graph traversal helpers.


PacketStreamPtrVec

using PacketStreamPtrVec = std::vector< PacketStream::Ptr >

Type: std::vector< PacketStream::Ptr >

Defined in src/base/include/icy/packetstream.h:656

Owning list of packet stream handles retained across stream graphs.


PacketCreationStrategyPtr

using PacketCreationStrategyPtr = std::unique_ptr< IPacketCreationStrategy >

Type: std::unique_ptr< IPacketCreationStrategy >

Defined in src/base/include/icy/packetfactory.h:46

Owning handle for one packet creation strategy.


PacketCreationStrategyList

using PacketCreationStrategyList = std::vector< PacketCreationStrategyPtr >

Type: std::vector< PacketCreationStrategyPtr >

Defined in src/base/include/icy/packetfactory.h:49

Ordered list of packet creation strategies consulted by a packet factory.

Functions

ReturnNameDescription
voidrunOnceSchedules func to run once at the beginning of the next event loop iteration. Uses a uv_prepare_t handle that self-destructs after the first invocation.
std::stringformatError inlineFormats a human-readable error string from a message and a libuv error code. If err is not UV_UNKNOWN, the libuv error description is appended after a colon.
voidthrowError inlineThrows a std::runtime_error with a formatted error message.
MutableBuffermutableBuffer inlineCreates a MutableBuffer from an arbitrary pointer and size.
MutableBuffermutableBuffer inlineCreates a MutableBuffer from a std::string.
MutableBuffermutableBuffer inlineCreates a MutableBuffer from a const std::string. Casts away constness; use with care.
MutableBuffermutableBuffer inlineCreates a MutableBuffer from a const std::vector. Casts away constness; use with care.
MutableBuffermutableBuffer inlineCreates a MutableBuffer from a Buffer.
MutableBuffermutableBuffer inlineCreates a MutableBuffer from a const Buffer. Casts away constness; use with care.
ConstBufferconstBuffer inlineCreates a ConstBuffer from an arbitrary pointer and size.
ConstBufferconstBuffer inlineCreates a ConstBuffer from a std::string.
ConstBufferconstBuffer inlineCreates a ConstBuffer from a std::vector.
constexpr ConstBufferconstBuffer inline constexprCreates a ConstBuffer from a MutableBuffer.
ConstBufferconstBuffer inlineCreates a ConstBuffer from a Buffer.
ConstBufferconstBuffer inlineCreates a ConstBuffer from a const Buffer. Casts away constness internally; use with care.
constexpr PointerToPodTypebufferCast inline constexprCasts a MutableBuffer to a specified pointer-to-POD type.
constexpr PointerToPodTypebufferCast inline constexprCasts a ConstBuffer to a specified pointer-to-POD type.
LevelgetLevelFromString inlineConverts a log level string to its corresponding Level enum value. Unrecognized strings default to Level::Trace.
const char *getStringFromLevel inlineConverts a Level enum value to its lowercase string representation.
voidlogArgsWrite a single logging argument into the destination stream.
voidlogArgsWrite multiple logging arguments into the destination stream in order.
constexpr const char *str_end constexprReturn a pointer to the null terminator of a C string.
constexpr boolstr_slant constexprReturn true if the C string contains a forward or back slash.
constexpr const char *r_slant constexprWalk backward to the character after the last path separator.
constexpr const char *_fileName constexprReturn the filename portion of a compile-time path string.
std::string_methodName inlineExtract the class-qualified method name from a compiler pretty-function string.
voiddeleteLater inlineSchedules deferred deletion of ptr on the next event loop iteration. This is essential for deleting objects that may still be referenced by pending libuv callbacks (e.g. socket adapters with in-flight I/O). Uses a self-cleaning uv_idle_t handle that fires once and then closes itself.
IntrusivePtr< T >makeIntrusiveCreates an IntrusivePtr managing a newly heap-allocated T. Equivalent to std::make_shared.
std::shared_ptr< internal::Slot< RT, Args... > >slotCreates a slot that binds a non-const class member function to an instance.
std::shared_ptr< internal::Slot< RT, Args... > >slotCreates a slot that wraps a free (static) function pointer.
voidswap inlineExchange two DateTime values.
voidswap inlineExchange two LocalDateTime values.
voidswap inlineExchange two Timestamp values.
voidswap inlineExchange two Timespan values.
std::stringgetExePathCross-platform utilities.
std::stringgetCwdReturn the current working directory.
uint64_tgetFreeMemoryReturns the current amount of free memory.
uint64_tgetTotalMemoryReturns the current amount of used memory.
intnumCpuCoresReturns the number of CPU cores.
voidsleepPause the current thread for the given ms duration.
voidpausePause the current thread until enter is pressed.
std::stringgetHostnameReturn the system hostname.
std::stringgetEnvReturn an environment variable or the default value.
boolgetEnvBoolReturn an environment variable boolean or the default value. The variable must be 1 or true for this function to return true.
voidset8 inlineWrites a single byte at the given offset in memory.
uint8_tget8 inlineReads a single byte at the given offset from memory.
voidsetBE16 inlineWrites a 16-bit value to memory in big-endian byte order.
voidsetBE32 inlineWrites a 32-bit value to memory in big-endian byte order.
voidsetBE64 inlineWrites a 64-bit value to memory in big-endian byte order.
uint16_tgetBE16 inlineReads a 16-bit big-endian value from memory.
uint32_tgetBE32 inlineReads a 32-bit big-endian value from memory.
uint64_tgetBE64 inlineReads a 64-bit big-endian value from memory.
voidsetLE16 inlineWrites a 16-bit value to memory in little-endian byte order.
voidsetLE32 inlineWrites a 32-bit value to memory in little-endian byte order.
voidsetLE64 inlineWrites a 64-bit value to memory in little-endian byte order.
uint16_tgetLE16 inlineReads a 16-bit little-endian value from memory.
uint32_tgetLE32 inlineReads a 32-bit little-endian value from memory.
uint64_tgetLE64 inlineReads a 64-bit little-endian value from memory.
boolisBigEndian inlineReturns true if the host CPU is big-endian.
uint16_thostToNetwork16 inlineConverts a 16-bit value from host byte order to network (big-endian) byte order.
uint32_thostToNetwork32 inlineConverts a 32-bit value from host byte order to network (big-endian) byte order.
uint64_thostToNetwork64 inlineConverts a 64-bit value from host byte order to network (big-endian) byte order.
uint16_tnetworkToHost16 inlineConverts a 16-bit value from network (big-endian) byte order to host byte order.
uint32_tnetworkToHost32 inlineConverts a 32-bit value from network (big-endian) byte order to host byte order.
uint64_tnetworkToHost64 inlineConverts a 64-bit value from network (big-endian) byte order to host byte order.
voidonShutdownSignal inlineInstalls a SIGINT handler on the given event loop. When the signal fires, callback is invoked with opaque and the signal handle is closed.
voidwaitForShutdown inlineInstalls a SIGINT handler and runs the event loop until shutdown. Equivalent to calling onShutdownSignal() then uv_run().
std::shared_ptr< internal::Slot< RT, IT & > >packetSlotCreates a signal slot that filters by packet subtype PT before invoking method.
constexpr unsigned[`operator](#operator) constexpr`
RawPacketrawPacket inlineConstructs a non-owning RawPacket from a mutable buffer (borrowed pointer).
RawPacketrawPacket inlineConstructs an owning RawPacket from a const buffer (data is copied).
RawPacketrawPacket inlineConstructs a non-owning RawPacket from a raw mutable pointer (borrowed).
RawPacketrawPacket inlineConstructs an owning RawPacket from a const char pointer (data is copied).

runOnce

template<typename Function, typename... Args> void runOnce(uv::Loop * loop, Function && func, Args &&... args)

Defined in src/base/include/icy/once.h:29

Schedules func to run once at the beginning of the next event loop iteration. Uses a uv_prepare_t handle that self-destructs after the first invocation.

Parameters

ParameterTypeDescription
loopuv::Loop *Event loop on which to schedule the callback.
funcFunction &&Callable to invoke on the next loop tick.
argsArgs &&...Arguments forwarded to func.

formatError

inline

inline std::string formatError(std::string_view message, int err = UV_UNKNOWN)

Defined in src/base/include/icy/error.h:101

Formats a human-readable error string from a message and a libuv error code. If err is not UV_UNKNOWN, the libuv error description is appended after a colon.

Returns

Formatted error string.

Parameters

ParameterTypeDescription
messagestd::string_viewDescriptive context for the error.
errintlibuv error code (e.g. from a failed uv_* call). Defaults to UV_UNKNOWN.

throwError

inline

inline void throwError(std::string_view message, int err = UV_UNKNOWN)

Defined in src/base/include/icy/error.h:116

Throws a std::runtime_error with a formatted error message.

Parameters

ParameterTypeDescription
messagestd::string_viewDescriptive context for the error.
errintlibuv error code to append. Defaults to UV_UNKNOWN.

mutableBuffer

inline

template<typename T> inline MutableBuffer mutableBuffer(T data, size_t size)

Defined in src/base/include/icy/buffer.h:82

Creates a MutableBuffer from an arbitrary pointer and size.

Returns

MutableBuffer referencing the given memory.

Parameters

ParameterTypeDescription
dataTPointer to the start of the memory region.
sizesize_tNumber of bytes in the region.

mutableBuffer

inline

inline MutableBuffer mutableBuffer(std::string & str)

Defined in src/base/include/icy/buffer.h:90

Creates a MutableBuffer from a std::string.

Returns

MutableBuffer wrapping the string's internal storage.

Parameters

ParameterTypeDescription
strstd::string &Source string. Must remain valid while the buffer is in use.

mutableBuffer

inline

inline MutableBuffer mutableBuffer(const std::string & str)

Defined in src/base/include/icy/buffer.h:100

Creates a MutableBuffer from a const std::string. Casts away constness; use with care.

Returns

MutableBuffer wrapping the string's internal storage.

Parameters

ParameterTypeDescription
strconst std::string &Source string. Must remain valid while the buffer is in use.

mutableBuffer

inline

template<typename T> inline MutableBuffer mutableBuffer(const std::vector< T > & vec)

Defined in src/base/include/icy/buffer.h:111

Creates a MutableBuffer from a const std::vector. Casts away constness; use with care.

Returns

MutableBuffer wrapping the vector's internal storage.

Parameters

ParameterTypeDescription
vecconst std::vector< T > &Source vector. Must remain valid while the buffer is in use.

mutableBuffer

inline

inline MutableBuffer mutableBuffer(Buffer & buf)

Defined in src/base/include/icy/buffer.h:119

Creates a MutableBuffer from a Buffer.

Returns

MutableBuffer wrapping the buffer's data.

Parameters

ParameterTypeDescription
bufBuffer &Source buffer. Must remain valid while the buffer is in use.

mutableBuffer

inline

inline MutableBuffer mutableBuffer(const Buffer & buf)

Defined in src/base/include/icy/buffer.h:128

Creates a MutableBuffer from a const Buffer. Casts away constness; use with care.

Returns

MutableBuffer wrapping the buffer's data.

Parameters

ParameterTypeDescription
bufconst Buffer &Source buffer. Must remain valid while the buffer is in use.

constBuffer

inline

template<typename T> inline ConstBuffer constBuffer(T data, size_t size)

Defined in src/base/include/icy/buffer.h:187

Creates a ConstBuffer from an arbitrary pointer and size.

Returns

ConstBuffer referencing the given memory.

Parameters

ParameterTypeDescription
dataTPointer to the start of the memory region.
sizesize_tNumber of bytes in the region.

constBuffer

inline

inline ConstBuffer constBuffer(const std::string & str)

Defined in src/base/include/icy/buffer.h:195

Creates a ConstBuffer from a std::string.

Returns

ConstBuffer wrapping the string's internal storage.

Parameters

ParameterTypeDescription
strconst std::string &Source string. Must remain valid while the buffer is in use.

constBuffer

inline

template<typename T> inline ConstBuffer constBuffer(const std::vector< T > & vec)

Defined in src/base/include/icy/buffer.h:205

Creates a ConstBuffer from a std::vector.

Returns

ConstBuffer wrapping the vector's internal storage.

Parameters

ParameterTypeDescription
vecconst std::vector< T > &Source vector. Must remain valid while the buffer is in use.

constBuffer

inline constexpr

constexpr inline constexpr ConstBuffer constBuffer(const MutableBuffer & buf)

Defined in src/base/include/icy/buffer.h:213

Creates a ConstBuffer from a MutableBuffer.

Returns

ConstBuffer referencing the same memory region.

Parameters

ParameterTypeDescription
bufconst MutableBuffer &Source mutable buffer.

constBuffer

inline

template<typename T> inline ConstBuffer constBuffer(Buffer & buf)

Defined in src/base/include/icy/buffer.h:223

Creates a ConstBuffer from a Buffer.

Returns

ConstBuffer wrapping the buffer's data.

Parameters

ParameterTypeDescription
bufBuffer &Source buffer. Must remain valid while the buffer is in use.

constBuffer

inline

template<typename T> inline ConstBuffer constBuffer(const Buffer & buf)

Defined in src/base/include/icy/buffer.h:234

Creates a ConstBuffer from a const Buffer. Casts away constness internally; use with care.

Returns

ConstBuffer wrapping the buffer's data.

Parameters

ParameterTypeDescription
bufconst Buffer &Source buffer. Must remain valid while the buffer is in use.

bufferCast

inline constexpr

template<typename PointerToPodType> constexpr inline constexpr PointerToPodType bufferCast(const MutableBuffer & b)

Defined in src/base/include/icy/buffer.h:250

Casts a MutableBuffer to a specified pointer-to-POD type.

Returns

Pointer to the buffer's data, cast to PointerToPodType.

Parameters

ParameterTypeDescription
bconst MutableBuffer &Source mutable buffer.

bufferCast

inline constexpr

template<typename PointerToPodType> constexpr inline constexpr PointerToPodType bufferCast(const ConstBuffer & b)

Defined in src/base/include/icy/buffer.h:261

Casts a ConstBuffer to a specified pointer-to-POD type.

Returns

Pointer to the buffer's data, cast to PointerToPodType.

Parameters

ParameterTypeDescription
bconst ConstBuffer &Source const buffer.

getLevelFromString

inline

inline Level getLevelFromString(const char * level)

Defined in src/base/include/icy/logger.h:53

Converts a log level string to its corresponding Level enum value. Unrecognized strings default to Level::Trace.

Returns

The matching Level enum value.

Parameters

ParameterTypeDescription
levelconst char *Lowercase level string: "trace", "debug", "info", "warn", "error", or "fatal".

getStringFromLevel

inline

inline const char * getStringFromLevel(Level level)

Defined in src/base/include/icy/logger.h:74

Converts a Level enum value to its lowercase string representation.

Returns

Lowercase C string: "trace", "debug", "info", "warn", "error", or "fatal".

Parameters

ParameterTypeDescription
levelLevelThe log level to convert.

logArgs

template<typename T> void logArgs(std::ostream & o, T && t)

Defined in src/base/include/icy/logger.h:255

Write a single logging argument into the destination stream.

Parameters

ParameterTypeDescription
ostd::ostream &Destination stream.
tT &&Argument to append with operator<<.

logArgs

template<typename T, typename... Args> void logArgs(std::ostream & o, T && t, Args &&... args)

Defined in src/base/include/icy/logger.h:265

Write multiple logging arguments into the destination stream in order.

Parameters

ParameterTypeDescription
ostd::ostream &Destination stream.
tT &&First argument to append.
argsArgs &&...Remaining arguments to append recursively.

str_end

constexpr

constexpr constexpr const char * str_end(const char * str)

Defined in src/base/include/icy/logger.h:582

Return a pointer to the null terminator of a C string.


str_slant

constexpr

constexpr constexpr bool str_slant(const char * str)

Defined in src/base/include/icy/logger.h:588

Return true if the C string contains a forward or back slash.


r_slant

constexpr

constexpr constexpr const char * r_slant(const char * str)

Defined in src/base/include/icy/logger.h:594

Walk backward to the character after the last path separator.


_fileName

constexpr

constexpr constexpr const char * _fileName(const char * str)

Defined in src/base/include/icy/logger.h:600

Return the filename portion of a compile-time path string.


_methodName

inline

inline std::string _methodName(std::string_view fsig)

Defined in src/base/include/icy/logger.h:617

Extract the class-qualified method name from a compiler pretty-function string.


deleteLater

inline

template<typename T> inline void deleteLater(T * ptr, uv::Loop * loop)

Defined in src/base/include/icy/memory.h:32

Schedules deferred deletion of ptr on the next event loop iteration. This is essential for deleting objects that may still be referenced by pending libuv callbacks (e.g. socket adapters with in-flight I/O). Uses a self-cleaning uv_idle_t handle that fires once and then closes itself.

Parameters

ParameterTypeDescription
ptrT *Object to delete. Does nothing if nullptr.
loopuv::Loop *Event loop on which to schedule the deletion.

makeIntrusive

template<typename T, typename... Args> IntrusivePtr< T > makeIntrusive(Args &&... args)

Defined in src/base/include/icy/memory.h:206

Creates an IntrusivePtr managing a newly heap-allocated T. Equivalent to std::make_shared.

Returns

IntrusivePtr owning the new object.

Parameters

ParameterTypeDescription
argsArgs &&...Arguments forwarded to T's constructor.

slot

template<class Class, class RT, typename... Args> std::shared_ptr< internal::Slot< RT, Args... > > slot(Class * instance, RT(Class::*)(Args...) method, int id = -1, int priority = -1)

Defined in src/base/include/icy/signal.h:667

Creates a slot that binds a non-const class member function to an instance.

The returned SlotPtr can be passed to Signal::attach() or operator+=, and to Signal::detach() or operator-= to disconnect it later.

Returns

A SlotPtr ready to attach to a compatible Signal.

Creates a slot that binds a const class member function to an instance. Uses the same slot ID and priority rules as the non-const overload above.

Parameters

ParameterTypeDescription
instanceClass *Pointer to the object on which method will be called.
methodRT(Class::*)(Args...)Pointer to the non-const member function to bind.
idintExplicit slot ID to assign; pass -1 to auto-assign.
priorityintHigher values are called first; pass -1 for default ordering.

slot

template<class RT, typename... Args> std::shared_ptr< internal::Slot< RT, Args... > > slot(RT(*)(Args...) method, int id = -1, int priority = -1)

Defined in src/base/include/icy/signal.h:693

Creates a slot that wraps a free (static) function pointer.

Returns

A SlotPtr ready to attach to a compatible Signal.

Parameters

ParameterTypeDescription
methodRT(*)(Args...)Pointer to the free function to bind.
idintExplicit slot ID to assign; pass -1 to auto-assign.
priorityintHigher values are called first; pass -1 for default ordering.

swap

inline

inline void swap(DateTime & d1, DateTime & d2)

Defined in src/base/include/icy/datetime.h:631

Exchange two DateTime values.


swap

inline

inline void swap(LocalDateTime & d1, LocalDateTime & d2)

Defined in src/base/include/icy/datetime.h:1044

Exchange two LocalDateTime values.


swap

inline

inline void swap(Timestamp & s1, Timestamp & s2)

Defined in src/base/include/icy/datetime.h:1491

Exchange two Timestamp values.


swap

inline

inline void swap(Timespan & s1, Timespan & s2)

Defined in src/base/include/icy/datetime.h:1647

Exchange two Timespan values.


getExePath

std::string getExePath()

Defined in src/base/include/icy/platform.h:30

Cross-platform utilities.

Returns the current executable path.


getCwd

std::string getCwd()

Defined in src/base/include/icy/platform.h:33

Return the current working directory.


getFreeMemory

uint64_t getFreeMemory()

Defined in src/base/include/icy/platform.h:36

Returns the current amount of free memory.


getTotalMemory

uint64_t getTotalMemory()

Defined in src/base/include/icy/platform.h:39

Returns the current amount of used memory.


numCpuCores

int numCpuCores()

Defined in src/base/include/icy/platform.h:42

Returns the number of CPU cores.


sleep

void sleep(int ms)

Defined in src/base/include/icy/platform.h:45

Pause the current thread for the given ms duration.


pause

void pause()

Defined in src/base/include/icy/platform.h:48

Pause the current thread until enter is pressed.


getHostname

std::string getHostname()

Defined in src/base/include/icy/platform.h:51

Return the system hostname.


getEnv

std::string getEnv(std::string_view name, std::string_view defaultValue = "")

Defined in src/base/include/icy/platform.h:54

Return an environment variable or the default value.


getEnvBool

bool getEnvBool(std::string_view name)

Defined in src/base/include/icy/platform.h:58

Return an environment variable boolean or the default value. The variable must be 1 or true for this function to return true.


set8

inline

inline void set8(void * memory, size_t offset, uint8_t v)

Defined in src/base/include/icy/byteorder.h:42

Writes a single byte at the given offset in memory.

Parameters

ParameterTypeDescription
memoryvoid *Pointer to the destination buffer.
offsetsize_tByte offset within the buffer.
vuint8_tValue to write.

get8

inline

inline uint8_t get8(const void * memory, size_t offset)

Defined in src/base/include/icy/byteorder.h:51

Reads a single byte at the given offset from memory.

Returns

The byte value at the specified offset.

Parameters

ParameterTypeDescription
memoryconst void *Pointer to the source buffer.
offsetsize_tByte offset within the buffer.

setBE16

inline

inline void setBE16(void * memory, uint16_t v)

Defined in src/base/include/icy/byteorder.h:59

Writes a 16-bit value to memory in big-endian byte order.

Parameters

ParameterTypeDescription
memoryvoid *Pointer to the destination buffer (must be at least 2 bytes).
vuint16_tValue to write.

setBE32

inline

inline void setBE32(void * memory, uint32_t v)

Defined in src/base/include/icy/byteorder.h:68

Writes a 32-bit value to memory in big-endian byte order.

Parameters

ParameterTypeDescription
memoryvoid *Pointer to the destination buffer (must be at least 4 bytes).
vuint32_tValue to write.

setBE64

inline

inline void setBE64(void * memory, uint64_t v)

Defined in src/base/include/icy/byteorder.h:79

Writes a 64-bit value to memory in big-endian byte order.

Parameters

ParameterTypeDescription
memoryvoid *Pointer to the destination buffer (must be at least 8 bytes).
vuint64_tValue to write.

getBE16

inline

inline uint16_t getBE16(const void * memory)

Defined in src/base/include/icy/byteorder.h:94

Reads a 16-bit big-endian value from memory.

Returns

The 16-bit value in host byte order.

Parameters

ParameterTypeDescription
memoryconst void *Pointer to the source buffer (must be at least 2 bytes).

getBE32

inline

inline uint32_t getBE32(const void * memory)

Defined in src/base/include/icy/byteorder.h:103

Reads a 32-bit big-endian value from memory.

Returns

The 32-bit value in host byte order.

Parameters

ParameterTypeDescription
memoryconst void *Pointer to the source buffer (must be at least 4 bytes).

getBE64

inline

inline uint64_t getBE64(const void * memory)

Defined in src/base/include/icy/byteorder.h:114

Reads a 64-bit big-endian value from memory.

Returns

The 64-bit value in host byte order.

Parameters

ParameterTypeDescription
memoryconst void *Pointer to the source buffer (must be at least 8 bytes).

setLE16

inline

inline void setLE16(void * memory, uint16_t v)

Defined in src/base/include/icy/byteorder.h:129

Writes a 16-bit value to memory in little-endian byte order.

Parameters

ParameterTypeDescription
memoryvoid *Pointer to the destination buffer (must be at least 2 bytes).
vuint16_tValue to write.

setLE32

inline

inline void setLE32(void * memory, uint32_t v)

Defined in src/base/include/icy/byteorder.h:138

Writes a 32-bit value to memory in little-endian byte order.

Parameters

ParameterTypeDescription
memoryvoid *Pointer to the destination buffer (must be at least 4 bytes).
vuint32_tValue to write.

setLE64

inline

inline void setLE64(void * memory, uint64_t v)

Defined in src/base/include/icy/byteorder.h:149

Writes a 64-bit value to memory in little-endian byte order.

Parameters

ParameterTypeDescription
memoryvoid *Pointer to the destination buffer (must be at least 8 bytes).
vuint64_tValue to write.

getLE16

inline

inline uint16_t getLE16(const void * memory)

Defined in src/base/include/icy/byteorder.h:164

Reads a 16-bit little-endian value from memory.

Returns

The 16-bit value in host byte order.

Parameters

ParameterTypeDescription
memoryconst void *Pointer to the source buffer (must be at least 2 bytes).

getLE32

inline

inline uint32_t getLE32(const void * memory)

Defined in src/base/include/icy/byteorder.h:173

Reads a 32-bit little-endian value from memory.

Returns

The 32-bit value in host byte order.

Parameters

ParameterTypeDescription
memoryconst void *Pointer to the source buffer (must be at least 4 bytes).

getLE64

inline

inline uint64_t getLE64(const void * memory)

Defined in src/base/include/icy/byteorder.h:184

Reads a 64-bit little-endian value from memory.

Returns

The 64-bit value in host byte order.

Parameters

ParameterTypeDescription
memoryconst void *Pointer to the source buffer (must be at least 8 bytes).

isBigEndian

inline

inline bool isBigEndian()

Defined in src/base/include/icy/byteorder.h:198

Returns true if the host CPU is big-endian.

Returns

true if the host byte order is big-endian, false if little-endian.


hostToNetwork16

inline

inline uint16_t hostToNetwork16(uint16_t n)

Defined in src/base/include/icy/byteorder.h:207

Converts a 16-bit value from host byte order to network (big-endian) byte order.

Returns

Value in network byte order.

Parameters

ParameterTypeDescription
nuint16_tValue in host byte order.

hostToNetwork32

inline

inline uint32_t hostToNetwork32(uint32_t n)

Defined in src/base/include/icy/byteorder.h:217

Converts a 32-bit value from host byte order to network (big-endian) byte order.

Returns

Value in network byte order.

Parameters

ParameterTypeDescription
nuint32_tValue in host byte order.

hostToNetwork64

inline

inline uint64_t hostToNetwork64(uint64_t n)

Defined in src/base/include/icy/byteorder.h:227

Converts a 64-bit value from host byte order to network (big-endian) byte order.

Returns

Value in network byte order.

Parameters

ParameterTypeDescription
nuint64_tValue in host byte order.

networkToHost16

inline

inline uint16_t networkToHost16(uint16_t n)

Defined in src/base/include/icy/byteorder.h:237

Converts a 16-bit value from network (big-endian) byte order to host byte order.

Returns

Value in host byte order.

Parameters

ParameterTypeDescription
nuint16_tValue in network byte order.

networkToHost32

inline

inline uint32_t networkToHost32(uint32_t n)

Defined in src/base/include/icy/byteorder.h:245

Converts a 32-bit value from network (big-endian) byte order to host byte order.

Returns

Value in host byte order.

Parameters

ParameterTypeDescription
nuint32_tValue in network byte order.

networkToHost64

inline

inline uint64_t networkToHost64(uint64_t n)

Defined in src/base/include/icy/byteorder.h:253

Converts a 64-bit value from network (big-endian) byte order to host byte order.

Returns

Value in host byte order.

Parameters

ParameterTypeDescription
nuint64_tValue in network byte order.

onShutdownSignal

inline

inline void onShutdownSignal(std::function< void(void *)> callback = nullptr, void * opaque = nullptr, uv::Loop * loop = uv::defaultLoop())

Defined in src/base/include/icy/application.h:163

Installs a SIGINT handler on the given event loop. When the signal fires, callback is invoked with opaque and the signal handle is closed.

Parameters

ParameterTypeDescription
callbackstd::function< void(void *)>Optional function called on SIGINT.
opaquevoid *Optional user data pointer passed to the callback.
loopuv::Loop *Event loop to attach the signal watcher to.

waitForShutdown

inline

inline void waitForShutdown(std::function< void(void *)> callback = nullptr, void * opaque = nullptr, uv::Loop * loop = uv::defaultLoop())

Defined in src/base/include/icy/application.h:187

Installs a SIGINT handler and runs the event loop until shutdown. Equivalent to calling onShutdownSignal() then uv_run().

Parameters

ParameterTypeDescription
callbackstd::function< void(void *)>Optional function called on SIGINT before the loop exits.
opaquevoid *Optional user data pointer passed to the callback.
loopuv::Loop *Event loop to run.

packetSlot

template<class Class, class RT, class PT, class IT = IPacket> std::shared_ptr< internal::Slot< RT, IT & > > packetSlot(Class * instance, RT(Class::*)(PT &) method, int id = -1, int priority = -1)

Defined in src/base/include/icy/packetsignal.h:45

Creates a signal slot that filters by packet subtype PT before invoking method.

The returned slot is connected to a PacketSignal (which broadcasts IPacket&). The slot performs a dynamic_cast on each received packet; if the cast succeeds, the listener method is called with the derived type PT. Non-matching packets are silently ignored.

Returns

A shared slot suitable for connecting to a PacketSignal.

Parameters

ParameterTypeDescription
instanceClass *Pointer to the listener object.
methodRT(Class::*)(PT &)Member function pointer on Class accepting a PT&.
idintOptional slot identifier; -1 for automatic assignment.
priorityintOptional slot priority; higher values run first.

operator|

constexpr

constexpr constexpr unsigned operator|(PacketFlags lhs, PacketFlags rhs)

Defined in src/base/include/icy/packetstream.h:218

Combine PacketFlags values into a bitmask.


rawPacket

inline

inline RawPacket rawPacket(const MutableBuffer & buf, unsigned flags = 0, std::unique_ptr< IPacketInfo > info = nullptr)

Defined in src/base/include/icy/packet.h:269

Constructs a non-owning RawPacket from a mutable buffer (borrowed pointer).


rawPacket

inline

inline RawPacket rawPacket(const ConstBuffer & buf, unsigned flags = 0, std::unique_ptr< IPacketInfo > info = nullptr)

Defined in src/base/include/icy/packet.h:276

Constructs an owning RawPacket from a const buffer (data is copied).


rawPacket

inline

inline RawPacket rawPacket(char * data = nullptr, size_t size = 0, unsigned flags = 0, std::unique_ptr< IPacketInfo > info = nullptr)

Defined in src/base/include/icy/packet.h:283

Constructs a non-owning RawPacket from a raw mutable pointer (borrowed).


rawPacket

inline

inline RawPacket rawPacket(const char * data = nullptr, size_t size = 0, unsigned flags = 0, std::unique_ptr< IPacketInfo > info = nullptr)

Defined in src/base/include/icy/packet.h:291

Constructs an owning RawPacket from a const char pointer (data is copied).

Edit this page