4 #ifndef FIRE_SHARED_SHARED_HPP_INCLUDED
5 #define FIRE_SHARED_SHARED_HPP_INCLUDED
7 #include <boost/shared_ptr.hpp>
22 explicit Shared(T* ptr): _ptr(ptr) {
34 inline bool operator!()
const {
35 return (NULL == _ptr);
38 inline bool operator==(
Shared const & r)
const {
39 return (_ptr.get() == r._ptr.get());
42 inline bool operator==(
int const &)
const {
43 return this->operator !();
46 inline bool operator!=(
Shared const & r)
const {
47 return !(this->operator==(r));
50 inline bool operator!=(
int const & r)
const {
51 return !(this->operator==(r));
54 inline T& operator*() {
55 return this->
operator T &();
58 inline const T& operator*()
const {
59 return this->
operator const T &();
63 inline operator T &() {
67 inline operator const T &()
const {
72 boost::shared_ptr< T > _ptr;
74 virtual inline T* _getPtr() {
77 throw std::runtime_error(
"Invalid pointer");
82 virtual inline const T* _getPtr()
const {
83 const T* ret = _ptr.get();
85 throw std::runtime_error(
"Invalid pointer");
92 inline bool operator==(
int const & nullPtr,
Shared< T > const & r) {
93 return r.operator==(nullPtr);
97 inline bool operator!=(
int const & nullPtr, Shared< T >
const & r) {
98 return r.operator!=(nullPtr);
Definition: Shared.hpp:17