LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LibCarna::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.hpp>

+ Inheritance diagram for LibCarna::base::Composition< AssociatedObjectType >:
+ Collaboration diagram for LibCarna::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 LibCarna::base::Association< AssociatedObjectType >
virtual ~Association ()
 Does nothing.
 
AssociatedObjectTypeget () const
 Returns raw pointer to the referenced object.
 
AssociatedObjectTypeoperator-> () const
 
AssociatedObjectTypeoperator* () 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.
 

Additional Inherited Members

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

Detailed Description

template<typename AssociatedObjectType>
class LibCarna::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

Definition at line 55 of file Composition.hpp.

Constructor & Destructor Documentation

◆ Composition()

LibCarna::base::Composition< AssociatedObjectType >::Composition ( AssociatedObjectType associatedObject)
inlineexplicit

Instantiates.

Definition at line 63 of file Composition.hpp.

◆ ~Composition()

Deletes the associated object, if there is one.

Definition at line 72 of file Composition.hpp.


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