ug4
|
#include <smart_pointer.h>
Public Member Functions | |
ConstSmartPtr< T, FreePolicy > | cast_const () const |
performs a const cast More... | |
template<class TDest > | |
SmartPtr< TDest, FreePolicy > | cast_dynamic () const |
preforms a dynamic cast More... | |
template<class TDest > | |
SmartPtr< TDest, FreePolicy > | cast_reinterpret () const |
performs a reinterpret cast More... | |
template<class TDest > | |
SmartPtr< TDest, FreePolicy > | cast_static () const |
performs a static cast More... | |
T * | get () |
returns encapsulated pointer More... | |
const T * | get () const |
returns encapsulated pointer More... | |
bool | invalid () const |
returns true if the pointer is invalid, false if not. More... | |
template<class TDest > | |
bool | is_of_type () const |
operator bool () const noexcept | |
template<class TPtr > | |
bool | operator!= (const ConstSmartPtr< TPtr, FreePolicy > &sp) const |
bool | operator!= (const SmartPtr &sp) const |
bool | operator!= (NullSmartPtr) const |
T & | operator* () |
const T & | operator* () const |
T * | operator-> () |
const T * | operator-> () const |
SmartPtr & | operator= (const SmartPtr &sp) |
template<class TIn > | |
SmartPtr< T, FreePolicy > & | operator= (const SmartPtr< TIn, FreePolicy > &sp) |
SmartPtr & | operator= (NullSmartPtr) |
template<class TPtr > | |
bool | operator== (const ConstSmartPtr< TPtr, FreePolicy > &sp) const |
bool | operator== (const SmartPtr &sp) const |
bool | operator== (NullSmartPtr) const |
int | refcount () const |
returns refcount More... | |
SmartPtr () | |
SmartPtr (const SmartPtr &sp) | |
template<class TPtr > | |
SmartPtr (const SmartPtr< TPtr, FreePolicy > &sp) | |
SmartPtr (NullSmartPtr) | |
SmartPtr (T *ptr) | |
SmartPtr (T *ptr, int *refCount) | |
WARNING: this method is DANGEROUS! More... | |
bool | valid () const |
returns true if the pointer is valid, false if not. More... | |
~SmartPtr () | |
int * | refcount_ptr () const |
WARNING: this method is DANGEROUS! More... | |
T * | get_nonconst () const |
WARNING: this method is DANGEROUS! More... | |
Private Member Functions | |
void | release () |
decrements the refCount and frees the encapsulated pointer if required. More... | |
Static Private Member Functions | |
static void | free_void_ptr (const void *ptr) |
this release method is required by SmartPtr<void> More... | |
Private Attributes | |
T * | m_ptr |
int * | m_refCount |
Friends | |
class | ConstSmartPtr< T, FreePolicy > |
class | ConstSmartPtr< void > |
class | SmartPtr< void > |
A Smart Pointer encapsulates a pointer. With each copy of the SmartPointer a shared reference count is increased and with each destructor call to a SmartPointer this shared reference count is decreased. If the shared reference count reaches 0 free as specified in the FreePolicy is executed on the pointer.
The FreePolicy has to feature the method free().
If a const smart pointer is required, use ConstSmartPtr
|
inlineexplicit |
|
inlineexplicit |
References SmartPtr< T, FreePolicy >::m_refCount.
|
inline |
|
inline |
References SmartPtr< T, FreePolicy >::m_refCount.
|
inline |
this template method allows to assign smart-pointers that encapsulate derivates of T. Make sure that the pointer-type of TSmartPtr is castable to T*.
References SmartPtr< T, FreePolicy >::m_refCount.
|
inline |
References SmartPtr< T, FreePolicy >::release().
|
inlineexplicit |
WARNING: this method is DANGEROUS!
You should only use this constructor if you really know what you're doing! The following methods are required for SmartPtr<void> and casts
References SmartPtr< T, FreePolicy >::m_refCount.
|
inline |
performs a const cast
Referenced by ug::MinimalResiduumDamping< X, Y >::damping(), and ug::MinimalEnergyDamping< X, Y >::damping().
|
inline |
preforms a dynamic cast
References SmartPtr< T, FreePolicy >::m_ptr, SmartPtr< T, FreePolicy >::m_refCount, and p.
|
inline |
performs a reinterpret cast
References SmartPtr< T, FreePolicy >::m_ptr, SmartPtr< T, FreePolicy >::m_refCount, and p.
|
inline |
performs a static cast
References SmartPtr< T, FreePolicy >::m_ptr, SmartPtr< T, FreePolicy >::m_refCount, and p.
|
inlinestaticprivate |
this release method is required by SmartPtr<void>
const void is not really correct here, of course...
|
inline |
returns encapsulated pointer
References SmartPtr< T, FreePolicy >::m_ptr.
Referenced by ug::MultipleErrEstData< TDomain, TErrEstData >::add(), ug::node_tree::Traverser::apply(), ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >::assemble_defect(), ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >::assemble_jacobian(), ug::StdTransfer< TDomain, TAlgebra >::assemble_prolongation(), ug::StdTransfer< TDomain, TAlgebra >::assemble_restriction(), ug::BalanceWeightsLuaCallback< TDomain >::BalanceWeightsLuaCallback(), ug::AssembledMultiGridCycle< TDomain, TAlgebra >::base_solve(), ug::IDomain< TGrid, TSubsetHandler >::broadcast_refinement_projector(), ug::CollectIErrEstData(), ug::node_tree::CreateOctree(), ug::node_tree::CreateSubOctrees(), ug::DistributeDomain(), ug::DomainLoadBalancer< TDomain >::DomainLoadBalancer(), ug::LoadBalancer::estimate_distribution_quality_impl(), ug::OutNormCmp< TDomain >::evaluate(), ug::bridge::Evaluate::EvaluateAtClosestVertex(), ug::bridge::Evaluate::EvaluateAtClosestVertexAllProcs(), ug::bridge::Evaluate::EvaluateAtVertex(), ug::bridge::Evaluate::VectorValuedUserDataEvaluator< TDomain, TAlgebra >::evaluateOnThisProcessNeighbouring(), ug::node_tree::Traverser::handle_group(), ug::node_tree::Traverser_ProjectPoint::handle_group(), ug::IntegralNormalComponentOnManifoldSubset(), ug::vrl::jobjectArray2ParamStack(), ug::MarkForAdaption_VerticesInCube(), ug::MarkForAdaption_VerticesInSphereMaxLvl(), ug::MarkForRefinement_ElementsInSphere(), ug::UserDataInfo::obj_name(), std::less< SmartPtr< T, TFreePolicy > >::operator()(), ConstSmartPtr< T, FreePolicy >::operator=(), SmartPtr< T, FreePolicy >::operator==(), ConstSmartPtr< T, FreePolicy >::operator==(), ug::LuaUserDataFactory< TData, dim, TRet >::provide_or_create(), ug::UserDataInfo::set_obj_name(), ug::ProjectionHandler::set_subset_handler(), ug::ComponentGaussSeidel< TDomain, TAlgebra >::step(), ug::UzawaBase< TDomain, TAlgebra >::step(), and ug::MessageHub::unregister_callback().
|
inline |
returns encapsulated pointer
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
WARNING: this method is DANGEROUS!
This method should never be used since it may be removed in future versions of the SmartPtr class. It is featured in order to allow to implement a template-constructor that casts element-pointers of a smart pointer.
References SmartPtr< T, FreePolicy >::m_ptr.
Referenced by SmartPtr< T, FreePolicy >::operator=().
|
inline |
returns true if the pointer is invalid, false if not.
References SmartPtr< T, FreePolicy >::m_ptr.
Referenced by ug::bridge::ParameterStack::_to_native_vector(), ug::bridge::ParameterStack::_to_pointer_vector(), ug::bridge::ParameterStack::_to_void_pointer_vector(), ug::AdjustMeanValue(), ug::AgglomeratingBase< TBase, TAlgebra >::base_init(), ug::AnalyzingSolver< M, X, Y >::check(), ug::IMultigridElementIndicators< TDomain >::detach_indicators(), ug::LoadBalancer::estimate_distribution_quality_impl(), ug::DebugIterator< TAlgebra >::find_smooth_error(), ug::IPreconditioner< TAlgebra >::init(), ug::DebugIterator< TAlgebra >::init(), ug::ILU< TAlgebra >::init(), ug::ILUTPreconditioner< TAlgebra >::init(), ug::IMatrixOperatorInverse< M, X, Y >::init(), ug::IRefiner::refine(), ug::RefinementProjector::refinement_begins(), ug::RasterLayersProjector::serialize(), ug::IDomain< TGrid, TSubsetHandler >::serialize_projector(), ug::MGStats< TDomain, TAlgebra >::set_defect(), and ug::StdTransfer< TDomain, TAlgebra >::write_debug().
|
inline |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inlineexplicitnoexcept |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
References SmartPtr< T, FreePolicy >::operator==().
|
inline |
References SmartPtr< T, FreePolicy >::operator==().
|
inline |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
|
inline |
References SmartPtr< T, FreePolicy >::get(), and ConstSmartPtr< T, FreePolicy >::get().
|
inline |
References SmartPtr< T, FreePolicy >::get().
Referenced by SmartPtr< T, FreePolicy >::operator!=().
|
inline |
References SmartPtr< T, FreePolicy >::m_ptr.
|
inline |
returns refcount
References SmartPtr< T, FreePolicy >::m_refCount.
Referenced by ug::vrl::SmartTestFunction().
|
inline |
WARNING: this method is DANGEROUS!
This method should never be used since it may be removed in future versions of the SmartPtr class. It is featured in order to allow to implement a template-constructor that casts element-pointers of a smart pointer.
References SmartPtr< T, FreePolicy >::m_refCount.
Referenced by ug::SomaProjector::attach_surf_params(), SmartPtr< T, FreePolicy >::operator=(), ConstSmartPtr< T, FreePolicy >::operator=(), and ug::LuaUserDataFactory< TData, dim, TRet >::provide_or_create().
|
inlineprivate |
decrements the refCount and frees the encapsulated pointer if required.
References SmartPtr< T, FreePolicy >::m_ptr, and SmartPtr< T, FreePolicy >::m_refCount.
Referenced by SmartPtr< void >::invalidate(), SmartPtr< void >::operator=(), SmartPtr< T, FreePolicy >::operator=(), SmartPtr< T, FreePolicy >::~SmartPtr(), and SmartPtr< void >::~SmartPtr().
|
inline |
returns true if the pointer is valid, false if not.
References SmartPtr< T, FreePolicy >::m_ptr.
Referenced by ug::IRefiner::adaption_begins(), ug::IRefiner::adaption_ends(), ug::GridWriterUGX::add_projection_handler(), ug::IDomain< TGrid, TSubsetHandler >::additional_subset_handler(), ug::AdjustEdgeLength(), ug::PProcessChain< TVector >::apply(), ug::ApproximationSpace< TDomain >::ApproximationSpace(), ug::IDomain< TGrid, TSubsetHandler >::broadcast_refinement_projector(), ug::IRefiner::coarsen(), ug::AdaptiveRegularRefiner_MultiGrid::create_closure_elements_2d(), ug::AdaptiveRegularRefiner_MultiGrid::create_closure_elements_3d(), ug::bridge::CreateSmoothHierarchy(), ug::LUAParserClass::createVM(), ug::DistributeDomain(), ug::DomainLoadBalancer< TDomain >::DomainLoadBalancer(), ug::EnergyConvCheck< TVector >::energy_norm(), ug::NestedIterationSolver< TDomain, TAlgebra >::estimate_and_mark_domain(), ug::AssembledMultiGridCycle< TDomain, TAlgebra >::init(), ug::UzawaBase< TDomain, TAlgebra >::init(), ug::SchurInverseWithAGammaGamma< TAlgebra >::init(), SmartPtr< void >::invalidate(), pcl::ProcessCommunicator::is_local(), ug::CompositeSpace< TGridFunction >::is_time_dependent(), ug::NeuriteProjector::load(), ug::GlobalFracturedMediaRefiner::perform_refinement(), ug::GlobalMultiGridRefiner::perform_refinement(), ug::HangingNodeRefiner_MultiGrid::pre_refine(), ug::LoadBalancer::problems_occurred(), ug::GridReaderUGX::projection_handler(), ug::LoadBalancer::rebalance(), ug::ProjectionHandler::refinement_begins(), ug::AutoLinearSolver< TVector >::reinit(), ug::SelectElementsForTargetPartition(), ug::SerializeProjectionHandler(), ug::CopyAttachmentHandler< TElem, TAttachment >::set_attachment(), ug::CopyAttachmentHandler< TElem, TAttachment >::set_grid(), ug::SchurComplementOperator< TAlgebra >::set_inner_debug(), ug::UserDataInfo::set_obj_name(), ug::ProjectionHandler::set_projector(), ug::IDomain< TGrid, TSubsetHandler >::set_refinement_projector(), ug::SchurComplementOperator< TAlgebra >::set_skeleton_debug(), ug::IBlockJacobiPreconditioner< TAlgebra >::step(), ug::CompositeSpace< TGridFunction >::update_time_data(), and ug::CopyAttachmentHandler< TElem, TAttachment >::~CopyAttachmentHandler().
|
friend |
|
friend |
|
friend |
|
private |
Referenced by SmartPtr< T, FreePolicy >::cast_dynamic(), SmartPtr< T, FreePolicy >::cast_reinterpret(), SmartPtr< void >::cast_reinterpret(), SmartPtr< T, FreePolicy >::cast_static(), SmartPtr< T, FreePolicy >::get(), SmartPtr< void >::get(), SmartPtr< T, FreePolicy >::get_nonconst(), SmartPtr< T, FreePolicy >::invalid(), SmartPtr< void >::invalid(), SmartPtr< void >::invalidate(), SmartPtr< T, FreePolicy >::is_of_type(), SmartPtr< T, FreePolicy >::operator bool(), SmartPtr< void >::operator bool(), SmartPtr< T, FreePolicy >::operator!=(), SmartPtr< T, FreePolicy >::operator*(), SmartPtr< T, FreePolicy >::operator->(), ConstSmartPtr< T, FreePolicy >::operator=(), ConstSmartPtr< void >::operator=(), SmartPtr< void >::operator=(), SmartPtr< T, FreePolicy >::operator=(), SmartPtr< T, FreePolicy >::operator==(), SmartPtr< T, FreePolicy >::release(), SmartPtr< void >::release(), SmartPtr< void >::set_impl(), SmartPtr< T, FreePolicy >::valid(), and SmartPtr< void >::valid().
|
private |
Referenced by SmartPtr< T, FreePolicy >::cast_dynamic(), SmartPtr< T, FreePolicy >::cast_reinterpret(), SmartPtr< T, FreePolicy >::cast_static(), SmartPtr< void >::operator=(), ConstSmartPtr< T, FreePolicy >::operator=(), ConstSmartPtr< void >::operator=(), SmartPtr< T, FreePolicy >::operator=(), SmartPtr< T, FreePolicy >::refcount(), SmartPtr< T, FreePolicy >::refcount_ptr(), SmartPtr< T, FreePolicy >::release(), and SmartPtr< T, FreePolicy >::SmartPtr().