CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::service::MessageServicePresence Class Reference

#include <MessageServicePresence.h>

Inheritance diagram for edm::service::MessageServicePresence:
edm::Presence

Public Member Functions

 MessageServicePresence ()
 
 ~MessageServicePresence () override
 
- Public Member Functions inherited from edm::Presence
 Presence ()
 
virtual ~Presence ()=0
 

Private Member Functions

 MessageServicePresence (MessageServicePresence const &)=delete
 
void operator= (MessageServicePresence const &)=delete
 
std::shared_ptr< ThreadQueue const > queue () const
 
std::shared_ptr< ThreadQueue > & queue ()
 

Private Attributes

edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
 
boost::thread m_scribeThread
 

Detailed Description

Definition at line 16 of file MessageServicePresence.h.

Constructor & Destructor Documentation

edm::service::MessageServicePresence::MessageServicePresence ( )

Definition at line 46 of file MessageServicePresence.cc.

References queue(), and edm::MessageLoggerQ::setMLscribe_ptr().

47  : Presence(),
48  m_queue(new ThreadQueue),
49  m_scribeThread(((void)MessageLoggerQ::instance() // ensure Q's static data init'd
50  ,
51  std::bind(&runMessageLoggerScribe, queue())
52  // start a new thread, run rMLS(m_queue)
53  // ChangeLog 2
54  ))
55  // Note that m_scribeThread, which is a boost::thread, has a single-argument ctor -
56  // just the function to be run. But we need to do something first, namely,
57  // ensure that the MessageLoggerQ is in a valid state - and that requires
58  // a statement. So we bundle that statement in parenthesis, separated by
59  // a comma, with the argument we really want (runMessageLoggerScribe). This
60  // creates a single argument, wheich evaluates to runMessageLoggerScribe after
61  // first executing the before-the-comma statement.
62  {
64  std::shared_ptr<edm::service::AbstractMLscribe>(std::make_shared<MainThreadMLscribe>(queue())));
65  // change log 3
66  //std::cout << "MessageServicePresence ctor\n";
67  }
std::shared_ptr< ThreadQueue const > queue() const
static MessageLoggerQ * instance()
static void setMLscribe_ptr(std::shared_ptr< edm::service::AbstractMLscribe > m)
edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
edm::service::MessageServicePresence::~MessageServicePresence ( )
override

Definition at line 69 of file MessageServicePresence.cc.

References m_scribeThread, edm::MessageLoggerQ::MLqEND(), and edm::MessageLoggerQ::setMLscribe_ptr().

69  {
71  m_scribeThread.join();
72  MessageLoggerQ::setMLscribe_ptr(std::shared_ptr<edm::service::AbstractMLscribe>()); // change log 3
73  }
static void MLqEND()
static void setMLscribe_ptr(std::shared_ptr< edm::service::AbstractMLscribe > m)
edm::service::MessageServicePresence::MessageServicePresence ( MessageServicePresence const &  )
privatedelete

Member Function Documentation

void edm::service::MessageServicePresence::operator= ( MessageServicePresence const &  )
privatedelete
std::shared_ptr<ThreadQueue const> edm::service::MessageServicePresence::queue ( ) const
inlineprivate

Definition at line 27 of file MessageServicePresence.h.

References edm::get_underlying_safe(), and m_queue.

Referenced by MessageServicePresence().

27 { return get_underlying_safe(m_queue); }
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
std::shared_ptr<ThreadQueue>& edm::service::MessageServicePresence::queue ( )
inlineprivate

Definition at line 28 of file MessageServicePresence.h.

References edm::get_underlying_safe(), and m_queue.

28 { return get_underlying_safe(m_queue); }
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue

Member Data Documentation

edm::propagate_const<std::shared_ptr<ThreadQueue> > edm::service::MessageServicePresence::m_queue
private

Definition at line 31 of file MessageServicePresence.h.

Referenced by queue().

boost::thread edm::service::MessageServicePresence::m_scribeThread
private

Definition at line 32 of file MessageServicePresence.h.

Referenced by ~MessageServicePresence().