![]() |
SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
|
#include <ipc_stream_writer.hpp>
Public Types | |
| using | BackgroundContainer |
Public Member Functions | |
| virtual absl::Status | SwapContainer (std::shared_ptr< BackgroundContainer > new_container) |
| const BackgroundContainer * | GetContainer () const |
| virtual absl::Status | WriteStatus (const presage::physiology::StatusValue &status)=0 |
| virtual absl::Status | WriteCoreMetrics (const presage::physiology::MetricsBuffer &metrics, int64_t timestamp_us)=0 |
| virtual absl::Status | WriteEdgeMetrics (const presage::physiology::Metrics &metrics, int64_t timestamp_us)=0 |
| virtual absl::Status | WriteFrame (const cv::Mat &frame, int64_t timestamp_us)=0 |
| virtual void | Close ()=0 |
| virtual bool | IsOperational () const =0 |
| virtual absl::Status | Flush ()=0 |
Protected Member Functions | |
| virtual absl::Status | RegisterCallbacks () |
| virtual absl::Status | SendInitialStatus () |
| int64_t | GetCurrentTimestampUs () |
Protected Attributes | |
| std::shared_ptr< BackgroundContainer > | container_ |
Abstract interface for IPC stream writers with container management.
This interface defines the contract for writing different types of physiology data to various IPC backends (File, Redis, etc.) and manages integration with BackgroundContainer for automatic callback registration.
Implementations should be thread-safe and handle their own error logging. The template parameter allows this to work with different IntegrationModes.
| using presage::smartspectra::ipc::IpcStreamWriter< TIntegrationMode >::BackgroundContainer |
|
pure virtual |
Close the stream and release resources. After calling this, the writer should not be used again.
Implemented in presage::smartspectra::file_ipc::FileIpcStreamWriter< TIntegrationMode >, and presage::smartspectra::redis_ipc::RedisIpcStreamWriter< TIntegrationMode >.
|
pure virtual |
Flush any buffered data to the underlying stream. Some implementations may buffer data for performance.
Implemented in presage::smartspectra::file_ipc::FileIpcStreamWriter< TIntegrationMode >, and presage::smartspectra::redis_ipc::RedisIpcStreamWriter< TIntegrationMode >.
|
inline |
Get the current container.
|
pure virtual |
Check if the writer is currently operational.
Implemented in presage::smartspectra::file_ipc::FileIpcStreamWriter< TIntegrationMode >, and presage::smartspectra::redis_ipc::RedisIpcStreamWriter< TIntegrationMode >.
|
inlineprotectedvirtual |
Register callbacks with the current container. Derived classes can override this to register additional callbacks. The base implementation registers status, core metrics, and edge metrics callbacks.
|
inlineprotectedvirtual |
Send the initial status from the container. Called after container swap to ensure the current status is written.
|
inlinevirtual |
Swap the container being monitored. This will register callbacks with the new container and send current status immediately.
| new_container | The new container to monitor (can be nullptr) |
|
pure virtual |
Write core metrics to the stream.
| metrics | The core metrics buffer to write |
| timestamp_us | Timestamp in microseconds since epoch |
Implemented in presage::smartspectra::file_ipc::FileIpcStreamWriter< TIntegrationMode >, and presage::smartspectra::redis_ipc::RedisIpcStreamWriter< TIntegrationMode >.
|
pure virtual |
Write edge metrics to the stream.
| metrics | The edge metrics to write |
Implemented in presage::smartspectra::file_ipc::FileIpcStreamWriter< TIntegrationMode >, and presage::smartspectra::redis_ipc::RedisIpcStreamWriter< TIntegrationMode >.
|
pure virtual |
Write a video frame to the stream.
| frame | The video frame as an OpenCV Mat (RGB format expected) |
| timestamp_us | Timestamp in microseconds since epoch |
Implemented in presage::smartspectra::file_ipc::FileIpcStreamWriter< TIntegrationMode >, and presage::smartspectra::redis_ipc::RedisIpcStreamWriter< TIntegrationMode >.
|
pure virtual |
Write a status value to the stream.
| status | The status value to write |
Implemented in presage::smartspectra::file_ipc::FileIpcStreamWriter< TIntegrationMode >, and presage::smartspectra::redis_ipc::RedisIpcStreamWriter< TIntegrationMode >.