FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::ParamPublisher Class Reference

#include <fastmm/strategies/param_publisher.hpp>

Classes

struct  BlockOps
 Copying and freeing a parameter block whose layout is known only at run time (strategies/hot_params.hpp); validate runs after the schema's parsers. More...
 
struct  Value
 Every parameter of the copy, in schema order: one instrument's, or the shared set. More...
 

Public Types

using ParamValue = std::pair< std::string, std::string >
 name, value as ParamDesc::parse takes
 

Public Member Functions

template<class Params >
 ParamPublisher (ParamSink sink, const Params &current, std::size_t instruments=0)
 
 ParamPublisher (ParamSink sink, const ParamSchema &schema, const BlockOps &ops, const void *current, std::size_t instruments=0)
 schema's parsers and ops work on blocks like current; schema must outlive the publisher.
 
 ParamPublisher (const ParamPublisher &)=delete
 
ParamPublisher & operator= (const ParamPublisher &)=delete
 
 ParamPublisher (ParamPublisher &&)=delete
 
ParamPublisher & operator= (ParamPublisher &&)=delete
 
 ~ParamPublisher ()=default
 
bool publish (const std::vector< ParamValue > &values, InstrumentId inst=kAllInstruments)
 Validates and sends one update.
 
std::uint64_t publish_as (const std::vector< ParamValue > &values, InstrumentId inst, ParamUpdateMsg::Origin origin, std::string_view source)
 publish() with the update's origin and source (ParamUpdateMsg::source, cut to 39 bytes).
 
std::optional< std::string > build (const std::vector< ParamValue > &values, InstrumentId inst, ParamUpdateMsg &out) const
 The update publish() would send, without sending it or changing the copy; the error message when it is invalid.
 
void close ()
 Later publishes return false (the session has stopped).
 
bool closed () const
 
std::uint64_t published () const
 Updates sent, and updates the sink refused.
 
std::uint64_t refused () const
 
const ParamSchema & schema () const
 
std::vector< Value > values (InstrumentId inst=kAllInstruments) const
 
std::string describe (InstrumentId inst=kAllInstruments) const
 name=value pairs of the copy: one instrument's, or the shared set.
 

Static Public Attributes

static constexpr InstrumentId kAllInstruments = ParamUpdateMsg::kAllInstruments
 

Member Typedef Documentation

◆ ParamValue

using fastmm::ParamPublisher::ParamValue = std::pair<std::string, std::string>

name, value as ParamDesc::parse takes

Constructor & Destructor Documentation

◆ ParamPublisher() [1/4]

template<class Params >
fastmm::ParamPublisher::ParamPublisher ( ParamSink  sink,
const Params &  current,
std::size_t  instruments = 0 
)
inline

◆ ParamPublisher() [2/4]

fastmm::ParamPublisher::ParamPublisher ( ParamSink  sink,
const ParamSchema &  schema,
const BlockOps &  ops,
const void *  current,
std::size_t  instruments = 0 
)
inline

schema's parsers and ops work on blocks like current; schema must outlive the publisher.

◆ ParamPublisher() [3/4]

fastmm::ParamPublisher::ParamPublisher ( const ParamPublisher &  )
delete

◆ ParamPublisher() [4/4]

fastmm::ParamPublisher::ParamPublisher ( ParamPublisher &&  )
delete

◆ ~ParamPublisher()

fastmm::ParamPublisher::~ParamPublisher ( )
default

Member Function Documentation

◆ operator=() [1/2]

ParamPublisher & fastmm::ParamPublisher::operator= ( const ParamPublisher &  )
delete

◆ operator=() [2/2]

ParamPublisher & fastmm::ParamPublisher::operator= ( ParamPublisher &&  )
delete

◆ publish()

bool fastmm::ParamPublisher::publish ( const std::vector< ParamValue > &  values,
InstrumentId  inst = kAllInstruments 
)
inline

Validates and sends one update.

Throws std::invalid_argument when it is invalid; returns false when the sink refused it (ring full) or the publisher is closed.

◆ publish_as()

std::uint64_t fastmm::ParamPublisher::publish_as ( const std::vector< ParamValue > &  values,
InstrumentId  inst,
ParamUpdateMsg::Origin  origin,
std::string_view  source 
)
inline

publish() with the update's origin and source (ParamUpdateMsg::source, cut to 39 bytes).

The update's publish_seq, 0 when the sink refused it or the publisher is closed.

◆ build()

std::optional< std::string > fastmm::ParamPublisher::build ( const std::vector< ParamValue > &  values,
InstrumentId  inst,
ParamUpdateMsg &  out 
) const
inline

The update publish() would send, without sending it or changing the copy; the error message when it is invalid.

out.publish_seq and out.hdr.recv_ts stay zero.

◆ close()

void fastmm::ParamPublisher::close ( )
inline

Later publishes return false (the session has stopped).

◆ closed()

bool fastmm::ParamPublisher::closed ( ) const
inline

◆ published()

std::uint64_t fastmm::ParamPublisher::published ( ) const
inline

Updates sent, and updates the sink refused.

◆ refused()

std::uint64_t fastmm::ParamPublisher::refused ( ) const
inline

◆ schema()

const ParamSchema & fastmm::ParamPublisher::schema ( ) const
inline

◆ values()

std::vector< Value > fastmm::ParamPublisher::values ( InstrumentId  inst = kAllInstruments) const
inline

◆ describe()

std::string fastmm::ParamPublisher::describe ( InstrumentId  inst = kAllInstruments) const
inline

name=value pairs of the copy: one instrument's, or the shared set.

Member Data Documentation

◆ kAllInstruments

constexpr InstrumentId fastmm::ParamPublisher::kAllInstruments = ParamUpdateMsg::kAllInstruments
staticconstexpr