Teuchos - Trilinos Tools Package Version of the Day
Public Member Functions | Related Functions
Teuchos::RCPNodeHandle Class Reference

Handle class that manages the RCPNode's reference counting. More...

#include <Teuchos_RCPNode.hpp>

List of all members.

Public Member Functions

 RCPNodeHandle (ENull null_arg=null)
 Default constructor.
 RCPNodeHandle (RCPNode *node, ERCPStrength strength_in=RCP_STRONG, bool newNode=true)
 Constructor that takes a pointer to an RCPNode.
 RCPNodeHandle (const RCPNodeHandle &node_ref)
 Copy constructor.
void swap (RCPNodeHandle &node_ref)
 Swap the contents of node_ref with *this.
RCPNodeHandleoperator= (const RCPNodeHandle &node_ref)
 Assignment operator.
 ~RCPNodeHandle ()
 Destructor.
RCPNodeHandle create_weak () const
 Return a weak handle.
RCPNodeHandle create_strong () const
 Return a strong handle.
RCPNodenode_ptr () const
 Return a pointer to the underlying RCPNode.
bool is_node_null () const
 Whether the underlying RCPNode is NULL.
bool is_valid_ptr () const
 Whether the underlying pointer is valid.
bool same_node (const RCPNodeHandle &node2) const
 Whether the RCPNode for which node2 is a handle is the same RCPNode as this object's RCPNode.
int strong_count () const
 The strong count for this RCPNode, or 0 if the node is NULL.
int weak_count () const
 The weak count for this RCPNode, or 0 if the node is NULL.
int total_count () const
 The sum of the weak and string counts.
int count () const
 The strong count; retained for backwards compatibility.
ERCPStrength strength () const
 The strength of this handle.
void has_ownership (bool has_ownership_in)
 
bool has_ownership () const
 
void set_extra_data (const any &extra_data, const std::string &name, EPrePostDestruction destroy_when, bool force_unique)
 
anyget_extra_data (const std::string &type_name, const std::string &name)
 
const anyget_extra_data (const std::string &type_name, const std::string &name) const
 
anyget_optional_extra_data (const std::string &type_name, const std::string &name)
 
const anyget_optional_extra_data (const std::string &type_name, const std::string &name) const
 
void debug_assert_not_null () const
 
template<class RCPType >
void assert_valid_ptr (const RCPType &rcp_obj) const
 
template<class RCPType >
void debug_assert_valid_ptr (const RCPType &rcp_obj) const
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &out, const RCPNodeHandle &node)
 Ouput stream operator for RCPNodeHandle.

Detailed Description

Handle class that manages the RCPNode's reference counting.

Warning:
This class is not intended for Teuchos users. It is an implementation detail of Teuchos' reference-counting "smart" pointer (RCP) and array (ArrayRCP) classes.

NOTE: I (Ross Bartlett) am not generally a big fan of handle classes and greatly prefer smart pointers. However, this is one case where a handle class makes sense. First, I want special behavior in some functions when the wrapped RCPNode pointer is null. Second, I can't use one of the smart-pointer classes because this class is used to implement all of those smart-pointer classes!

Definition at line 692 of file Teuchos_RCPNode.hpp.


Constructor & Destructor Documentation

Teuchos::RCPNodeHandle::RCPNodeHandle ( ENull  null_arg = null) [inline]

Default constructor.

Definition at line 695 of file Teuchos_RCPNode.hpp.

Teuchos::RCPNodeHandle::RCPNodeHandle ( RCPNode node,
ERCPStrength  strength_in = RCP_STRONG,
bool  newNode = true 
) [inline]

Constructor that takes a pointer to an RCPNode.

Definition at line 702 of file Teuchos_RCPNode.hpp.

Teuchos::RCPNodeHandle::RCPNodeHandle ( const RCPNodeHandle node_ref) [inline]

Copy constructor.

Definition at line 751 of file Teuchos_RCPNode.hpp.

Teuchos::RCPNodeHandle::~RCPNodeHandle ( ) [inline]

Destructor.

Definition at line 783 of file Teuchos_RCPNode.hpp.


Member Function Documentation

void Teuchos::RCPNodeHandle::swap ( RCPNodeHandle node_ref) [inline]

Swap the contents of node_ref with *this.

Definition at line 758 of file Teuchos_RCPNode.hpp.

RCPNodeHandle& Teuchos::RCPNodeHandle::operator= ( const RCPNodeHandle node_ref) [inline]

Assignment operator.

This method satisfies the strong exception guarantee: It either returns successfully, or throws an exception without modifying any user-visible state.

