CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
edm::SetClassParsing Class Reference

#include <SetClassParsing.h>

Public Member Functions

 SetClassParsing (bool enable)
 
 ~SetClassParsing ()
 

Private Attributes

int previous_
 

Static Private Attributes

static std::atomic< bool > active_ = false
 

Detailed Description

An instance of this class can be used to temporarily enable or disable ROOT class parsing. The destructor restores the state.

Because this class modifies the global state of ROOT, it must not be used in concurrent context.

Definition at line 17 of file SetClassParsing.h.

Constructor & Destructor Documentation

◆ SetClassParsing()

edm::SetClassParsing::SetClassParsing ( bool  enable)
inline

Definition at line 19 of file SetClassParsing.h.

References active_, cms::cuda::assert(), DiMuonV_cfg::enable, and previous_.

19  {
20  bool expected = false;
21  const bool used_concurrently_but_shouldnt = active_.compare_exchange_strong(expected, true);
22  assert(used_concurrently_but_shouldnt);
23  previous_ = gInterpreter->SetClassAutoparsing(enable);
24  }
static std::atomic< bool > active_
assert(be >=bs)
enable
Messages.
Definition: DiMuonV_cfg.py:93

◆ ~SetClassParsing()

edm::SetClassParsing::~SetClassParsing ( )
inline

Definition at line 25 of file SetClassParsing.h.

References active_, and previous_.

25  {
26  gInterpreter->SetClassAutoparsing(previous_);
27  active_ = false;
28  }
static std::atomic< bool > active_

Member Data Documentation

◆ active_

std::atomic< bool > edm::SetClassParsing::active_ = false
staticprivate

Definition at line 32 of file SetClassParsing.h.

Referenced by SetClassParsing(), and ~SetClassParsing().

◆ previous_

int edm::SetClassParsing::previous_
private

Definition at line 31 of file SetClassParsing.h.

Referenced by SetClassParsing(), and ~SetClassParsing().