1 #ifndef INCLUDE_ORA_NAMEDREF_H
2 #define INCLUDE_ORA_NAMEDREF_H
7 #include <boost/shared_ptr.hpp>
19 void set(
const std::string& name );
20 const std::string&
name()
const;
22 boost::shared_ptr<void>&
ptr()
const;
27 mutable boost::shared_ptr<void>
m_ptr;
34 NamedRef(
const std::string& name, boost::shared_ptr<T>&
data );
35 template <
typename C>
NamedRef(
const std::string& name, boost::shared_ptr<C>& data );
43 operator bool ()
const;
45 boost::shared_ptr<T>
share()
const;
54 T*
safePtr(
bool throw_flag )
const;
108 T*
p = share().get();
109 if( !p && throw_flag)
throwException(
"Underlying pointer is null.",
"NamedRef::safePtr");
115 return safePtr(
true );
120 return *safePtr(
true );
125 return safePtr(
false);
130 return safePtr(
false);
135 return boost::static_pointer_cast<T>(ptr());
140 return safePtr(
false)==0;
145 return share() == rhs.
share();
156 return share() == rhs.
share();
boost::shared_ptr< void > & ptr() const
NamedReference & operator=(const NamedReference &rhs)
const std::string & name() const
bool operator==(const CaloTower &t1, const CaloTower &t2)
virtual ~NamedReference()
bool operator==(const NamedRef< T > &rhs) const
bool isPersistent() const
T * safePtr(bool throw_flag) const
bool operator!=(const NamedRef< T > &rhs) const
NamedRef< T > & operator=(const NamedRef< T > &rhs)
boost::shared_ptr< T > share() const
void set(const std::string &name)
void throwException(const std::string &message, const std::string &methodName)
boost::shared_ptr< void > m_ptr