CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
lhef::LHEProxy Class Reference

#include <LHEProxy.h>

Public Types

typedef unsigned long ProxyID
 

Public Member Functions

void clearEvent ()
 
void clearRunInfo ()
 
const std::shared_ptr< LHEEvent > & getEvent () const
 
ProxyID getID () const
 
const std::shared_ptr
< LHERunInfo > & 
getRunInfo () const
 
 LHEProxy (const LHEProxy &orig)=delete
 
void loadEvent (const std::shared_ptr< LHEEvent > &event)
 
void loadRunInfo (const std::shared_ptr< LHERunInfo > &runInfo)
 
LHEProxyoperator= (const LHEProxy &orig)=delete
 
std::shared_ptr< LHEEventreleaseEvent ()
 
std::shared_ptr< LHERunInforeleaseRunInfo ()
 
 ~LHEProxy ()
 

Static Public Member Functions

static std::shared_ptr< LHEProxycreate ()
 
static std::shared_ptr< LHEProxyfind (ProxyID id)
 

Private Member Functions

 LHEProxy (ProxyID id)
 

Private Attributes

std::shared_ptr< LHEEventevent
 
const ProxyID id
 
std::shared_ptr< LHERunInforunInfo
 

Detailed Description

Definition at line 12 of file LHEProxy.h.

Member Typedef Documentation

typedef unsigned long lhef::LHEProxy::ProxyID

Definition at line 14 of file LHEProxy.h.

Constructor & Destructor Documentation

lhef::LHEProxy::LHEProxy ( const LHEProxy orig)
delete

Referenced by create().

LHEProxy::~LHEProxy ( )

Definition at line 28 of file LHEProxy.cc.

References getProxyMapInstance(), and mutex.

28  {
29  std::scoped_lock scoped_lock(mutex);
30 
32  if (map)
33  map->erase(id);
34 }
std::map< ProxyBase::ProxyID, std::weak_ptr< ProxyBase > > ProxyMap
Definition: Proxy.cc:10
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:12
static std::mutex mutex
Definition: LHEProxy.cc:8
LHEProxy::LHEProxy ( ProxyID  id)
private

Definition at line 26 of file LHEProxy.cc.

26 : id(id) {}
const ProxyID id
Definition: LHEProxy.h:50

Member Function Documentation

void lhef::LHEProxy::clearEvent ( )
inline

Definition at line 37 of file LHEProxy.h.

37 { event.reset(); }
void lhef::LHEProxy::clearRunInfo ( )
inline

Definition at line 36 of file LHEProxy.h.

References runInfo.

36 { runInfo.reset(); }
std::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:52
std::shared_ptr< LHEProxy > LHEProxy::create ( )
static

Definition at line 36 of file LHEProxy.cc.

References getProxyMapInstance(), LHEProxy(), mutex, and submitPVResolutionJobs::proxy.

36  {
37  static LHEProxy::ProxyID nextProxyID = 0;
38 
39  std::scoped_lock scoped_lock(mutex);
40 
41  std::shared_ptr<LHEProxy> proxy(new LHEProxy(++nextProxyID));
42 
44  if (map)
45  map->insert(ProxyMap::value_type(proxy->getID(), proxy));
46 
47  return proxy;
48 }
LHEProxy(const LHEProxy &orig)=delete
std::map< ProxyBase::ProxyID, std::weak_ptr< ProxyBase > > ProxyMap
Definition: Proxy.cc:10
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:12
unsigned long ProxyID
Definition: LHEProxy.h:14
static std::mutex mutex
Definition: LHEProxy.cc:8
std::shared_ptr< LHEProxy > LHEProxy::find ( ProxyID  id)
static

Definition at line 50 of file LHEProxy.cc.

References getProxyMapInstance(), and mutex.

50  {
51  std::scoped_lock scoped_lock(mutex);
52 
54  if (!map)
55  return std::shared_ptr<LHEProxy>();
56 
57  ProxyMap::const_iterator pos = map->find(id);
58  if (pos == map->end())
59  return std::shared_ptr<LHEProxy>();
60 
61  return std::shared_ptr<LHEProxy>(pos->second);
62 }
std::map< ProxyBase::ProxyID, std::weak_ptr< ProxyBase > > ProxyMap
Definition: Proxy.cc:10
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:12
static std::mutex mutex
Definition: LHEProxy.cc:8
const std::shared_ptr<LHEEvent>& lhef::LHEProxy::getEvent ( ) const
inline

Definition at line 23 of file LHEProxy.h.

References event.

23 { return event; }
std::shared_ptr< LHEEvent > event
Definition: LHEProxy.h:53
ProxyID lhef::LHEProxy::getID ( ) const
inline

Definition at line 42 of file LHEProxy.h.

References id.

42 { return id; }
const ProxyID id
Definition: LHEProxy.h:50
const std::shared_ptr<LHERunInfo>& lhef::LHEProxy::getRunInfo ( ) const
inline

Definition at line 22 of file LHEProxy.h.

References runInfo.

22 { return runInfo; }
std::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:52
void lhef::LHEProxy::loadEvent ( const std::shared_ptr< LHEEvent > &  event)
inline

Definition at line 40 of file LHEProxy.h.

References event.

40 { this->event = event; }
std::shared_ptr< LHEEvent > event
Definition: LHEProxy.h:53
void lhef::LHEProxy::loadRunInfo ( const std::shared_ptr< LHERunInfo > &  runInfo)
inline

Definition at line 39 of file LHEProxy.h.

References runInfo.

39 { this->runInfo = runInfo; }
std::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:52
LHEProxy& lhef::LHEProxy::operator= ( const LHEProxy orig)
delete
std::shared_ptr<LHEEvent> lhef::LHEProxy::releaseEvent ( )
inline

Definition at line 30 of file LHEProxy.h.

References event, and mps_fire::result.

30  {
31  std::shared_ptr<LHEEvent> result(event);
32  event.reset();
33  return result;
34  }
tuple result
Definition: mps_fire.py:311
std::shared_ptr< LHEEvent > event
Definition: LHEProxy.h:53
std::shared_ptr<LHERunInfo> lhef::LHEProxy::releaseRunInfo ( )
inline

Definition at line 25 of file LHEProxy.h.

References mps_fire::result, and runInfo.

25  {
26  std::shared_ptr<LHERunInfo> result(runInfo);
27  runInfo.reset();
28  return result;
29  }
std::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:52
tuple result
Definition: mps_fire.py:311

Member Data Documentation

std::shared_ptr<LHEEvent> lhef::LHEProxy::event
private
const ProxyID lhef::LHEProxy::id
private

Definition at line 50 of file LHEProxy.h.

Referenced by getID().

std::shared_ptr<LHERunInfo> lhef::LHEProxy::runInfo
private

Definition at line 52 of file LHEProxy.h.

Referenced by clearRunInfo(), getRunInfo(), loadRunInfo(), and releaseRunInfo().