LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Composition.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2016 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 *
11 * Copyright (C) 2021 - 2025 Leonid Kostrykin
12 *
13 */
14
15#ifndef COMPOSITION_H_6014714286
16#define COMPOSITION_H_6014714286
17
24
25namespace LibCarna
26{
27
28namespace base
29{
30
31
32
33// ----------------------------------------------------------------------------------
34// Composition
35// ----------------------------------------------------------------------------------
36
54template< typename AssociatedObjectType >
55class Composition : public Association< AssociatedObjectType >
56{
57
58public:
59
63 explicit Composition( AssociatedObjectType* associatedObject )
64 : Association< AssociatedObjectType >( associatedObject )
65 {
66 }
67
68
72 virtual ~Composition()
73 {
75 if( associatedObject )
76 {
77 delete associatedObject;
78 }
79 }
80
81}; // Composition
82
83
84
85} // namespace LibCarna :: base
86
87} // namespace LibCarna
88
89#endif // COMPOSITION_H_6014714286
Defines LibCarna::base::Association.
Represents an association.
AssociatedObjectType * get() const
Returns raw pointer to the referenced object.
Represents a composition, i.e. a strong reference. This basically is a std::unique_ptr that supports ...
Composition(AssociatedObjectType *associatedObject)
Instantiates.
virtual ~Composition()
Deletes the associated object, if there is one.