CMS 3D CMS Logo

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

List of all members.

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

class Proxy

Detailed Description

Definition at line 14 of file Proxy.h.


Member Typedef Documentation

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(), and mutex.

{
        boost::mutex::scoped_lock scoped_lock(mutex);

        ProxyMap *map = getProxyMapInstance();
        if (map)
                map->erase(id);
}
ProxyBase< T, Cloner >::ProxyBase ( ProxyID  id) [private]

Definition at line 27 of file Proxy.cc.

                               :
        id(id)
{
}
ThePEG::ProxyBase::ProxyBase ( const ProxyBase orig) [private]

Member Function Documentation

boost::shared_ptr< ProxyBase > ProxyBase< T, Cloner >::create ( ctor_t  ctor) [static, private]

Definition at line 41 of file Proxy.cc.

References getProxyMapInstance(), and mutex.

{
        static ProxyBase::ProxyID nextProxyID = 0;

        boost::mutex::scoped_lock scoped_lock(mutex);

        boost::shared_ptr<ProxyBase> proxy(ctor(++nextProxyID));

        ProxyMap *map = getProxyMapInstance();
        if (map)
                map->insert(ProxyMap::value_type(proxy->getID(), proxy));

        return proxy;
}
boost::shared_ptr< ProxyBase > ProxyBase< T, Cloner >::find ( ProxyID  id) [static, private]

Reimplemented in ThePEG::Proxy< T >, and ThePEG::Proxy< Proxy >.

Definition at line 56 of file Proxy.cc.

References getProxyMapInstance(), mutex, and pos.

{
        boost::mutex::scoped_lock scoped_lock(mutex);

        ProxyMap *map = getProxyMapInstance();
        if (!map)
                return boost::shared_ptr<ProxyBase>();

        ProxyMap::const_iterator pos = map->find(id);
        if (pos == map->end())
                return boost::shared_ptr<ProxyBase>();

        return boost::shared_ptr<ProxyBase>(pos->second);
}
ProxyID ThePEG::ProxyBase::getID ( ) const [inline]

Definition at line 20 of file Proxy.h.

References id.

{ return id; }
ProxyBase& ThePEG::ProxyBase::operator= ( const ProxyBase orig) [private]

Friends And Related Function Documentation

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().