ImFusion C++ SDK 4.4.0
ImFusion::SubstreamWrapper Class Reference

#include <ImFusion/Stream/SubstreamWrapper.h>

Generic wrapper to integrate an existing Stream into a StreamGroup as a substream. More...

Inheritance diagram for ImFusion::SubstreamWrapper:

Detailed Description

Generic wrapper to integrate an existing Stream into a StreamGroup as a substream.

SubstreamWrapper takes ownership of an independent Stream and adds substream functionality, enabling it to be bundled into a StreamGroup. Unlike the Substream template class which creates dummy substreams fully controlled by the proxy stream, SubstreamWrapper preserves the wrapped stream's own implementation and doWork() execution.

The wrapper handles bidirectional state synchronization between the wrapped stream and the proxy stream:

  • Changes to the proxy stream's state are propagated to the wrapped stream
  • Changes to the wrapped stream's state are propagated back to the proxy stream This allows the wrapped stream to maintain its own operation while participating in the stream group.

Use cases:

  • Bundling multiple independent streams that need coordinated control
  • Integrating existing stream implementations into a stream group without modification
  • Creating stream groups where substreams have their own processing logic

Example usage:

class MyStreamGroup : public Stream, public StreamGroup<MyStreamGroup>
{
{
}
};
Templated stream group class for bundling multiple streams using the CRTP pattern.
Definition StreamGroup.h:43
bool addSubstream(std::unique_ptr< SubstreamBase > substream) override
Adds a substream to the stream group.
Definition StreamGroup.h:323
Base class representing a stream of changing data in the DataModel.
Definition Stream.h:60
T make_unique(T... args)
See also
Substream, StreamGroup, StreamGroupBase

Public Member Functions

 SubstreamWrapper (std::unique_ptr< Stream > stream, StreamGroupBase *streamGroup)
 Constructs a SubstreamWrapper for the given stream to become a substream of the stream group streamGroup.
 ~SubstreamWrapper ()
 Disconnects state synchronization signals, blocks the wrapped stream's data emission, and ensures the stream is properly closed.
Streamstream () override
 Returns the wrapped stream, valid for the lifetime of this wrapper.
Public Member Functions inherited from ImFusion::SubstreamBase
 SubstreamBase (StreamGroupBase *streamGroup)
 Constructs a substream associated with the owning stream group.
StreamGroupBase * streamGroup () const
 Returns the stream group this substream belongs to.

Additional Inherited Members

Protected Attributes inherited from ImFusion::SubstreamBase
StreamGroupBase * m_streamGroup = nullptr

Constructor & Destructor Documentation

◆ SubstreamWrapper()

ImFusion::SubstreamWrapper::SubstreamWrapper ( std::unique_ptr< Stream > stream,
StreamGroupBase * streamGroup )

Constructs a SubstreamWrapper for the given stream to become a substream of the stream group streamGroup.

Takes ownership of the stream and sets up synchronization of its initial state with the proxy stream

Member Function Documentation

◆ stream()

Stream * ImFusion::SubstreamWrapper::stream ( )
overridevirtual

Returns the wrapped stream, valid for the lifetime of this wrapper.

Implements ImFusion::SubstreamBase.


The documentation for this class was generated from the following file:
  • ImFusion/Stream/SubstreamWrapper.h
Search Tab / S to search, Esc to close