LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
dynamic_buffer_stream_ctor.h File Reference

Private factory constructor callback for the dynamic_buffer_stream adapter. More...

Include dependency graph for dynamic_buffer_stream_ctor.h:

Go to the source code of this file.

Functions

stream_status_t dynamic_buffer_stream_ctor (const void *ud, const void *args, stream_t **out)
 Factory constructor callback for the dynamic_buffer_stream adapter.
 

Detailed Description

This constructor is stored in the adapter descriptor created by dynamic_buffer_stream_create_desc() and later invoked by the stream port factory when creating a dynamic-buffer-backed stream instance.

Definition in file dynamic_buffer_stream_ctor.h.

Function Documentation

◆ dynamic_buffer_stream_ctor()

stream_status_t dynamic_buffer_stream_ctor ( const void *  ud,
const void *  args,
stream_t **  out 
)

This function implements the stream_ctor_fn_t contract expected by the stream port factory.

The opaque user-data pointer ud is expected to reference a dynamic_buffer_stream_ctor_ud_t structure containing the configuration and environment required to construct the stream instance.

The args parameter is the runtime argument blob supplied by the factory when creating a stream instance. This adapter does not require runtime creation arguments, so args is expected to be NULL.

Parameters
[in]udOpaque user data stored in the adapter descriptor.

Expected type:

Parameters
[in]argsRuntime argument blob supplied by the factory.

Expected value:

  • NULL
Parameters
[out]outReceives the created stream handle.
Returns
  • STREAM_STATUS_OK on success
  • STREAM_STATUS_INVALID if one or more arguments are invalid
  • STREAM_STATUS_OOM on allocation failure
Postcondition
On success, *out receives a newly created stream instance owned by the caller.

On failure, *out is left unchanged.

Factory constructor callback for the dynamic_buffer_stream adapter.

Parameters
udBorrowed adapter-specific constructor user data.
argsBorrowed creation arguments expected by the adapter factory contract.
outOutput location that receives the created stream_t * on success.
Return values
STREAM_STATUS_OKThe stream was created successfully.
STREAM_STATUS_INVALIDOne or more arguments are invalid.
STREAM_STATUS_OOMMemory allocation failed.

Definition at line 287 of file dynamic_buffer_stream.c.