36 #ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_CONSISTENT_ACCESS_OBJECT_HPP
37 #define NEKTAR_LIB_UTILITIES_BASIC_UTILS_CONSISTENT_ACCESS_OBJECT_HPP
39 #include <boost/core/ignore_unused.hpp>
46 template<
typename DataType>
49 static DataType&
reference(DataType& o) {
return o; }
51 static DataType*
pointer(DataType& o) {
return &o; }
55 boost::ignore_unused(o);
60 template<
typename DataType>
67 static DataType&
reference(DataType* o) {
ASSERTL1(o != 0,
"Can't dereference null pointer.");
return *o; }
68 static DataType*
pointer(DataType* o) {
return o; }
72 template<
typename DataType>
75 static const DataType&
const_reference(
const std::shared_ptr<DataType>& o) {
ASSERTL1(o,
"Can't dereference null pointer.");
return *o; }
76 static const DataType*
const_pointer(
const std::shared_ptr<DataType>& o) {
return o.get(); }
77 static DataType&
reference(
const std::shared_ptr<DataType>& o) {
ASSERTL1(o,
"Can't dereference null pointer.");
return *o; }
78 static DataType*
pointer(
const std::shared_ptr<DataType>& o) {
return o.get(); }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
The above copyright notice and this permission notice shall be included.
static DataType * pointer(DataType *o)
static DataType & reference(DataType *o)
static const DataType * const_pointer(DataType *o)
static const DataType & const_reference(DataType *o)
static bool ReferencesObject(DataType *o)
static const DataType * const_pointer(const std::shared_ptr< DataType > &o)
static const DataType & const_reference(const std::shared_ptr< DataType > &o)
static DataType & reference(const std::shared_ptr< DataType > &o)
static bool ReferencesObject(const std::shared_ptr< DataType > &o)
static DataType * pointer(const std::shared_ptr< DataType > &o)
static const DataType & const_reference(const DataType &o)
static bool ReferencesObject(const DataType &o)
static DataType * pointer(DataType &o)
static DataType & reference(DataType &o)
static const DataType * const_pointer(const DataType &o)