15 #include "boost/thread/tss.hpp"
63 static boost::thread_specific_ptr<MessageDrop> drops;
73 namespace messagedrop {
78 virtual std::string theContext()
const = 0;
79 virtual void snapshot() = 0;
84 typedef std::map<const void*, std::string>::const_iterator
NLMiter;
87 : name_initial_value_ (
" ")
88 , label_initial_value_ (
" ")
89 , name_ (&name_initial_value_)
90 , label_ (&label_initial_value_)
91 , phasePtr_ (
"(Startup)")
97 NLMiter nameLableIter = nameLabelMap_.find(moduleID_);
98 if (nameLableIter != nameLabelMap_.end()) {
99 cache_.assign(nameLableIter->second);
100 cache_.append(phasePtr_);
104 cache_.assign(*name_);
106 cache_.append(*label_);
107 nameLabelMap_[moduleID_] = cache_;
108 cache_.append(phasePtr_);
113 std::string
const &
label,
114 const void * moduleID,
118 moduleID_ = moduleID;
124 snapshot_name_ = *name_;
125 name_ = &snapshot_name_;
126 snapshot_label_ = *label_;
127 label_ = &snapshot_label_;
128 if ( snapshot_phase_ != phasePtr_ ) {
129 std::strncpy (snapshot_phase_,phasePtr_,PHASE_MAX_LENGTH);
131 snapshot_phase_[PHASE_MAX_LENGTH] = 0;
132 phasePtr_ = snapshot_phase_;
135 static const int PHASE_MAX_LENGTH = 32;
146 char snapshot_phase_[PHASE_MAX_LENGTH+1];
152 : typePtr_(
"PathNotYetEstablished")
155 if ( cache_.empty() ) {
156 cache_.assign(typePtr_);
157 cache_.append(
path_);
161 void set(
const char*
type, std::string
const & pathname) {
168 if ( snapshot_type_ != typePtr_ ) {
169 std::strncpy (snapshot_type_,typePtr_,TYPE_MAX_LENGTH);
171 snapshot_type_[TYPE_MAX_LENGTH] = 0;
172 typePtr_ = snapshot_type_;
175 static const int TYPE_MAX_LENGTH = 32;
179 char snapshot_type_[TYPE_MAX_LENGTH+1];
188 void set(
const char * sing) {singlet_ = sing; }
191 if ( snapshot_singlet_ != singlet_ ) {
192 std::strncpy (snapshot_singlet_,singlet_,SINGLET_MAX_LENGTH);
194 snapshot_singlet_[SINGLET_MAX_LENGTH] = 0;
195 singlet_ = snapshot_singlet_;
198 static const int SINGLET_MAX_LENGTH = 32;
200 char snapshot_singlet_[SINGLET_MAX_LENGTH+1];
207 , runEvent(
"pre-events")
210 , spWithPhase(new messagedrop::StringProducerWithPhase)
211 , spPath (new messagedrop::StringProducerPath)
212 , spSinglet (new messagedrop::StringProducerSinglet)
213 , moduleNameProducer (spSinglet)
225 std::string
const &
label,
226 const void * moduleID,
253 unsigned char MessageDrop::messageLoggerScribeIsRunning = 0;
std::string snapshot_label_
StringProducerWithPhase()
void set(const char *type, std::string const &pathname)
static bool warningEnabled
void setModuleWithPhase(std::string const &name, std::string const &label, const void *moduleID, const char *phase)
virtual std::string theContext() const
static edm::Exception * ex_p
static MessageDrop * instance()
messagedrop::StringProducer const * moduleNameProducer
std::string const label_initial_value_
void setSinglet(const char *sing)
static bool debugAlwaysSuppressed
virtual std::string theContext() const
virtual std::string theContext() const
virtual ~StringProducer()
void set(std::string const &name, std::string const &label, const void *moduleID, const char *phase)
std::string moduleContext()
std::map< const void *, std::string > nameLabelMap_
std::string const * name_
std::string const name_initial_value_
static bool warningAlwaysSuppressed
messagedrop::StringProducerSinglet * spSinglet
messagedrop::StringProducerWithPhase * spWithPhase
std::map< const void *, std::string >::const_iterator NLMiter
virtual std::string theContext() const =0
void set(const char *sing)
void setPath(const char *type, std::string const &pathname)
std::string const * label_
static bool infoAlwaysSuppressed
messagedrop::StringProducerPath * spPath
std::string snapshot_name_