Loading [MathJax]/extensions/tex2jax.js
Carna  Version 3.3.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
Carna::base::Composition< AssociatedObjectType > Class Template Reference

Represents a composition, i.e. a strong reference. This basically is a std::unique_ptr that supports the Association interface. More...

#include <Composition.h>

+ Inheritance diagram for Carna::base::Composition< AssociatedObjectType >:
+ Collaboration diagram for Carna::base::Composition< AssociatedObjectType >:

Public Member Functions

 Composition (AssociatedObjectType *associatedObject)
 Instantiates.
 
virtual ~Composition ()
 Deletes the associated object, if there is one.
 
- Public Member Functions inherited from Carna::base::Association< AssociatedObjectType >
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...
 

Additional Inherited Members

- Protected Member Functions inherited from Carna::base::Association< AssociatedObjectType >
 Association (AssociatedObjectType *associatedObject=nullptr)
 Instantiates.
 

Detailed Description

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

Represents a composition, i.e. a strong reference. This basically is a std::unique_ptr that supports the Association interface.

If an object B is a component of an object A, it means that the lifetime of B is bounded to the lifetime of A: Therefore, B is a part of object A. The same object cannot be part of more than one object at the same time.

See also
In opposite to this, the same object may be aggregated by any number of other objects at the same time.

Saying that object B is part of object A implies that object A possesses B and is therefore responsible of deleting it at some time.

Author
Leonid Kostrykin
Date
26.10.11 - 17.3.15

Definition at line 52 of file Composition.h.


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