Webdar 1.0.0
Web user interface to libdar
Public Member Functions | Protected Member Functions | List of all members
reference Class Reference

class reference gives a mean to link objects by a peering method More...

#include <reference.hpp>

Inheritance diagram for reference:
Inheritance graph
[legend]

Public Member Functions

 reference ()
 usual constructor
 
 reference (const reference &ref)
 copy constructor More...
 
 reference (reference &&ref) noexcept(false)
 move constructor (only operational for objects without peering) More...
 
referenceoperator= (const reference &ref)
 assignment operator (only operational for objects without peering) More...
 
referenceoperator= (reference &&ref) noexcept(false)
 move assigment operator More...
 
virtual ~reference ()
 destructor
 
void peer_with (reference *obj)
 method used to create a relation between two objects More...
 
void break_peer_with (reference *obj)
 break the peering with the object given as argument
 
bool is_peer (reference *obj) const
 whether a peering exists with that object
 
bool is_empty () const
 whether the current object has peering
 
unsigned int size () const
 the number of peers
 

Protected Member Functions

virtual void broken_peering_from (reference *obj)
 to be informed when a peer has broke the peering with me More...
 
void reset_read_peers () const
 reset the peers reading
 
bool read_next_peer (reference *&peer) const
 

Detailed Description

class reference gives a mean to link objects by a peering method

it handles object destruction and updates all existing peers accordingly main use is for inherited classes needing link between objects of the same class or between objects of different classes (shared implementation for those uses cases).

Constructor & Destructor Documentation

◆ reference() [1/2]

reference::reference ( const reference ref)
inline

copy constructor

Note
the new object does not keep any peer that the copied object could have

◆ reference() [2/2]

reference::reference ( reference &&  ref)
noexcept

move constructor (only operational for objects without peering)

Note
if a real implementation is needed, care should be taken to reconstruct any existing peering with the new address of this moved object

Member Function Documentation

◆ broken_peering_from()

virtual void reference::broken_peering_from ( reference obj)
inlineprotectedvirtual

to be informed when a peer has broke the peering with me

Reimplemented in events, and server_pool.

◆ operator=() [1/2]

reference & reference::operator= ( const reference ref)

assignment operator (only operational for objects without peering)

Note
see the note of the copy constructor

◆ operator=() [2/2]

reference & reference::operator= ( reference &&  ref)
noexcept

move assigment operator

See also
note the of the move constructor

◆ peer_with()

void reference::peer_with ( reference obj)

method used to create a relation between two objects

Parameters
[in]objmust point to valid/existing object of class reference or inherited class.
Note
the relation is symetrical [a.peer_with(&b) is the same as b.peer_with(&a)]. The relation ends when one or the other object is destroyed. The other object is then notified of this event by a call to its broken_peering_from() method

◆ read_next_peer()

bool reference::read_next_peer ( reference *&  peer) const
protected

provide the next peer

Parameters
[in]peeris the address of the next peer upon successful call
Returns
true if a next peer exists, false else in that case the argument is undefined

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