Definition at line 768 of file Teuchos_RCPNode.hpp.

RCPNodeHandle Teuchos::RCPNodeHandle::create_weak ( ) const [inline]

Return a weak handle.

Definition at line 788 of file Teuchos_RCPNode.hpp.

RCPNodeHandle Teuchos::RCPNodeHandle::create_strong ( ) const [inline]

Return a strong handle.

Definition at line 795 of file Teuchos_RCPNode.hpp.

RCPNode* Teuchos::RCPNodeHandle::node_ptr ( ) const [inline]

Return a pointer to the underlying RCPNode.

Definition at line 802 of file Teuchos_RCPNode.hpp.

bool Teuchos::RCPNodeHandle::is_node_null ( ) const [inline]

Whether the underlying RCPNode is NULL.

Definition at line 806 of file Teuchos_RCPNode.hpp.

bool Teuchos::RCPNodeHandle::is_valid_ptr ( ) const [inline]

Whether the underlying pointer is valid.

Note:
NULL is a valid pointer; this method returns true in that case.

Definition at line 812 of file Teuchos_RCPNode.hpp.

bool Teuchos::RCPNodeHandle::same_node ( const RCPNodeHandle node2) const [inline]

Whether the RCPNode for which node2 is a handle is the same RCPNode as this object's RCPNode.

Definition at line 820 of file Teuchos_RCPNode.hpp.

int Teuchos::RCPNodeHandle::strong_count ( ) const [inline]

The strong count for this RCPNode, or 0 if the node is NULL.

Definition at line 824 of file Teuchos_RCPNode.hpp.

int Teuchos::RCPNodeHandle::weak_count ( ) const [inline]

The weak count for this RCPNode, or 0 if the node is NULL.

Definition at line 831 of file Teuchos_RCPNode.hpp.

int Teuchos::RCPNodeHandle::total_count ( ) const [inline]

The sum of the weak and string counts.

Definition at line 838 of file Teuchos_RCPNode.hpp.

int Teuchos::RCPNodeHandle::count ( ) const [inline]

The strong count; retained for backwards compatibility.

Definition at line 845 of file Teuchos_RCPNode.hpp.

ERCPStrength Teuchos::RCPNodeHandle::strength ( ) const [inline]

The strength of this handle.

Definition at line 852 of file Teuchos_RCPNode.hpp.

void Teuchos::RCPNodeHandle::has_ownership ( bool  has_ownership_in) [inline]

Definition at line 856 of file Teuchos_RCPNode.hpp.

bool Teuchos::RCPNodeHandle::has_ownership ( ) const [inline]

Definition at line 862 of file Teuchos_RCPNode.hpp.

void Teuchos::RCPNodeHandle::set_extra_data ( const any extra_data,
const std::string &  name,
EPrePostDestruction  destroy_when,
bool  force_unique 
) [inline]

Definition at line 869 of file Teuchos_RCPNode.hpp.

any& Teuchos::RCPNodeHandle::get_extra_data ( const std::string &  type_name,
const std::string &  name 
) [inline]

Definition at line 878 of file Teuchos_RCPNode.hpp.

const any& Teuchos::RCPNodeHandle::get_extra_data ( const std::string &  type_name,
const std::string &  name 
) const [inline]

Definition at line 886 of file Teuchos_RCPNode.hpp.

any* Teuchos::RCPNodeHandle::get_optional_extra_data ( const std::string &  type_name,
const std::string &  name 
) [inline]

Definition at line 893 of file Teuchos_RCPNode.hpp.

const any* Teuchos::RCPNodeHandle::get_optional_extra_data ( const std::string &  type_name,
const std::string &  name 
) const [inline]

Definition at line 901 of file Teuchos_RCPNode.hpp.

void Teuchos::RCPNodeHandle::debug_assert_not_null ( ) const [inline]

Definition at line 908 of file Teuchos_RCPNode.hpp.

template<class RCPType >
void Teuchos::RCPNodeHandle::assert_valid_ptr ( const RCPType &  rcp_obj) const [inline]

Definition at line 917 of file Teuchos_RCPNode.hpp.

template<class RCPType >
void Teuchos::RCPNodeHandle::debug_assert_valid_ptr ( const RCPType &  rcp_obj) const [inline]

Definition at line 928 of file Teuchos_RCPNode.hpp.


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  out,
const RCPNodeHandle node 
) [related]

Ouput stream operator for RCPNodeHandle.

Definition at line 974 of file Teuchos_RCPNode.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines