FEI Package Browser (Single Doxygen Collection)
Version of the Day
|
#include <fei_SharedPtr.hpp>
Public Types | |
typedef T | element_type |
Public Member Functions | |
SharedPtr (T *p) | |
SharedPtr (void) | |
~SharedPtr () | |
template<typename Y > | |
SharedPtr (const SharedPtr< Y > &x) | |
template<typename Y > | |
SharedPtr & | operator= (const SharedPtr< Y > &x) |
SharedPtr (const SharedPtr &x) | |
SharedPtr & | operator= (const SharedPtr &x) |
void | reset (T *p=0) |
T & | operator* () const |
T * | operator-> () const |
T * | get () const |
long | use_count () const |
bool | unique () const |
void | share (T *xpointer, long *xcount) |
void | dispose () |
Private Attributes | |
T * | pointer |
long * | count |
Friends | |
template<typename Y > | |
class | SharedPtr |
A smart pointer with reference counted copy semantics. This class is a close copy of boost::shared_ptr. See www.boost.org, and www.boost.org/libs/smart_ptr/smart_ptr.htm. For logistical reasons it was deemed easier to make a copy of the boost::shared_ptr rather than having FEI be dependent on boost. According to TR1 (C++ Technical Report 1), referenced on the boost web site, shared_ptr will be migrating into the C++ standard.
fei::SharedPtr usage notes:
Construction:
Assignment:
Comparison:
The object pointed to is deleted when the last SharedPtr pointing to it is destroyed or reset.
Definition at line 65 of file fei_SharedPtr.hpp.
typedef T fei::SharedPtr< T >::element_type |
The type of the stored pointer.
Definition at line 72 of file fei_SharedPtr.hpp.
|
inlineexplicit |
Constructs a SharedPtr, storing a copy of p, which must have been allocated via a C++ new expression or be 0. On exit, use_count() is 1 (even if p==0; see the destructor).
The only exception which may be thrown by this constructor is std::bad_alloc. If an exception is thrown, delete p is called.
p | the pointer value recently allocated |
Definition at line 84 of file fei_SharedPtr.hpp.
|
inline |
Definition at line 95 of file fei_SharedPtr.hpp.
|
inline |
Destructor. If use_count() == 1, deletes the object pointed to by the stored pointer. Otherwise, use_count() for any remaining copies is decremented by 1. Note that in C++ delete on a pointer with a value of 0 is harmless.
Never throws an exception.
Definition at line 109 of file fei_SharedPtr.hpp.
|
inline |
Constructs a SharedPtr, as if by storing a copy of the pointer stored in x. Afterwards, use_count() for all copies is 1 more than the initial x.use_count().
Never throws an exception.
x | a shared pointer to another type |
Definition at line 122 of file fei_SharedPtr.hpp.
|
inline |
Constructs a SharedPtr, as if by storing a copy of the pointer stored in x. Afterwards, use_count() for all copies is 1 more than the initial x.use_count().
Never throws an exception.
x | the shared pointer to copy |
Definition at line 160 of file fei_SharedPtr.hpp.
|
inline |
Assignment to a shared pointer of another type.
First, if use_count() == 1, deletes the object pointed to by the stored pointer. Otherwise, use_count() for any remaining copies is decremented by 1. Note that in C++ delete on a pointer with a value of 0 is harmless.
Then replaces the contents of this, as if by storing a copy of the pointer stored in x. Afterwards, use_count() for all copies is 1 more than the initial x.use_count().
Never throws an exception.
x | a shared pointer to another type |
Definition at line 145 of file fei_SharedPtr.hpp.
|
inline |
Assignment to another shared pointer. First, if use_count() == 1, deletes the object pointed to by the stored pointer. Otherwise, use_count() for any remaining copies is decremented by 1. Note that in C++ delete on a pointer with a value of 0 is harmless.
Then replaces the contents of this, as if by storing a copy of the pointer stored in x. Afterwards, use_count() for all copies is 1 more than the initial x.use_count().
Does not throw any exception.
x | the shared pointer to copy |
Definition at line 181 of file fei_SharedPtr.hpp.
|
inline |
Reset the pointer value of this shared pointer. First, if use_count() == 1, deletes the object pointed to by the stored pointer. Otherwise, use_count() for any remaining copies is decremented by 1. Then replaces the contents of this, as if by storing a copy of p, which must have been allocated via a C++ new expression or be 0. Afterwards, use_count() is 1 (even if p==0; see ~SharedPtr).
Note that in C++ delete on a pointer with a value of 0 is harmless.
The only exception which may be thrown is std::bad_alloc. If an exception is thrown, delete p is called.
p | a pointer value, or 0 if not present |
Definition at line 203 of file fei_SharedPtr.hpp.
Referenced by beam_oldfei_main(), snl_fei::Factory::clone(), fei::create_LibraryWrapper(), test_VectorSpace::create_VectorSpace(), FEI_tester::createFEIinstance(), fei::MatrixGraph_Impl2::createGraph(), snl_fei::Broker_FEData::createMatrix(), snl_fei::Broker_LinSysCore::createMatrix(), snl_fei::Broker_FEData::createVector(), snl_fei::Broker_LinSysCore::createVector(), Factory_Aztec::createVector(), snl_fei::LinearSystem_General::enforceEssentialBC_LinSysCore(), extractDirichletBCs(), feiDriver_main(), fei::FEI_Impl::initComplete(), main(), poisson_main(), and test_FEI::test1().
|
inline |
Returns a reference to the object pointed to by the stored pointer.
Never throws an exception.
Definition at line 228 of file fei_SharedPtr.hpp.
|
inline |
Return the stored pointer.
Never throws an exception.
Definition at line 235 of file fei_SharedPtr.hpp.
|
inline |
Return the stored pointer. T is not required to be a complete type.
Never throws an exception.
Definition at line 242 of file fei_SharedPtr.hpp.
Referenced by fei::FEI_Impl::aggregateSystem_LinSysCore(), FEI_Implementation::allocateInternalFEIs(), beam_main(), beam_oldfei_main(), fei::create_fei_Factory(), fei::create_LibraryWrapper(), test_MatrixGraph::create_MatrixGraph(), test_VectorSpace::create_VectorSpace(), FEI_tester::createFEIinstance(), fei::MatrixGraph_Impl2::createGraph(), snl_fei::Broker_FEData::createLinearSystem(), snl_fei::Broker_LinSysCore::createLinearSystem(), snl_fei::Broker_FEData::createMatrix(), snl_fei::Broker_LinSysCore::createMatrix(), Factory_Aztec::createMatrix(), snl_fei::Broker_FEData::createVector(), snl_fei::Broker_LinSysCore::createVector(), Factory_Aztec::createVector(), snl_fei::LinearSystem_General::enforceEssentialBC_LinSysCore(), snl_fei::LinearSystem_General::enforceEssentialBC_step_1(), snl_fei::LinearSystem_General::enforceEssentialBC_step_2(), extractDirichletBCs(), snl_fei::Factory::Factory(), test_Factory::factory_test1(), fei_Solver_solve(), feiDriver_main(), fei::DirichletBCManager::finalizeBCEqns(), fei::utils::get_LinearSystemCore(), fei::DirichletBCManager::getEqnNumber(), fei::FEI_Impl::initComplete(), main(), fei::Matrix_core::Matrix_core(), fei::Matrix_Impl< T >::Matrix_Impl(), fei::MatrixGraph_Impl2::MatrixGraph_Impl2(), fei::MatrixReducer::MatrixReducer(), fei::operator!=(), fei::operator==(), snl_fei::LinearSystem_General::parameters(), poisson3_main(), poisson_main(), fei::FEI_Impl::putNodalFieldData(), fei::Reducer::Reducer(), fei::FEI_Impl::residualNorm(), snl_fei::Broker_LinSysCore::setGlobalOffsets(), fei::FEI_Impl::setIDLists(), snl_fei::Broker_LinSysCore::setMatrixStructure(), snl_fei::Broker_FEData::setStructure(), fei::Matrix_Impl< T >::sumIn(), test_FEI::test1(), test_LinearSystem::test2(), test_LinearSystem::test3(), test_VectorSpace::test3(), test_MatrixGraph::test3(), test_Matrix::test3(), test_LinearSystem::test4(), snl_fei_tester::testCheckResult(), snl_fei_tester::testInitialization(), FEI_tester::testInitialization(), snl_fei_tester::testSolve(), fei::VectorReducer::VectorReducer(), fei::Matrix_Impl< T >::writeToFile(), fei::Matrix_Impl< T >::writeToStream(), and fei::FEI_Impl::~FEI_Impl().
|
inline |
Returns the number of SharedPtr's sharing ownership of the stored pointer. T is not required to be a complete type.
Never throws an exception.
Definition at line 250 of file fei_SharedPtr.hpp.
|
inline |
Returns use_count() == 1. T is not required to be a complete type.
Never throws an exception.
Definition at line 258 of file fei_SharedPtr.hpp.
|
inline |
power users only
Definition at line 261 of file fei_SharedPtr.hpp.
Referenced by fei::SharedPtr< fei::LinearProblemManager >::operator=().
|
inline |
power users only
Definition at line 271 of file fei_SharedPtr.hpp.
Referenced by fei::SharedPtr< fei::LinearProblemManager >::share(), and fei::SharedPtr< fei::LinearProblemManager >::~SharedPtr().
Definition at line 288 of file fei_SharedPtr.hpp.
|
private |
Definition at line 284 of file fei_SharedPtr.hpp.
Referenced by fei::SharedPtr< fei::LinearProblemManager >::dispose(), fei::SharedPtr< fei::LinearProblemManager >::get(), fei::SharedPtr< fei::LinearProblemManager >::operator*(), fei::SharedPtr< fei::LinearProblemManager >::operator->(), fei::SharedPtr< fei::LinearProblemManager >::operator=(), fei::SharedPtr< fei::LinearProblemManager >::reset(), and fei::SharedPtr< fei::LinearProblemManager >::share().
|
private |
Definition at line 285 of file fei_SharedPtr.hpp.
Referenced by fei::SharedPtr< fei::LinearProblemManager >::dispose(), fei::SharedPtr< fei::LinearProblemManager >::operator=(), fei::SharedPtr< fei::LinearProblemManager >::reset(), fei::SharedPtr< fei::LinearProblemManager >::share(), fei::SharedPtr< fei::LinearProblemManager >::SharedPtr(), fei::SharedPtr< fei::LinearProblemManager >::unique(), and fei::SharedPtr< fei::LinearProblemManager >::use_count().