DUDS
Distributed Update of Data from Something
duds::SomethingRef< ST > Class Template Reference

A reference to a Something object. More...

#include <SomethingRef.hpp>

Collaboration diagram for duds::SomethingRef< ST >:

Public Member Functions

 SomethingRef ()=default
 Makes an uninitalized reference to nothing. More...
 
 SomethingRef (const SomethingRef &)=default
 The default copy constructor. More...
 
 SomethingRef (const shared_ptr< ST > &s)
 Makes a new reference to Something from a shared pointer. More...
 
ST * get () const
 Returns the pointer to the Something object. More...
 
bool operator bool () const noexcept
 Tells if the this object references Something or nothing. More...
 
template<class S >
bool operator!= (const S &s) const
 Something objects are compared using their UUID. More...
 
template<class S >
bool operator< (const S &s) const
 Something objects are compared using their UUID. More...
 
template<class S >
bool operator<= (const S &s) const
 Something objects are compared using their UUID. More...
 
template<class S >
bool operator== (const S &s) const
 Something objects are compared using their UUID. More...
 
template<class S >
bool operator> (const S &s) const
 Something objects are compared using their UUID. More...
 
template<class S >
bool operator>= (const S &s) const
 Something objects are compared using their UUID. More...
 
void reset () noexcept
 Loses the reference to Something. More...
 
const shared_ptr< ST > shared () const
 Returns the shared pointer to Something. More...
 
const boost::uuids::uuid & uuid () const
 Returns the object's unique identifier. More...
 

Private Attributes

shared_ptr< ST > sp
 A shared pointer to Something. More...
 

Detailed Description

template<class ST = Something>
class duds::SomethingRef< ST >

A reference to a Something object.

This object holds a shared pointer to the Something object and performs comparisons using the Something's UUID. This allows for containers that hold sets of sorted Something objects without holding the actual object or a simple pointer to it.

Template Parameters
STThe Something type. It should be Something or a class derived from Something.
Todo:
Add templated conversions between compatible SomethingRef types using different ST.
Author
Jeff Jackowski
Todo:
Decide if this should be used.

Definition at line 176 of file SomethingRef.hpp.

Constructor & Destructor Documentation

◆ SomethingRef() [1/3]

template<class ST = Something>
duds::SomethingRef< ST >::SomethingRef ( )
default

Makes an uninitalized reference to nothing.

◆ SomethingRef() [2/3]

template<class ST = Something>
duds::SomethingRef< ST >::SomethingRef ( const SomethingRef< ST > &  )
default

The default copy constructor.

◆ SomethingRef() [3/3]

template<class ST = Something>
duds::SomethingRef< ST >::SomethingRef ( const shared_ptr< ST > &  s)
inline

Makes a new reference to Something from a shared pointer.

Precondition
The shared pointer points to Something.
Parameters
sThe shared pointer to Something.
Exceptions
err?The provided shared pointer points to nothing.

Definition at line 196 of file SomethingRef.hpp.

Member Function Documentation

◆ get()

template<class ST = Something>
ST* duds::SomethingRef< ST >::get ( ) const
inline

Returns the pointer to the Something object.

Definition at line 218 of file SomethingRef.hpp.

◆ operator bool()

template<class ST = Something>
bool duds::SomethingRef< ST >::operator bool ( ) const
inlinenoexcept

Tells if the this object references Something or nothing.

Definition at line 224 of file SomethingRef.hpp.

◆ operator!=()

template<class ST = Something>
template<class S >
bool duds::SomethingRef< ST >::operator!= ( const S &  s) const
inline

Something objects are compared using their UUID.

Precondition
This object references a Something object rather than nothing.

Definition at line 281 of file SomethingRef.hpp.

◆ operator<()

template<class ST = Something>
template<class S >
bool duds::SomethingRef< ST >::operator< ( const S &  s) const
inline

Something objects are compared using their UUID.

Precondition
This object references a Something object rather than nothing.

Definition at line 241 of file SomethingRef.hpp.

◆ operator<=()

template<class ST = Something>
template<class S >
bool duds::SomethingRef< ST >::operator<= ( const S &  s) const
inline

Something objects are compared using their UUID.

Precondition
This object references a Something object rather than nothing.

Definition at line 257 of file SomethingRef.hpp.

◆ operator==()

template<class ST = Something>
template<class S >
bool duds::SomethingRef< ST >::operator== ( const S &  s) const
inline

Something objects are compared using their UUID.

Precondition
This object references a Something object rather than nothing.

Definition at line 273 of file SomethingRef.hpp.

◆ operator>()

template<class ST = Something>
template<class S >
bool duds::SomethingRef< ST >::operator> ( const S &  s) const
inline

Something objects are compared using their UUID.

Precondition
This object references a Something object rather than nothing.

Definition at line 249 of file SomethingRef.hpp.

◆ operator>=()

template<class ST = Something>
template<class S >
bool duds::SomethingRef< ST >::operator>= ( const S &  s) const
inline

Something objects are compared using their UUID.

Precondition
This object references a Something object rather than nothing.

Definition at line 265 of file SomethingRef.hpp.

◆ reset()

template<class ST = Something>
void duds::SomethingRef< ST >::reset ( )
inlinenoexcept

Loses the reference to Something.

Precondition
This object is not being used as a key for a sorted container.
Postcondition
The shared pointer will have no object, and the UUID will be zero.

Definition at line 232 of file SomethingRef.hpp.

◆ shared()

template<class ST = Something>
const shared_ptr<ST> duds::SomethingRef< ST >::shared ( ) const
inline

Returns the shared pointer to Something.

Definition at line 212 of file SomethingRef.hpp.

◆ uuid()

template<class ST = Something>
const boost::uuids::uuid& duds::SomethingRef< ST >::uuid ( ) const
inline

Returns the object's unique identifier.

Precondition
This object references a Something object rather than nothing.

Definition at line 206 of file SomethingRef.hpp.

Member Data Documentation

◆ sp

template<class ST = Something>
shared_ptr<ST> duds::SomethingRef< ST >::sp
private

A shared pointer to Something.

Definition at line 180 of file SomethingRef.hpp.


The documentation for this class was generated from the following file: