CMS 3D CMS Logo

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)=delete
 
 ProxyBase (const ProxyBase &orig)=delete
 
 ProxyBase (ProxyID id)
 

Static Private Member Functions

static std::shared_ptr< ProxyBasecreate (ctor_t ctor)
 
static std::shared_ptr< ProxyBasefind (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

◆ ctor_t

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

Definition at line 23 of file Proxy.h.

◆ ProxyID

typedef unsigned long ThePEG::ProxyBase::ProxyID

Definition at line 16 of file Proxy.h.

Constructor & Destructor Documentation

◆ ~ProxyBase()

ProxyBase::~ProxyBase ( )
virtual

Definition at line 29 of file Proxy.cc.

29  {
30  boost::mutex::scoped_lock scoped_lock(mutex);
31 
33  if (map)
34  map->erase(id);
35 }

References getProxyMapInstance(), genParticles_cff::map, and mutex.

◆ ProxyBase() [1/2]

ProxyBase::ProxyBase ( ProxyID  id)
private

Definition at line 27 of file Proxy.cc.

27 : id(id) {}

◆ ProxyBase() [2/2]

ThePEG::ProxyBase::ProxyBase ( const ProxyBase orig)
privatedelete

Member Function Documentation

◆ create()

std::shared_ptr< ProxyBase > ProxyBase::create ( ctor_t  ctor)
staticprivate

Definition at line 37 of file Proxy.cc.

37  {
38  static ProxyBase::ProxyID nextProxyID = 0;
39 
40  boost::mutex::scoped_lock scoped_lock(mutex);
41 
42  std::shared_ptr<ProxyBase> proxy(ctor(++nextProxyID));
43 
45  if (map)
46  map->insert(ProxyMap::value_type(proxy->getID(), proxy));
47 
48  return proxy;
49 }

References getProxyMapInstance(), genParticles_cff::map, and mutex.

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

◆ find()

std::shared_ptr< ProxyBase > ProxyBase::find ( ProxyID  id)
staticprivate

Definition at line 51 of file Proxy.cc.

51  {
52  boost::mutex::scoped_lock scoped_lock(mutex);
53 
55  if (!map)
56  return std::shared_ptr<ProxyBase>();
57 
58  ProxyMap::const_iterator pos = map->find(id);
59  if (pos == map->end())
60  return std::shared_ptr<ProxyBase>();
61 
62  return std::shared_ptr<ProxyBase>(pos->second);
63 }

References getProxyMapInstance(), genParticles_cff::map, and mutex.

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

◆ getID()

ProxyID ThePEG::ProxyBase::getID ( ) const
inline

Definition at line 20 of file Proxy.h.

20 { return id; }

References id.

◆ operator=()

ProxyBase& ThePEG::ProxyBase::operator= ( const ProxyBase orig)
privatedelete

Friends And Related Function Documentation

◆ Proxy

template<class T >
friend class Proxy
friend

Definition at line 26 of file Proxy.h.

Member Data Documentation

◆ id

const ProxyID ThePEG::ProxyBase::id
private

Definition at line 37 of file Proxy.h.

Referenced by getID().

pos
Definition: PixelAliasList.h:18
mutex
static boost::mutex mutex
Definition: Proxy.cc:9
ThePEG::ProxyBase::id
const ProxyID id
Definition: Proxy.h:37
ThePEG::ProxyBase::ProxyID
unsigned long ProxyID
Definition: Proxy.h:16
getProxyMapInstance
static ProxyMap * getProxyMapInstance()
Definition: Proxy.cc:13
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
ProxyMap
std::map< ProxyBase::ProxyID, std::weak_ptr< ProxyBase > > ProxyMap
Definition: Proxy.cc:11
genParticles_cff.map
map
Definition: genParticles_cff.py:11