test
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 | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
ThePEG::ProxyBase Class Reference

#include <Proxy.h>

Inheritance diagram for ThePEG::ProxyBase:
ThePEG::Proxy< Proxy > ThePEG::Proxy< T > ThePEG::RandomEngineGlue::Proxy

Public Types

typedef unsigned long ProxyID
 

Public Member Functions

ProxyID getID () const
 
virtual ~ProxyBase ()
 

Private Types

typedef ProxyBase *(* ctor_t )(ProxyID id)
 

Private Member Functions

ProxyBaseoperator= (const ProxyBase &orig)
 
 ProxyBase (ProxyID id)
 
 ProxyBase (const ProxyBase &orig)
 

Static Private Member Functions

static boost::shared_ptr
< ProxyBase
create (ctor_t ctor)
 
static boost::shared_ptr
< ProxyBase
find (ProxyID id)
 

Private Attributes

const ProxyID id
 

Friends

template<class T >
class Proxy
 

Detailed Description

Definition at line 14 of file Proxy.h.

Member Typedef Documentation

typedef ProxyBase*(* ThePEG::ProxyBase::ctor_t)(ProxyID id)
private

Definition at line 23 of file Proxy.h.

typedef unsigned long ThePEG::ProxyBase::ProxyID

Definition at line 16 of file Proxy.h.

Constructor & Destructor Documentation

ProxyBase< T, Cloner >::~ProxyBase ( )
virtual

Definition at line 32 of file Proxy.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: Proxy.cc:11
static ProxyMap * getProxyMapInstance()
Definition: Proxy.cc:15
std::map< LHEProxy::ProxyID, boost::weak_ptr< LHEProxy > > ProxyMap
Definition: LHEProxy.cc:13
ProxyBase< T, Cloner >::ProxyBase ( ProxyID  id)
private

Definition at line 27 of file Proxy.cc.

27  :
28  id(id)
29 {
30 }
const ProxyID id
Definition: Proxy.h:36
ThePEG::ProxyBase::ProxyBase ( const ProxyBase orig)
private

Member Function Documentation

boost::shared_ptr< ProxyBase > ProxyBase< T, Cloner >::create ( ctor_t  ctor)
staticprivate

Definition at line 41 of file Proxy.cc.

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

Referenced by ThePEG::Proxy< Proxy >::create().

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

Definition at line 56 of file Proxy.cc.

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

Referenced by ThePEG::Proxy< Proxy >::find().

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

Definition at line 20 of file Proxy.h.

References id.

20 { return id; }
const ProxyID id
Definition: Proxy.h:36
ProxyBase& ThePEG::ProxyBase::operator= ( const ProxyBase orig)
private

Friends And Related Function Documentation

template<class T >
friend class Proxy
friend

Definition at line 25 of file Proxy.h.

Member Data Documentation

const ProxyID ThePEG::ProxyBase::id
private

Definition at line 36 of file Proxy.h.

Referenced by getID().