Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Friends
CLHEP::weak_ptr< T > Class Template Reference

#include <memory.h>

Public Types

typedef P element_type
 

Public Member Functions

 weak_ptr () throw ()
 
void swap (this_type &other) throw ()
 
template<typename P2 >
 weak_ptr (weak_ptr< P2 > const &r, typename enable_if_ptr_convertible< P2, P, void * >::type=0) throw ()
 
template<typename P2 >
 weak_ptr (shared_ptr< P2 > const &r, typename enable_if_ptr_convertible< P2, P, void * >::type=0) throw ()
 
template<typename P2 >
weak_ptroperator= (weak_ptr< P2 > const &r) throw ()
 
template<typename P2 >
weak_ptroperator= (shared_ptr< P2 > const &r) throw ()
 
shared_ptr< P > lock () const throw ()
 
long use_count () const throw ()
 
bool expired () const throw ()
 
bool _empty () const
 
void reset () throw ()
 
void _internal_assign (P *px2, sp::shared_ctrl_handle const &pn2)
 
template<typename P2 >
bool _internal_less (weak_ptr< P2 > const &rhs) const
 
template<typename P2 >
weak_ptr< P > & operator= (weak_ptr< P2 > const &r) throw ()
 
template<typename P2 >
weak_ptr< P > & operator= (shared_ptr< P2 > const &r) throw ()
 

Friends

template<typename >
class shared_ptr
 
template<typename >
class weak_ptr
 

Detailed Description

template<typename T>
class CLHEP::weak_ptr< T >

Definition at line 67 of file memory.h.

Member Typedef Documentation

template<typename T>
typedef P CLHEP::weak_ptr< T >::element_type

Definition at line 1309 of file memory.h.

Constructor & Destructor Documentation

template<typename P >
CLHEP::weak_ptr< P >::weak_ptr ( )
throw (
)
inline

Definition at line 1356 of file memory.h.

1357  : px( 0 )
1358  , pn( )
1359 { }
template<typename P >
template<typename P2 >
CLHEP::weak_ptr< P >::weak_ptr ( weak_ptr< P2 > const &  r,
typename enable_if_ptr_convertible< P2, P, void * >::type  = 0 
)
throw (
)
inline

Definition at line 1363 of file memory.h.

1366  : px( r.lock().get() ) // same as r.px, but doesn't risk invalidation
1367  , pn( r.pn )
1368 { }
template<typename P >
template<typename P2 >
CLHEP::weak_ptr< P >::weak_ptr ( shared_ptr< P2 > const &  r,
typename enable_if_ptr_convertible< P2, P, void * >::type  = 0 
)
throw (
)
inline

Definition at line 1372 of file memory.h.

1375  : px( r.px )
1376  , pn( r.pn )
1377 { }

Member Function Documentation

template<typename P >
bool CLHEP::weak_ptr< P >::_empty ( ) const
inline

Definition at line 1422 of file memory.h.

References G4InuclParticleNames::pn.

1423 {
1424  return pn.empty();
1425 }
bool empty() const
Definition: memory.h:692
template<typename P >
void CLHEP::weak_ptr< P >::_internal_assign ( P *  px2,
sp::shared_ctrl_handle const &  pn2 
)
inline

Definition at line 1444 of file memory.h.

References G4InuclParticleNames::pn.

1445 {
1446  px = px2;
1447  pn = pn2;
1448 }
template<typename P >
template<typename P2 >
bool CLHEP::weak_ptr< P >::_internal_less ( weak_ptr< P2 > const &  rhs) const
inline

Definition at line 1453 of file memory.h.

References G4InuclParticleNames::pn.

1454 {
1455  return pn < rhs.pn;
1456 }
template<typename P >
bool CLHEP::weak_ptr< P >::expired ( ) const
throw (
)
inline

Definition at line 1415 of file memory.h.

References G4InuclParticleNames::pn.

1416 {
1417  return pn.use_count() == 0;
1418 }
long use_count() const
Definition: memory.h:698
template<typename P >
shared_ptr< P > CLHEP::weak_ptr< P >::lock ( ) const
throw (
)
inline

Definition at line 1401 of file memory.h.

1402 {
1403  return shared_ptr<element_type>( *this, sp::sp_nothrow_tag() );
1404 }
template<typename T>
template<typename P2 >
weak_ptr& CLHEP::weak_ptr< T >::operator= ( weak_ptr< P2 > const &  r)
throw (
)
inline
template<typename T>
template<typename P2 >
weak_ptr& CLHEP::weak_ptr< T >::operator= ( shared_ptr< P2 > const &  r)
throw (
)
inline
template<typename T>
template<typename P2 >
weak_ptr<P>& CLHEP::weak_ptr< T >::operator= ( weak_ptr< P2 > const &  r)
throw (
)

Definition at line 1382 of file memory.h.

References G4InuclParticleNames::pn.

1383 {
1384  px = r.lock().get();
1385  pn = r.pn;
1386  return *this;
1387 }
template<typename T>
template<typename P2 >
weak_ptr<P>& CLHEP::weak_ptr< T >::operator= ( shared_ptr< P2 > const &  r)
throw (
)

Definition at line 1392 of file memory.h.

References G4InuclParticleNames::pn.

1393 {
1394  px = r.px;
1395  pn = r.pn;
1396  return *this;
1397 }
template<typename P >
void CLHEP::weak_ptr< P >::reset ( )
throw (
)
inline

Definition at line 1429 of file memory.h.

References CLHEP::weak_ptr< T >::swap().

1430 {
1431  this_type().swap(*this);
1432 }
template<typename P >
void CLHEP::weak_ptr< P >::swap ( this_type other)
throw (
)
inline

Definition at line 1436 of file memory.h.

References G4InuclParticleNames::pn, and CLHEP::swap().

Referenced by CLHEP::weak_ptr< T >::reset().

1437 {
1438  std::swap(px, other.px);
1439  pn.swap(other.pn);
1440 }
void swap(weak_ctrl_handle &)
Definition: memory.h:647
void swap(weak_ptr< P > &a, weak_ptr< P > &b)
Definition: memory.h:1467
template<typename P >
long CLHEP::weak_ptr< P >::use_count ( ) const
throw (
)
inline

Definition at line 1408 of file memory.h.

References G4InuclParticleNames::pn.

1409 {
1410  return pn.use_count();
1411 }
long use_count() const
Definition: memory.h:698

Friends And Related Function Documentation

template<typename T>
template<typename >
friend class shared_ptr
friend

Definition at line 1305 of file memory.h.

template<typename T>
template<typename >
friend class weak_ptr
friend

Definition at line 1306 of file memory.h.


The documentation for this class was generated from the following file: