Teuchos::ConstNonconstObjectContainer< ObjType > Class Template Reference

Simple class for containing an object and protecting const with a runtime check which throws an std::exception. More...

#include <Teuchos_ConstNonconstObjectContainer.hpp>

List of all members.

Public Member Functions

 ConstNonconstObjectContainer ()
 . Constructs to uninitialized
 ConstNonconstObjectContainer (const RCP< ObjType > &obj)
 . Calls initialize() with a non-const object.
 ConstNonconstObjectContainer (const RCP< const ObjType > &obj)
 . Calls initialize() with a const object.
void initialize (const RCP< ObjType > &obj)
 . Initialize using a non-const object. Allows both const and non-const access to the contained object.
void initialize (const RCP< const ObjType > &obj)
 . Initialize using a const object. Allows only const access enforced with a runtime check.
void uninitialize ()
 . Uninitialize.
bool isConst () const
 Returns true if const-only access to the object is allowed.
RCP< ObjType > getNonconstObj ()
 Get an RCP to the non-const contained object.
RCP< const ObjType > getConstObj () const
 Get an RCP to the const contained object.
RCP< const ObjType > operator() () const
 Perform shorthand for getConstObj().


Detailed Description

template<class ObjType>
class Teuchos::ConstNonconstObjectContainer< ObjType >

Simple class for containing an object and protecting const with a runtime check which throws an std::exception.

This class is simple enough and developers are encouraged to look at the simple inline definition of this class.

The default copy constructor and assignment operator functions are allowed and result in shallow copied (i.e. just the RCP objects are copied). However, the protection of const will be maintained in the copied/assigned objects as well.

Definition at line 48 of file Teuchos_ConstNonconstObjectContainer.hpp.


Constructor & Destructor Documentation

template<class ObjType>
Teuchos::ConstNonconstObjectContainer< ObjType >::ConstNonconstObjectContainer (  )  [inline]

. Constructs to uninitialized

Definition at line 51 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
Teuchos::ConstNonconstObjectContainer< ObjType >::ConstNonconstObjectContainer ( const RCP< ObjType > &  obj  )  [inline]

. Calls initialize() with a non-const object.

Definition at line 54 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
Teuchos::ConstNonconstObjectContainer< ObjType >::ConstNonconstObjectContainer ( const RCP< const ObjType > &  obj  )  [inline]

. Calls initialize() with a const object.

Definition at line 57 of file Teuchos_ConstNonconstObjectContainer.hpp.


Member Function Documentation

template<class ObjType>
void Teuchos::ConstNonconstObjectContainer< ObjType >::initialize ( const RCP< ObjType > &  obj  )  [inline]

. Initialize using a non-const object. Allows both const and non-const access to the contained object.

Definition at line 61 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
void Teuchos::ConstNonconstObjectContainer< ObjType >::initialize ( const RCP< const ObjType > &  obj  )  [inline]

. Initialize using a const object. Allows only const access enforced with a runtime check.

Definition at line 65 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
void Teuchos::ConstNonconstObjectContainer< ObjType >::uninitialize (  )  [inline]

. Uninitialize.

Definition at line 68 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
bool Teuchos::ConstNonconstObjectContainer< ObjType >::isConst (  )  const [inline]

Returns true if const-only access to the object is allowed.

Definition at line 71 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
RCP<ObjType> Teuchos::ConstNonconstObjectContainer< ObjType >::getNonconstObj (  )  [inline]

Get an RCP to the non-const contained object.

Preconditions:

Postconditions:

Definition at line 86 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
RCP<const ObjType> Teuchos::ConstNonconstObjectContainer< ObjType >::getConstObj (  )  const [inline]

Get an RCP to the const contained object.

If return.get()==NULL, then this means that no object was given to *this data container object.

Definition at line 100 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class ObjType>
RCP<const ObjType> Teuchos::ConstNonconstObjectContainer< ObjType >::operator() (  )  const [inline]

Perform shorthand for getConstObj().

Definition at line 103 of file Teuchos_ConstNonconstObjectContainer.hpp.


The documentation for this class was generated from the following file:
Generated on Tue Oct 20 12:45:27 2009 for Teuchos - Trilinos Tools Package by doxygen 1.4.7