#include <Ref.h>
The reference template expects the instatiating _Type to implement methods for adding and deleting references that fit the following signature:
void add_ref(const char* what1, const char* what2); void del_ref(const char* what1, const char* what2);
For example, see the RefCountedObject class.
The strings what1 and what2 can be used for debugging and are stored in the reference. Note that what1 is mandatory and is typically the function name or object class that is holding the reference. What2 is any other additional information used to distinguish the instance.
Definition at line 67 of file Ref.h.
Public Member Functions | |
Ref (const char *what1="!!DEFAULT REF CONSTRUCTOR!!", const char *what2="") | |
Constructor that initializes the pointer to be empty. | |
Ref (_Type *object, const char *what1, const char *what2="") | |
Constructor that takes an initial pointer for assignment. | |
Ref (const TempRef< _Type > temp) | |
Constructor that takes a temporary ref. | |
Ref (const Ref &other) | |
Copy constructor. | |
~Ref () | |
Destructor. | |
void | release () |
Release the reference on the object. | |
_Type * | object () const |
Accessor for the object pointer. | |
const _Type * | const_object () const |
Accessor for a const object pointer. | |
_Type * | operator-> () const |
Operator overload for pointer access. | |
_Type & | operator * () const |
Operator overload for pointer access. | |
void | assign (_Type *new_obj) |
Assignment function. | |
Ref & | operator= (_Type *o) |
Assignment operator. | |
Ref & | operator= (const Ref< _Type > &other) |
Assignment operator. | |
Ref & | operator= (const TempRef< _Type > &temp) |
Assignment operator from a temporary ref. | |
bool | operator== (_Type *o) const |
Equality operator. | |
bool | operator== (const Ref< _Type > &other) const |
Equality operator. | |
bool | operator!= (_Type *o) const |
Inequality operator. | |
bool | operator!= (const Ref< _Type > &other) const |
Equality operator. | |
Private Member Functions | |
Ref (_Type *object) | |
Constructor (deliberately private and unimplemented) that takes a _Type* pointer but no debugging string. | |
Private Attributes | |
_Type * | object_ |
The object. | |
const char * | what1_ |
Debugging strings. | |
const char * | what2_ |
oasys::Ref< _Type >::Ref | ( | const char * | what1 = "!!DEFAULT REF CONSTRUCTOR!!" , |
|
const char * | what2 = "" | |||
) | [inline] |
oasys::Ref< _Type >::Ref | ( | _Type * | object, | |
const char * | what1, | |||
const char * | what2 = "" | |||
) | [inline] |
Constructor that takes an initial pointer for assignment.
Definition at line 83 of file Ref.h.
References oasys::Ref< _Type >::object_, oasys::Ref< _Type >::what1_, and oasys::Ref< _Type >::what2_.
oasys::Ref< _Type >::Ref | ( | _Type * | object | ) | [private] |
Constructor (deliberately private and unimplemented) that takes a _Type* pointer but no debugging string.
This is intended to cause the compiler to complain both that it's private, and to provide ambiguity (with the first constructor) when called with a single argument of NULL, hence forcing the caller to pass at least char* debug string.
oasys::Ref< _Type >::Ref | ( | const TempRef< _Type > | temp | ) | [inline] |
Constructor that takes a temporary ref.
Definition at line 107 of file Ref.h.
References oasys::TempRef< _Type >::object(), oasys::Ref< _Type >::object_, oasys::TempRef< _Type >::release(), oasys::Ref< _Type >::what1_, and oasys::Ref< _Type >::what2_.
oasys::Ref< _Type >::Ref | ( | const Ref< _Type > & | other | ) | [inline] |
Copy constructor.
Definition at line 121 of file Ref.h.
References oasys::Ref< _Type >::object(), oasys::Ref< _Type >::object_, oasys::Ref< _Type >::what1_, and oasys::Ref< _Type >::what2_.
oasys::Ref< _Type >::~Ref | ( | ) | [inline] |
void oasys::Ref< _Type >::release | ( | ) | [inline] |
Release the reference on the object.
Definition at line 142 of file Ref.h.
References oasys::Ref< _Type >::object_, oasys::Ref< _Type >::what1_, and oasys::Ref< _Type >::what2_.
Referenced by dtn::BundleDaemon::delete_from_pending(), and oasys::Ref< _Type >::~Ref().
_Type* oasys::Ref< _Type >::object | ( | ) | const [inline] |
Accessor for the object pointer.
Definition at line 153 of file Ref.h.
References oasys::Ref< _Type >::object_.
Referenced by dtn::UDPConvergenceLayer::close_contact(), dtn::ConvergenceLayer::close_contact(), dtn::ConnectionConvergenceLayer::close_contact(), dtn::BluetoothConvergenceLayer::close_contact(), dtn::TclRegistration::get_bundle_data(), dtn::BluetoothConvergenceLayer::Connection::handle_ack(), dtn::BundleDaemon::handle_bundle_delivered(), dtn::FloodBundleRouter::handle_bundle_expired(), dtn::BundleDaemon::handle_bundle_expired(), dtn::TcaRouter::handle_bundle_received(), dtn::TableBasedRouter::handle_bundle_received(), dtn::LinkStateRouter::handle_bundle_received(), dtn::FloodBundleRouter::handle_bundle_received(), dtn::BundleDaemon::handle_bundle_received(), dtn::TableBasedRouter::handle_bundle_transmit_failed(), dtn::BundleDaemon::handle_bundle_transmit_failed(), dtn::TcaRouter::handle_bundle_transmitted(), dtn::BundleDaemon::handle_bundle_transmitted(), dtn::BundleDaemon::handle_contact_down(), dtn::NeighborhoodRouter::handle_contact_up(), dtn::BundleDaemon::handle_contact_up(), dtn::TableBasedRouter::handle_custody_timeout(), dtn::BundleDaemon::handle_custody_timeout(), dtn::BundleDaemon::handle_link_state_change_request(), dtn::BundleDaemon::handle_reassembly_completed(), dtn::APIClient::handle_recv(), dtn::BundleList::move_contents(), dtn::Link::open(), dtn::TclRegistration::parse_bundle_data(), dtn::CLConnection::process_command(), dtn::FragmentManager::process_for_reassembly(), oasys::Ref< _Type >::Ref(), dtn::BluetoothConvergenceLayer::Connection::send_announce(), dtn::UDPConvergenceLayer::send_bundle(), dtn::NullConvergenceLayer::send_bundle(), dtn::ConnectionConvergenceLayer::send_bundle(), dtn::BluetoothConvergenceLayer::send_bundle(), dtn::ExpirationTimer::timeout(), and dtn::CustodyTimer::timeout().
const _Type* oasys::Ref< _Type >::const_object | ( | ) | const [inline] |
Accessor for a const object pointer.
Definition at line 161 of file Ref.h.
References oasys::Ref< _Type >::object_.
_Type* oasys::Ref< _Type >::operator-> | ( | ) | const [inline] |
Operator overload for pointer access.
Definition at line 169 of file Ref.h.
References ASSERT, and oasys::Ref< _Type >::object_.
_Type& oasys::Ref< _Type >::operator * | ( | ) | const [inline] |
Operator overload for pointer access.
Definition at line 178 of file Ref.h.
References ASSERT, and oasys::Ref< _Type >::object_.
void oasys::Ref< _Type >::assign | ( | _Type * | new_obj | ) | [inline] |
Assignment function.
Definition at line 187 of file Ref.h.
References oasys::Ref< _Type >::object_, oasys::Ref< _Type >::what1_, and oasys::Ref< _Type >::what2_.
Referenced by oasys::Ref< _Type >::operator=().
Ref& oasys::Ref< _Type >::operator= | ( | _Type * | o | ) | [inline] |
Assignment operator.
Definition at line 206 of file Ref.h.
References oasys::Ref< _Type >::assign().
Ref& oasys::Ref< _Type >::operator= | ( | const Ref< _Type > & | other | ) | [inline] |
Assignment operator.
Definition at line 215 of file Ref.h.
References oasys::Ref< _Type >::assign(), and oasys::Ref< _Type >::object_.
Ref& oasys::Ref< _Type >::operator= | ( | const TempRef< _Type > & | temp | ) | [inline] |
Assignment operator from a temporary ref.
Definition at line 224 of file Ref.h.
References oasys::Ref< _Type >::assign(), oasys::TempRef< _Type >::object(), oasys::Ref< _Type >::object_, and oasys::TempRef< _Type >::release().
bool oasys::Ref< _Type >::operator== | ( | _Type * | o | ) | const [inline] |
bool oasys::Ref< _Type >::operator== | ( | const Ref< _Type > & | other | ) | const [inline] |
bool oasys::Ref< _Type >::operator!= | ( | _Type * | o | ) | const [inline] |
bool oasys::Ref< _Type >::operator!= | ( | const Ref< _Type > & | other | ) | const [inline] |
_Type* oasys::Ref< _Type >::object_ [private] |
The object.
Definition at line 269 of file Ref.h.
Referenced by oasys::Ref< _Type >::assign(), oasys::Ref< _Type >::const_object(), oasys::Ref< _Type >::object(), oasys::Ref< _Type >::operator *(), oasys::Ref< _Type >::operator!=(), oasys::Ref< _Type >::operator->(), oasys::Ref< _Type >::operator=(), oasys::Ref< _Type >::operator==(), oasys::Ref< _Type >::Ref(), and oasys::Ref< _Type >::release().
const char* oasys::Ref< _Type >::what1_ [private] |
Debugging strings.
Definition at line 274 of file Ref.h.
Referenced by oasys::Ref< _Type >::assign(), oasys::Ref< _Type >::Ref(), and oasys::Ref< _Type >::release().
const char * oasys::Ref< _Type >::what2_ [private] |
Definition at line 274 of file Ref.h.
Referenced by oasys::Ref< _Type >::assign(), oasys::Ref< _Type >::Ref(), and oasys::Ref< _Type >::release().