Project
Loading...
Searching...
No Matches
o2::framework::MessageContext Class Reference

#include <MessageContext.h>

Classes

class  AlignedMemoryResource
 
class  ContainerRefObject
 
class  ContextObject
 
class  ScopeHook
 
class  SpanObject
 
class  TrivialObject
 TrivialObject handles a message object. More...
 
class  VectorObject
 

Public Types

using Messages = std::vector< std::unique_ptr< ContextObject > >
 
template<typename T >
using ContextObjectScope = std::unique_ptr< T, ScopeHook< T > >
 

Public Member Functions

 MessageContext (FairMQDeviceProxy &proxy)
 
 MessageContext (FairMQDeviceProxy &proxy, DispatchControl &&dispatcher)
 
void init (DispatchControl &&dispatcher)
 
template<typename T , typename... Args>
auto & add (Args &&... args)
 
template<typename T , typename... Args>
Messages::value_type make (Args &&... args)
 
template<typename T , typename... Args>
ContextObjectScope< T > make_scoped (Args &&... args)
 
void schedule (Messages::value_type &&message)
 
Messages getMessagesForSending ()
 
size_t size ()
 
void clear ()
 
FairMQDeviceProxyproxy ()
 
int64_t addToCache (std::unique_ptr< fair::mq::Message > &message)
 
std::unique_ptr< fair::mq::Message > cloneFromCache (int64_t id) const
 
void pruneFromCache (int64_t id)
 
fair::mq::MessagePtr createMessage (RouteIndex routeIndex, int index, size_t size)
 
fair::mq::MessagePtr createMessage (RouteIndex routeIndex, int index, void *data, size_t size, fair::mq::FreeFn *ffn, void *hint)
 
o2::header::DataHeaderfindMessageHeader (const Output &spec)
 return the headers of the 1st (from the end) matching message checking first in mMessages then in mScheduledMessages
 
o2::header::StackfindMessageHeaderStack (const Output &spec)
 
int countDeviceOutputs (bool excludeDPLOrigin=false) const
 
void fakeDispatch ()
 
bool didDispatch ()
 
o2::framework::DataProcessingHeaderfindMessageDataProcessingHeader (const Output &spec)
 
std::pair< o2::header::DataHeader *, o2::framework::DataProcessingHeader * > findMessageHeaders (const Output &spec)
 

Static Public Attributes

static constexpr ServiceKind service_kind = ServiceKind::Stream
 
static constexpr int DefaultChannelIndex = 0
 

Detailed Description

Definition at line 53 of file MessageContext.h.

Member Typedef Documentation

◆ ContextObjectScope

template<typename T >
using o2::framework::MessageContext::ContextObjectScope = std::unique_ptr<T, ScopeHook<T> >

Definition at line 407 of file MessageContext.h.

◆ Messages

using o2::framework::MessageContext::Messages = std::vector<std::unique_ptr<ContextObject> >

Definition at line 365 of file MessageContext.h.

Constructor & Destructor Documentation

◆ MessageContext() [1/2]

o2::framework::MessageContext::MessageContext ( FairMQDeviceProxy proxy)
inline

Definition at line 61 of file MessageContext.h.

◆ MessageContext() [2/2]

o2::framework::MessageContext::MessageContext ( FairMQDeviceProxy proxy,
DispatchControl &&  dispatcher 
)
inline

Definition at line 66 of file MessageContext.h.

Member Function Documentation

◆ add()

template<typename T , typename... Args>
auto & o2::framework::MessageContext::add ( Args &&...  args)
inline

Create the specified context object from the variadic arguments and add to message list. The context object is owned be the context and returned by reference. The context object type is specified as template argument, each context object implementation must derive from the ContextObject interface. TODO: rename to make_ref

Definition at line 415 of file MessageContext.h.

◆ addToCache()

int64_t o2::framework::MessageContext::addToCache ( std::unique_ptr< fair::mq::Message > &  message)

Definition at line 110 of file MessageContext.cxx.

◆ clear()

void o2::framework::MessageContext::clear ( )

Prepares the context to create messages for the given timeslice. This expects that the previous context was already sent and can be completely discarded.

Definition at line 102 of file MessageContext.cxx.

◆ cloneFromCache()

std::unique_ptr< fair::mq::Message > o2::framework::MessageContext::cloneFromCache ( int64_t  id) const

