CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 boost::shared_ptr
< LHEEvent > & 
getEvent () const
 
ProxyID getID () const
 
const boost::shared_ptr
< LHERunInfo > & 
getRunInfo () const
 
void loadEvent (const boost::shared_ptr< LHEEvent > &event)
 
void loadRunInfo (const boost::shared_ptr< LHERunInfo > &runInfo)
 
boost::shared_ptr< LHEEventreleaseEvent ()
 
boost::shared_ptr< LHERunInforeleaseRunInfo ()
 
 ~LHEProxy ()
 

Static Public Member Functions

static boost::shared_ptr
< LHEProxy
create ()
 
static boost::shared_ptr
< LHEProxy
find (ProxyID id)
 

Private Member Functions

 LHEProxy (ProxyID id)
 
 LHEProxy (const LHEProxy &orig)
 
LHEProxyoperator= (const LHEProxy &orig)
 

Private Attributes

boost::shared_ptr< LHEEventevent
 
const ProxyID id
 
boost::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

LHEProxy::~LHEProxy ( )

Definition at line 32 of file LHEProxy.cc.

References getProxyMapInstance(), python.multivaluedict::map(), and mutex.

33 {
34  boost::mutex::scoped_lock scoped_lock(mutex);
35 
37  if (map)
38  map->erase(id);
39 }
static boost::mutex mutex
Definition: LHEProxy.cc:11
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:15
std::map< LHEProxy::ProxyID, boost::weak_ptr< LHEProxy > > ProxyMap
Definition: LHEProxy.cc:13
LHEProxy::LHEProxy ( ProxyID  id)
private

Definition at line 27 of file LHEProxy.cc.

Referenced by create().

27  :
28  id(id)
29 {
30 }
const ProxyID id
Definition: LHEProxy.h:56
lhef::LHEProxy::LHEProxy ( const LHEProxy orig)
private

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(); }
boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:58
boost::shared_ptr< LHEProxy > LHEProxy::create ( )
static

Definition at line 41 of file LHEProxy.cc.

References getProxyMapInstance(), LHEProxy(), python.multivaluedict::map(), and mutex.

Referenced by lhef::ThePEGHadronisation::ThePEGHadronisation().

42 {
43  static LHEProxy::ProxyID nextProxyID = 0;
44 
45  boost::mutex::scoped_lock scoped_lock(mutex);
46 
47  boost::shared_ptr<LHEProxy> proxy(new LHEProxy(++nextProxyID));
48 
50  if (map)
51  map->insert(ProxyMap::value_type(proxy->getID(), proxy));
52 
53  return proxy;
54 }
static boost::mutex mutex
Definition: LHEProxy.cc:11
LHEProxy(ProxyID id)
Definition: LHEProxy.cc:27
Container::value_type value_type
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:15
unsigned long ProxyID
Definition: LHEProxy.h:14
std::map< LHEProxy::ProxyID, boost::weak_ptr< LHEProxy > > ProxyMap
Definition: LHEProxy.cc:13
boost::shared_ptr< LHEProxy > LHEProxy::find ( ProxyID  id)
static

Definition at line 56 of file LHEProxy.cc.

References getProxyMapInstance(), python.multivaluedict::map(), and mutex.

57 {
58  boost::mutex::scoped_lock scoped_lock(mutex);
59 
61  if (!map)
62  return boost::shared_ptr<LHEProxy>();
63 
64  ProxyMap::const_iterator pos = map->find(id);
65  if (pos == map->end())
66  return boost::shared_ptr<LHEProxy>();
67 
68  return boost::shared_ptr<LHEProxy>(pos->second);
69 }
static boost::mutex mutex
Definition: LHEProxy.cc:11
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:15
std::map< LHEProxy::ProxyID, boost::weak_ptr< LHEProxy > > ProxyMap
Definition: LHEProxy.cc:13
const boost::shared_ptr<LHEEvent>& lhef::LHEProxy::getEvent ( ) const
inline

Definition at line 20 of file LHEProxy.h.

References event.

21  { return event; }
boost::shared_ptr< LHEEvent > event
Definition: LHEProxy.h:59
ProxyID lhef::LHEProxy::getID ( ) const
inline

Definition at line 44 of file LHEProxy.h.

References id.

44 { return id; }
const ProxyID id
Definition: LHEProxy.h:56
const boost::shared_ptr<LHERunInfo>& lhef::LHEProxy::getRunInfo ( ) const
inline

Definition at line 18 of file LHEProxy.h.

References runInfo.

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

Definition at line 41 of file LHEProxy.h.

References event.

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

Definition at line 39 of file LHEProxy.h.

References runInfo.

40  { this->runInfo = runInfo; }
boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:58
LHEProxy& lhef::LHEProxy::operator= ( const LHEProxy orig)
private
boost::shared_ptr<LHEEvent> lhef::LHEProxy::releaseEvent ( )
inline

Definition at line 29 of file LHEProxy.h.

References event, and query::result.

30  {
31  boost::shared_ptr<LHEEvent> result(event);
32  event.reset();
33  return result;
34  }
boost::shared_ptr< LHEEvent > event
Definition: LHEProxy.h:59
tuple result
Definition: query.py:137
boost::shared_ptr<LHERunInfo> lhef::LHEProxy::releaseRunInfo ( )
inline

Definition at line 23 of file LHEProxy.h.

References query::result, and runInfo.

24  {
25  boost::shared_ptr<LHERunInfo> result(runInfo);
26  runInfo.reset();
27  return result;
28  }
tuple result
Definition: query.py:137
boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:58

Member Data Documentation

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

Definition at line 56 of file LHEProxy.h.

Referenced by getID().

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

Definition at line 58 of file LHEProxy.h.

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