core Namespace Reference
|
Space-ng SDK
|
Namespaces | |
| impl | |
| msg | |
| test | |
Classes | |
| class | AnyMessageInput |
| class | AnyMessageLogReader |
| class | AnyMessageLogWriter |
| class | AnyMessageOutput |
| class | AnyMessageView |
| struct | DemoStepResult |
| class | DemoComponent |
| class | MessageInput |
| struct | MessageViewSuccess |
| class | MessageOutput |
| class | MessagePort |
| class | MessageSchema |
| class | MessageHeaderSerializer |
| class | MessageSerializer |
| struct | MessageSpec |
| Compile time message type and id specification. More... | |
| struct | is_message_spec |
| struct | is_message_spec< MessageSpec< TTableType, tInterfaceType, tInterfaceId > > |
| class | MessageView |
| struct | SeqRingSlotHeader |
| struct | SeqRingHeader |
| class | SeqRingSlotView |
| A read only view of a specific seq ring buffer slot. More... | |
| class | SeqRingWriter |
| class | SeqRingReader |
| struct | EndpointPort |
| struct | PortIdx |
| class | IBufferConst |
| A view of an immutable shared-memory buffer. More... | |
| class | IBufferMutable |
| Mutable view of shared memory buffer. More... | |
| class | IBufferExchange |
| Interface for registering, discovering, and disposing shared buffers. More... | |
| class | ShmemExchange |
| class | SizeDelimitedLogReader |
| class | SizeDelimitedLogWriter |
| class | IStreamWriter |
| Minimal append-only byte sink for streaming writes. More... | |
| class | Periodic |
| Fixed-rate, phase-aligned ticker for periodic scheduling. More... | |
| class | EventSignal |
Typedefs | |
| using | Endpoint = boost::asio::local::datagram_protocol::endpoint |
Enumerations | |
| enum class | JsonFormat { SINGLE_LINE = 0 , MULTI_LINE = 1 } |
| enum | ExchangeCode : uint32_t { buffers_request = 0 , buffers_response = 1 , buffer_removed = 2 , peer_disconnect = 3 } |
Functions | |
| void | toJson (AnyMessageView const &view, std::string &out_json, JsonFormat format=JsonFormat::SINGLE_LINE) |
| std::string | toJson (AnyMessageView const &view, JsonFormat format=JsonFormat::SINGLE_LINE) |
| std::string | format_as (AnyMessageView &view) |
| void | toJson (flatbuffers::Parser const &parser, uint8_t const *buffer, std::string &out_json) |
| std::string | toJson (flatbuffers::Parser const &parser, uint8_t const *buffer) |
| flatbuffers::span< uint8_t const > | bufferSpanFromJson (flatbuffers::Parser &parser, std::string const &json_str) |
| template<typename TMessage > | |
| flatbuffers::Parser | deserializeReflectionParser () |
| template<typename TMessage > | |
| flatbuffers::Parser & | reflectionParser (JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessage > | |
| void | toJson (uint8_t const *buffer, std::string &out_json, JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessage > | |
| std::string | toJson (uint8_t const *buffer, JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessage > | |
| void | toJson (TMessage const *table, std::string &out_json, JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessage > | |
| std::string | toJson (TMessage const *table, JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessageT > | |
| void | toJson (TMessageT const &object, std::string &out_json, JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessageT > | |
| std::string | toJson (TMessageT const &object, JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessage > | |
| TMessage const * | fromJson (std::string const &json_str) |
| template<typename TMessageT > | |
| void | fromJson (std::string const &json_str, TMessageT &out_message) |
| template<typename TMessage > | |
| TMessage const * | fromJsonFile (cpp::fs::path const &json_path) |
| template<typename TMessageT > | |
| void | fromJsonFile (cpp::fs::path const &json_path, TMessageT &out_message) |
| template<typename TMessageT > | |
| void | toJsonFile (cpp::fs::path const &json_path, TMessageT const &message, JsonFormat format=JsonFormat::SINGLE_LINE) |
| template<typename TMessage > | |
| void | toJsonFile (cpp::fs::path const &json_path, TMessage const *message, JsonFormat format=JsonFormat::SINGLE_LINE) |
| constexpr uint32_t | makeFileIdentifier (char const s[4]) |
| template<typename TMessageT > | |
| constexpr uint32_t | makeFileIdentifier () |
| Generates a 32-bit file identifier for a FlatBuffers table type. More... | |
| std::string | stringFromFileIdentifier (uint32_t v) |
| Converts a file identifier to a printable 4-character string. More... | |
| std::unique_ptr< IBufferMutable > | makeGbmBuffer (BufferInfo const &info) |
| msg::HostIdConfigT const & | hostIdentity () |
| void | setupLogging () |
| std::unique_ptr< IBufferMutable > | makeMemfdBuffer (BufferInfo const &info) |
| std::unique_ptr< IBufferConst > | importMemfdBuffer (BufferInfo const &info, int fd, Endpoint const &endpoint) |
| template<typename TMessageSpec , typename TPredicate > | |
| MessageViewSuccess< TMessageSpec > | waitUntil (MessageInput< TMessageSpec > &input, std::chrono::nanoseconds timeout, TPredicate predicate, std::chrono::nanoseconds poll_interval=std::chrono::milliseconds(10)) |
| cpp::fs::path | logFilenamePathStem (std::chrono::system_clock::time_point start_time, core::MessagePort port, std::string const &recv_host_id, std::string const &run_uuid, uint16_t duration_s) |
| cpp::fs::path | createUniqueLogPath (cpp::fs::path const &log_dir, std::chrono::system_clock::time_point start_time, core::MessagePort port, std::string const &host_id, std::string const &run_id, uint16_t duration_s) |
| Create a unique log file path in log_dir for the given start_time and port. More... | |
| bool | matchesLogFilename (cpp::fs::path const &path, uint32_t port_encoded, std::string const &host_id, std::string const &run_id) |
| Return true if the path matches the expected log filename pattern. More... | |
| std::vector< cpp::fs::path > | enumerateLogFiles (cpp::fs::path const &log_dir, uint32_t port_encoded, std::string const &host_id, std::string const &run_id) |
| Collect log files in log_dir that match the configured identifiers. More... | |
| bool | parseHeader (uint8_t const *buf, size_t size, msg::MessageHeader const **out_header, size_t *out_header_size, uint8_t const **out_payload_buf, size_t *out_payload_size) |
| std::string | format_as (MessagePort const &port) |
| void * | checkAlignedAs (void *data, size_t alignment) |
| void const * | checkAlignedAs (void const *data, size_t alignment) |
| size_t | checkSize (size_t size, size_t min_size) |
| std::size_t | alignUp (std::size_t v, std::size_t a) |
| void | atomicStoreMemcpy (void *dst, void const *src, size_t bytes) |
| void | atomicLoadMemcpy (void *dst, void const *src, size_t bytes) |
| bool | isGpu (msg::BufferFormat format) |
| Returns true if the format is a GPU format (e.g. MIPI_RAW, YUV_NV12). More... | |
| std::unique_ptr< IBufferMutable > | makeShmemBuffer (BufferInfo const &info) |
| Creates a mutable buffer, matching the BufferInfo. More... | |
| std::unique_ptr< IBufferConst > | importShmemBufferConst (BufferInfo const &info, int fd, Endpoint const &endpoint) |
| msg::ExchangeConfigT | loadExchangeConfigFromEnv () |
| msg::ExchangeConfigT | loadExchangeConfigFromPath (std::string const &config_path) |
| char const * | readErrorCodeToString (SizeDelimitedLogReader::ReadError::Code code) |
| String conversion for error codes (stable, human-readable strings). More... | |
| std::string | formatReadError (SizeDelimitedLogReader::ReadError const &err, std::string_view context) |
| Format a ReadError for logs or exceptions. More... | |
| std::string | format_as (SizeDelimitedLogReader::ReadError::Code code) |
| fmtlib customization for ReadError::Code. More... | |
| std::string | format_as (SizeDelimitedLogReader::ReadError const &err) |
| fmtlib customization for ReadError. More... | |
| msg::TimePoint | timePoint (std::chrono::system_clock::time_point const &time_point) |
| Creates a msg::TimePoint from std::chrono::system_clock::time_point. More... | |
| msg::TimePoint | timePoint (std::chrono::steady_clock::time_point const &time_point) |
| Creates a msg::TimePoint from std::chrono::monotonic::time_point. More... | |
| std::chrono::system_clock::time_point | toChronoSystemClock (msg::TimePoint time_point) |
| template<typename TClock = std::chrono::system_clock> | |
| msg::Stamp | stampFrom (typename TClock::time_point const &time_point, msg::StampType stamp_type, uint16_t host_id=hostIdentity().host_id_numeric) |
| Creates a msg::Stamp from std::chrono::stead_block::time_point. More... | |
| template<typename TClock = std::chrono::system_clock> | |
| msg::Stamp | stampNow (msg::StampType stamp_type, uint16_t host_id=hostIdentity().host_id_numeric) |
| Creates a send timestamp using the specified clock. More... | |
| template<typename TClock = std::chrono::system_clock> | |
| msg::Stamp | sendStampNow (uint16_t host_id=hostIdentity().host_id_numeric) |
| Creates a send timestamp using the specified clock. More... | |
| template<typename TClock = std::chrono::system_clock> | |
| msg::Stamp | recvStampNow (uint16_t host_id=hostIdentity().host_id_numeric) |
| Creates a receive timestamp using the specified clock. More... | |
| template<typename TClock = std::chrono::system_clock> | |
| msg::Stamp | measurementStampFrom (typename TClock::time_point time_point, uint16_t host_id=hostIdentity().host_id_numeric) |
| Creates a receive timestamp using the specified clock. More... | |
| std::chrono::nanoseconds | toDuration (double seconds) |
| template<typename TRep , typename TPeriod > | |
| double | toSeconds (std::chrono::duration< TRep, TPeriod > const &duration) |
| template<typename TClock > | |
| double | toSeconds (std::chrono::time_point< TClock > const &time_point) |
| template<class TP0 , class... TPn> | |
| constexpr TP0 | minTimePoint (const TP0 &first, TPn const &... rest) |
| Returns the earliest of the given time points. More... | |
Variables | |
| constexpr char const * | kLogExtension = ".sol3" |
| Filesystem extension (with dot) for log files. More... | |
| constexpr size_t | kCacheLineSize = 64 |
Typedef Documentation
◆ Endpoint
| using sol3::core::Endpoint = typedef boost::asio::local::datagram_protocol::endpoint |
Enumeration Type Documentation
◆ ExchangeCode
| enum sol3::core::ExchangeCode : uint32_t |
◆ JsonFormat
|
strong |
Function Documentation
◆ alignUp()
| std::size_t sol3::core::alignUp | ( | std::size_t | v, |
| std::size_t | a | ||
| ) |
◆ atomicLoadMemcpy()
| void sol3::core::atomicLoadMemcpy | ( | void * | dst, |
| void const * | src, | ||
| size_t | bytes | ||
| ) |
Implements memcpy where each 64-bit word is loaded atomically. Optimized for the read side of a seqlock-guarded buffer.
Precondition, src and dst are aligned to 64bits, and bytes is a multiple of 64 bits, for uint64_t atomic operations.
After copy ends, this code performs the following fence operation: std::atomic_thread_fence(std::memory_order_acquire);
For inspiration see: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1478r5.html
◆ atomicStoreMemcpy()
| void sol3::core::atomicStoreMemcpy | ( | void * | dst, |
| void const * | src, | ||
| size_t | bytes | ||
| ) |
Implements memcpy where each 64-bit word is stored atomically. Optimized for the write side of a seqlock-guarded buffer.
Precondition, src and dst are aligned to 64bits, and bytes is a multiple of 64 bits, for uint64_t atomic operations.
Before copy begins, this code performs the following fence operation: std::atomic_thread_fence(std::memory_order_release);
For inspiration see: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1478r5.html
◆ bufferSpanFromJson()
| flatbuffers::span<uint8_t const> sol3::core::bufferSpanFromJson | ( | flatbuffers::Parser & | parser, |
| std::string const & | json_str | ||
| ) |
◆ checkAlignedAs() [1/2]
| void* sol3::core::checkAlignedAs | ( | void * | data, |
| size_t | alignment | ||
| ) |
◆ checkAlignedAs() [2/2]
| void const* sol3::core::checkAlignedAs | ( | void const * | data, |
| size_t | alignment | ||
| ) |
◆ checkSize()
| size_t sol3::core::checkSize | ( | size_t | size, |
| size_t | min_size | ||
| ) |
◆ createUniqueLogPath()
| cpp::fs::path sol3::core::createUniqueLogPath | ( | cpp::fs::path const & | log_dir, |
| std::chrono::system_clock::time_point | start_time, | ||
| core::MessagePort | port, | ||
| std::string const & | host_id, | ||
| std::string const & | run_id, | ||
| uint16_t | duration_s | ||
| ) |
Create a unique log file path in log_dir for the given start_time and port.
◆ deserializeReflectionParser()
| flatbuffers::Parser sol3::core::deserializeReflectionParser | ( | ) |
◆ enumerateLogFiles()
| std::vector<cpp::fs::path> sol3::core::enumerateLogFiles | ( | cpp::fs::path const & | log_dir, |
| uint32_t | port_encoded, | ||
| std::string const & | host_id, | ||
| std::string const & | run_id | ||
| ) |
Collect log files in log_dir that match the configured identifiers.
◆ format_as() [1/4]
|
inline |
◆ format_as() [2/4]
| std::string sol3::core::format_as | ( | MessagePort const & | port | ) |
◆ format_as() [3/4]
| std::string sol3::core::format_as | ( | SizeDelimitedLogReader::ReadError const & | err | ) |
fmtlib customization for ReadError.
◆ format_as() [4/4]
| std::string sol3::core::format_as | ( | SizeDelimitedLogReader::ReadError::Code | code | ) |
fmtlib customization for ReadError::Code.
◆ formatReadError()
| std::string sol3::core::formatReadError | ( | SizeDelimitedLogReader::ReadError const & | err, |
| std::string_view | context | ||
| ) |
Format a ReadError for logs or exceptions.
◆ fromJson() [1/2]
| TMessage const* sol3::core::fromJson | ( | std::string const & | json_str | ) |
Gets a flatbuffer root table from a json string. this table is valid as long as fromJson<TMessage> is not invoked again from the same thread.
◆ fromJson() [2/2]
| void sol3::core::fromJson | ( | std::string const & | json_str, |
| TMessageT & | out_message | ||
| ) |
◆ fromJsonFile() [1/2]
| TMessage const* sol3::core::fromJsonFile | ( | cpp::fs::path const & | json_path | ) |
◆ fromJsonFile() [2/2]
| void sol3::core::fromJsonFile | ( | cpp::fs::path const & | json_path, |
| TMessageT & | out_message | ||
| ) |
◆ hostIdentity()
| msg::HostIdConfigT const& sol3::core::hostIdentity | ( | ) |
Returns configured host identity. Loads from /opt/sol3/etc/host_id.json on first call.
◆ importMemfdBuffer()
| std::unique_ptr<IBufferConst> sol3::core::importMemfdBuffer | ( | BufferInfo const & | info, |
| int | fd, | ||
| Endpoint const & | endpoint | ||
| ) |
◆ importShmemBufferConst()
| std::unique_ptr<IBufferConst> sol3::core::importShmemBufferConst | ( | BufferInfo const & | info, |
| int | fd, | ||
| Endpoint const & | endpoint | ||
| ) |
Creates a const view of the buffer, takes ownership of the fd (and will close it on going out of scope), typically this is received over a unix domain socket. if creating from a IBufferMutable or IBufferConst fd make sure to ::dup(buffer->fd())
◆ isGpu()
| bool sol3::core::isGpu | ( | msg::BufferFormat | format | ) |
Returns true if the format is a GPU format (e.g. MIPI_RAW, YUV_NV12).
◆ loadExchangeConfigFromEnv()
| msg::ExchangeConfigT sol3::core::loadExchangeConfigFromEnv | ( | ) |
Load exchange routing config from disk.
Uses SOL3_EXCHANGE_CONFIG_PATH when set, otherwise /opt/sol3/etc/shmem_exchange.json. Returns an empty config when the path does not exist.
◆ loadExchangeConfigFromPath()
| msg::ExchangeConfigT sol3::core::loadExchangeConfigFromPath | ( | std::string const & | config_path | ) |
Load exchange routing config from an explicit path. Returns an empty config when the path does not exist.
◆ logFilenamePathStem()
| cpp::fs::path sol3::core::logFilenamePathStem | ( | std::chrono::system_clock::time_point | start_time, |
| core::MessagePort | port, | ||
| std::string const & | recv_host_id, | ||
| std::string const & | run_uuid, | ||
| uint16_t | duration_s | ||
| ) |
Returns a log filename path stem, based on start time, MessagePort port, recv host, run id, and duration
{start_time:YmdTHMS}Z_{port:08x}_{recv_host:04X}_{run_id}_{duration_s:04X}
For time format see: https://fmt.dev/latest/syntax/#chrono-format-specifications
◆ makeFileIdentifier() [1/2]
|
constexpr |
Generates a 32-bit file identifier for a FlatBuffers table type.
◆ makeFileIdentifier() [2/2]
|
constexpr |
Generates a 32-bit file identifier from a 4-character string.
The identifier is defined in a FlatBuffers schema using the file_identifier keyword and embedded in serialized messages to ensure schema compatibility.
◆ makeGbmBuffer()
| std::unique_ptr<IBufferMutable> sol3::core::makeGbmBuffer | ( | BufferInfo const & | info | ) |
When ENABLE_GBM is defined, provides GBM-backed buffer allocation. Otherwise, returns nullptr.
◆ makeMemfdBuffer()
| std::unique_ptr<IBufferMutable> sol3::core::makeMemfdBuffer | ( | BufferInfo const & | info | ) |
◆ makeShmemBuffer()
| std::unique_ptr<IBufferMutable> sol3::core::makeShmemBuffer | ( | BufferInfo const & | info | ) |
Creates a mutable buffer, matching the BufferInfo.
◆ matchesLogFilename()
| bool sol3::core::matchesLogFilename | ( | cpp::fs::path const & | path, |
| uint32_t | port_encoded, | ||
| std::string const & | host_id, | ||
| std::string const & | run_id | ||
| ) |
Return true if the path matches the expected log filename pattern.
◆ measurementStampFrom()
|
inline |
Creates a receive timestamp using the specified clock.
◆ minTimePoint()
|
constexpr |
Returns the earliest of the given time points.
◆ parseHeader()
| bool sol3::core::parseHeader | ( | uint8_t const * | buf, |
| size_t | size, | ||
| msg::MessageHeader const ** | out_header, | ||
| size_t * | out_header_size, | ||
| uint8_t const ** | out_payload_buf, | ||
| size_t * | out_payload_size | ||
| ) |
Parses a buffer to locate the message header and payload.
The expected wire format is: | header size (4 bytes) | msg::MessageHeader bytes | | Payload Bytes (no size prefix, size from message header)|
Validates the header using FlatBuffers to ensure it matches the expected schema. On success, provides pointers to the header and payload within the original buffer, along with the payload size in bytes. The buffer may contain additional trailing bytes after the payload.
This function does not validate the payload content; callers must perform payload validation separately if needed.
◆ readErrorCodeToString()
| char const* sol3::core::readErrorCodeToString | ( | SizeDelimitedLogReader::ReadError::Code | code | ) |
String conversion for error codes (stable, human-readable strings).
◆ recvStampNow()
|
inline |
Creates a receive timestamp using the specified clock.
◆ reflectionParser()
| flatbuffers::Parser& sol3::core::reflectionParser | ( | JsonFormat | format = JsonFormat::SINGLE_LINE | ) |
◆ sendStampNow()
|
inline |
Creates a send timestamp using the specified clock.
◆ setupLogging()
| void sol3::core::setupLogging | ( | ) |
Configures the default spdlog logger for console output with color and timestamp formatting.
◆ stampFrom()
|
inline |
Creates a msg::Stamp from std::chrono::stead_block::time_point.
◆ stampNow()
|
inline |
Creates a send timestamp using the specified clock.
◆ stringFromFileIdentifier()
| std::string sol3::core::stringFromFileIdentifier | ( | uint32_t | v | ) |
Converts a file identifier to a printable 4-character string.
◆ timePoint() [1/2]
|
inline |
Creates a msg::TimePoint from std::chrono::monotonic::time_point.
◆ timePoint() [2/2]
|
inline |
Creates a msg::TimePoint from std::chrono::system_clock::time_point.
◆ toChronoSystemClock()
|
inline |
◆ toDuration()
|
inline |
◆ toJson() [1/10]
| std::string sol3::core::toJson | ( | AnyMessageView const & | view, |
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJson() [2/10]
| void sol3::core::toJson | ( | AnyMessageView const & | view, |
| std::string & | out_json, | ||
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJson() [3/10]
| std::string sol3::core::toJson | ( | flatbuffers::Parser const & | parser, |
| uint8_t const * | buffer | ||
| ) |
◆ toJson() [4/10]
| void sol3::core::toJson | ( | flatbuffers::Parser const & | parser, |
| uint8_t const * | buffer, | ||
| std::string & | out_json | ||
| ) |
◆ toJson() [5/10]
| std::string sol3::core::toJson | ( | TMessage const * | table, |
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJson() [6/10]
| void sol3::core::toJson | ( | TMessage const * | table, |
| std::string & | out_json, | ||
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJson() [7/10]
| std::string sol3::core::toJson | ( | TMessageT const & | object, |
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJson() [8/10]
| void sol3::core::toJson | ( | TMessageT const & | object, |
| std::string & | out_json, | ||
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJson() [9/10]
| std::string sol3::core::toJson | ( | uint8_t const * | buffer, |
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJson() [10/10]
| void sol3::core::toJson | ( | uint8_t const * | buffer, |
| std::string & | out_json, | ||
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJsonFile() [1/2]
| void sol3::core::toJsonFile | ( | cpp::fs::path const & | json_path, |
| TMessage const * | message, | ||
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toJsonFile() [2/2]
| void sol3::core::toJsonFile | ( | cpp::fs::path const & | json_path, |
| TMessageT const & | message, | ||
| JsonFormat | format = JsonFormat::SINGLE_LINE |
||
| ) |
◆ toSeconds() [1/2]
| double sol3::core::toSeconds | ( | std::chrono::duration< TRep, TPeriod > const & | duration | ) |
◆ toSeconds() [2/2]
| double sol3::core::toSeconds | ( | std::chrono::time_point< TClock > const & | time_point | ) |
◆ waitUntil()
| MessageViewSuccess<TMessageSpec> sol3::core::waitUntil | ( | MessageInput< TMessageSpec > & | input, |
| std::chrono::nanoseconds | timeout, | ||
| TPredicate | predicate, | ||
| std::chrono::nanoseconds | poll_interval = std::chrono::milliseconds(10) |
||
| ) |
Variable Documentation
◆ kCacheLineSize
|
constexpr |
◆ kLogExtension
|
constexpr |
Filesystem extension (with dot) for log files.
Generated by