Carna  Version 3.0.1
Public Member Functions | Protected Member Functions | Related Functions | List of all members
Carna::base::Association< AssociatedObjectType > Class Template Reference

Represents an association. More...

#include <Association.h>

+ Inheritance diagram for Carna::base::Association< AssociatedObjectType >:

Public Member Functions

virtual ~Association ()
 Does nothing.
 
AssociatedObjectType * get () const
 Returns raw pointer to the referenced object.
 
AssociatedObjectType * operator-> () const
 
AssociatedObjectType & operator* () const
 Returns raw reference to the referenced object.
 
 operator bool () const
 Tells whether any object is referenced by this association.
 
void forget ()
 Makes this association forget it's referenced object. More...
 

Protected Member Functions

 Association (AssociatedObjectType *associatedObject=nullptr)
 Instantiates.
 

Related Functions

(Note that these are not member functions.)

template<typename AssociatedObjectType >
bool operator== (const Carna::base::Association< AssociatedObjectType > &l, const Carna::base::Association< AssociatedObjectType > &r)
 Tells whether l and r do reference the same object, that may be nullptr.
 

Detailed Description

template<typename AssociatedObjectType>
class Carna::base::Association< AssociatedObjectType >

Represents an association.

By using this class it is possible to let the user of some software module decide whether he wants to pass the ownership of some object to that module or not.

Author
Leonid Kostrykin
Date
26.10.11 - 17.3.15

Definition at line 44 of file Association.h.

Member Function Documentation

template<typename AssociatedObjectType>
void Carna::base::Association< AssociatedObjectType >::forget ( )
inline

Makes this association forget it's referenced object.

Using this method it is possible to bypass the default behavior of the association when it is released.

Definition at line 95 of file Association.h.

template<typename AssociatedObjectType>
AssociatedObjectType* Carna::base::Association< AssociatedObjectType >::operator-> ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 68 of file Association.h.


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