42#ifndef TEUCHOS_CONST_NONCONST_OBJECT_CONTAINER_HPP
43#define TEUCHOS_CONST_NONCONST_OBJECT_CONTAINER_HPP
274template<
class ObjType>
330 <<
"\" was given as a const-only object and non-const access is not allowed."
332 return rcp_const_cast<ObjType>(
constObj_);
Reference-counted pointer class and non-member templated function implementations.
Simple class supporting the "runtime protection of const" idiom.
const ObjType & operator*() const
Dereference the underlying object.
RCP< const ObjType > constObj_
ConstNonconstObjectContainer< ObjType > & operator=(ENull)
RCP< const ObjType > operator()() const
Perform shorthand for getConstObj().
RCP< ObjType > getNonconstObj() const
Get an RCP to the non-const contained object.
bool is_null(const ConstNonconstObjectContainer< T > &p)
Returns true if p.get()==NULL.
ConstNonconstObjectContainer(const RCP< ObjType > &obj)
. Calls initialize() with a non-const object.
RCP< const ObjType > getConstObj() const
Get an RCP to the const contained object.
ConstNonconstObjectContainer(const RCP< const ObjType > &obj)
. Calls initialize() with a const object.
void initialize(const RCP< const ObjType > &obj)
. Initialize using a const object. Allows only const access enforced with a runtime check.
bool isConst() const
Returns true if const-only access to the object is allowed.
void initialize(const RCP< ObjType > &obj)
. Initialize using a non-const object. Allows both const and non-const access to the contained object...
const ObjType * operator->() const
Pointer (->) access to underlying const object.
int count() const
Return the internal count.
bool nonnull(const ConstNonconstObjectContainer< T > &p)
Returns true if p.get()!=NULL.
ConstNonconstObjectContainer()
. Constructs to uninitialized
Null reference error exception class.
Null reference error exception class.
Smart reference counting pointer class for automatic garbage collection.
T * get() const
Get the raw C++ pointer to the underlying object.
Default traits class that just returns typeid(T).name().
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
bool nonnull(const std::shared_ptr< T > &p)
Returns true if p.get()!=NULL.