37 #ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_CONSISTENT_ACCESS_OBJECT_HPP
38 #define NEKTAR_LIB_UTILITIES_BASIC_UTILS_CONSISTENT_ACCESS_OBJECT_HPP
40 #include <boost/shared_ptr.hpp>
41 #include <boost/call_traits.hpp>
42 #include <boost/type_traits.hpp>
47 template<
typename DataType>
50 static DataType&
reference(DataType& o) {
return o; }
52 static DataType*
pointer(DataType& o) {
return &o; }
58 template<
typename DataType>
65 static DataType&
reference(DataType* o) {
ASSERTL1(o != 0,
"Can't dereference null pointer.");
return *o; }
66 static DataType*
pointer(DataType* o) {
return o; }
70 template<
typename DataType>
73 static const DataType&
const_reference(
const boost::shared_ptr<DataType>& o) {
ASSERTL1(o,
"Can't dereference null pointer.");
return *o; }
74 static const DataType*
const_pointer(
const boost::shared_ptr<DataType>& o) {
return o.get(); }
75 static DataType&
reference(
const boost::shared_ptr<DataType>& o) {
ASSERTL1(o,
"Can't dereference null pointer.");
return *o; }
76 static DataType*
pointer(
const boost::shared_ptr<DataType>& o) {
return o.get(); }
81 #endif //NEKTAR_LIB_UTILITIES_BASIC_UTILS_CONSISTENT_ACCESS_OBJECT_HPP
static bool ReferencesObject(const boost::shared_ptr< DataType > &o)
static DataType * pointer(DataType &o)
static const DataType & const_reference(const DataType &o)
static DataType * pointer(DataType *o)
static bool ReferencesObject(const DataType &o)
static const DataType & const_reference(DataType *o)
static DataType & reference(DataType *o)
static const DataType * const_pointer(const boost::shared_ptr< DataType > &o)
static DataType & reference(DataType &o)
static bool ReferencesObject(DataType *o)
static const DataType * const_pointer(const DataType &o)
static const DataType * const_pointer(DataType *o)
static DataType & reference(const boost::shared_ptr< DataType > &o)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
static DataType * pointer(const boost::shared_ptr< DataType > &o)
static const DataType & const_reference(const boost::shared_ptr< DataType > &o)