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