BTK  0.3dev.0
Open-source library to visualize/process biomechanical data
List of all members | Public Member Functions
btk::NullPtr< T > Class Template Reference

To simplify the API when testing a shared pointer to know if it is null or not. More...

#include <btkNullPtr.h>

Public Member Functions

 NullPtr ()
 
 NullPtr (const NullPtr &)
 

Detailed Description

template<typename T>
class btk::NullPtr< T >

To simplify the API when testing a shared pointer to know if it is null or not.

The intent of this class is facilitate the validity test of a shared pointer to know if it is null or not. Each class inherithing of the class btk::DataObject will be able to test shared pointer nullity by using a simple condition as the following.

Example #1

* // Equality operator
* if (pX == btk::_classname_::Null)
* {
* std::cerr << "Invalid data" << std::endl;
* }
*

Example #2

* // Inequality operator
* if (pX != btk::_classname_::Null)
* {
* std::cout << "Valid data" << std::endl;
* }
*

The use of this class replaces the previous code which needed to know the API of the class used behind the macro btkSharedPtr.

Constructor & Destructor Documentation

template<typename T >
btk::NullPtr< T >::NullPtr ( )
inline

Empty constructor

template<typename T >
btk::NullPtr< T >::NullPtr ( const NullPtr< T > &  )
inline

Empty copy constructor