15 #include "boost/thread/tss.hpp"
67 static boost::thread_specific_ptr<MessageDrop> drops;
77 namespace messagedrop {
82 virtual std::string theContext()
const = 0;
83 virtual void snapshot() = 0;
88 typedef std::map<const void*, std::string>::const_iterator
NLMiter;
91 : name_initial_value_ (
" ")
92 , label_initial_value_ (
" ")
93 , name_ (&name_initial_value_)
94 , label_ (&label_initial_value_)
95 , phasePtr_ (
"(Startup)")
101 , snapshot_phase_ () {
102 memset(snapshot_phase_,
'\0',
sizeof(snapshot_phase_));
106 if (cache_.empty()) {
107 if (moduleID_ != 0) {
108 NLMiter nameLableIter = nameLabelMap_.find(moduleID_);
109 if (nameLableIter != nameLabelMap_.end()) {
110 cache_.assign(nameLableIter->second);
111 cache_.append(phasePtr_);
115 cache_.assign(*name_);
117 cache_.append(*label_);
118 nameLabelMap_[moduleID_] = cache_;
119 cache_.append(phasePtr_);
124 std::string
const &
label,
125 const void * moduleID,
129 moduleID_ = moduleID;
135 snapshot_name_ = *name_;
136 name_ = &snapshot_name_;
137 snapshot_label_ = *label_;
138 label_ = &snapshot_label_;
139 if ( snapshot_phase_ != phasePtr_ ) {
140 std::strncpy (snapshot_phase_,phasePtr_,PHASE_MAX_LENGTH);
142 snapshot_phase_[PHASE_MAX_LENGTH] = 0;
143 phasePtr_ = snapshot_phase_;
146 static const int PHASE_MAX_LENGTH = 32;
157 char snapshot_phase_[PHASE_MAX_LENGTH+1];
163 : typePtr_(
"PathNotYetEstablished")
167 memset(snapshot_type_,
'\0',
sizeof(snapshot_type_));
170 if ( cache_.empty() ) {
171 cache_.assign(typePtr_);
172 cache_.append(
path_);
183 if ( snapshot_type_ != typePtr_ ) {
184 std::strncpy (snapshot_type_,typePtr_,TYPE_MAX_LENGTH);
186 snapshot_type_[TYPE_MAX_LENGTH] = 0;
187 typePtr_ = snapshot_type_;
190 static const int TYPE_MAX_LENGTH = 32;
194 char snapshot_type_[TYPE_MAX_LENGTH+1];
200 : singlet_(
"(NoModuleName)")
201 , snapshot_singlet_() {
202 memset(snapshot_singlet_,
'\0',
sizeof(snapshot_singlet_));
207 void set(
const char * sing) {singlet_ = sing; }
210 if ( snapshot_singlet_ != singlet_ ) {
211 std::strncpy (snapshot_singlet_,singlet_,SINGLET_MAX_LENGTH);
213 snapshot_singlet_[SINGLET_MAX_LENGTH] = 0;
214 singlet_ = snapshot_singlet_;
217 static const int SINGLET_MAX_LENGTH = 32;
219 char snapshot_singlet_[SINGLET_MAX_LENGTH+1];
226 , runEvent(
"pre-events")
229 , spWithPhase(new messagedrop::StringProducerWithPhase)
230 , spPath (new messagedrop::StringProducerPath)
231 , spSinglet (new messagedrop::StringProducerSinglet)
232 , moduleNameProducer (spSinglet)
244 std::string
const &
label,
245 const void * moduleID,
272 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_