Definition at line 120 of file MessageContext.cxx.

◆ countDeviceOutputs()

int o2::framework::MessageContext::countDeviceOutputs ( bool  excludeDPLOrigin = false) const

Definition at line 83 of file MessageContext.cxx.

◆ createMessage() [1/2]

fair::mq::MessagePtr o2::framework::MessageContext::createMessage ( RouteIndex  routeIndex,
int  index,
size_t  size 
)

call the proxy to create a message of the specified size we don't implement in the header to avoid including the fair::mq::Device header here that's why the different versions need to be implemented as individual functions

Definition at line 20 of file MessageContext.cxx.

◆ createMessage() [2/2]

fair::mq::MessagePtr o2::framework::MessageContext::createMessage ( RouteIndex  routeIndex,
int  index,
void data,
size_t  size,
fair::mq::FreeFn *  ffn,
void hint 
)

Definition at line 26 of file MessageContext.cxx.

◆ didDispatch()

bool o2::framework::MessageContext::didDispatch ( )
inline

Definition at line 494 of file MessageContext.h.

◆ fakeDispatch()

void o2::framework::MessageContext::fakeDispatch ( )
inline

Definition at line 493 of file MessageContext.h.

◆ findMessageDataProcessingHeader()

o2::framework::DataProcessingHeader * o2::framework::MessageContext::findMessageDataProcessingHeader ( const Output spec)

Definition at line 49 of file MessageContext.cxx.

◆ findMessageHeader()

o2::header::DataHeader * o2::framework::MessageContext::findMessageHeader ( const Output spec)

return the headers of the 1st (from the end) matching message checking first in mMessages then in mScheduledMessages

Definition at line 32 of file MessageContext.cxx.

◆ findMessageHeaders()

std::pair< o2::header::DataHeader *, o2::framework::DataProcessingHeader * > o2::framework::MessageContext::findMessageHeaders ( const Output spec)

◆ findMessageHeaderStack()

o2::header::Stack * o2::framework::MessageContext::findMessageHeaderStack ( const Output spec)

Definition at line 66 of file MessageContext.cxx.

◆ getMessagesForSending()

Messages o2::framework::MessageContext::getMessagesForSending ( )
inline

Definition at line 449 of file MessageContext.h.

◆ init()

void o2::framework::MessageContext::init ( DispatchControl &&  dispatcher)
inline

Definition at line 71 of file MessageContext.h.

◆ make()

template<typename T , typename... Args>
Messages::value_type o2::framework::MessageContext::make ( Args &&...  args)
inline

Create the specified context object from the variadic arguments as a unique pointer of the context object base class. The context object type is specified as template argument, each context object implementation must derive from the ContextObject interface.

Definition at line 427 of file MessageContext.h.

◆ make_scoped()

template<typename T , typename... Args>
ContextObjectScope< T > o2::framework::MessageContext::make_scoped ( Args &&...  args)
inline

Create scope handler managing the specified context object. The context object is created from the variadic arguments and is owned by the scope handler. If the handler goes out of scope, the object is scheduled in the context, either added to the list of messages or directly sent via the optional callback.

Definition at line 438 of file MessageContext.h.

◆ proxy()

FairMQDeviceProxy & o2::framework::MessageContext::proxy ( )
inline

Definition at line 469 of file MessageContext.h.

◆ pruneFromCache()

void o2::framework::MessageContext::pruneFromCache ( int64_t  id)

Definition at line 128 of file MessageContext.cxx.

◆ schedule()

void o2::framework::MessageContext::schedule ( Messages::value_type &&  message)

Schedule a context object for sending. The object is considered complete at this point and is sent directly through the dispatcher callback of the context if initialized.

Definition at line 133 of file MessageContext.cxx.

◆ size()

size_t o2::framework::MessageContext::size ( )
inline

Definition at line 459 of file MessageContext.h.

Member Data Documentation

◆ DefaultChannelIndex

constexpr int o2::framework::MessageContext::DefaultChannelIndex = 0
staticconstexpr

Definition at line 59 of file MessageContext.h.

◆ service_kind

constexpr ServiceKind o2::framework::MessageContext::service_kind = ServiceKind::Stream
staticconstexpr

Definition at line 56 of file MessageContext.h.


The documentation for this class was generated from the following files: