IndirectListAddressing.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::IndirectListAddressing
28 
29 Description
30  A class for storing list addressing (labels, slices etc), which are
31  normally to used by IndirectList.
32  Private inheritance is often used by any inheriting classes.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef Foam_IndirectListAddressing_H
37 #define Foam_IndirectListAddressing_H
38 
39 #include <utility> // std::move
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class IndirectListAddressing Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class Addr>
52 {
53  // Private Data
54 
55  //- Storage for addressing
56  Addr storedAddr_;
57 
58 
59 public:
60 
61  // Constructors
62 
63  //- Copy construct from addressing information
64  IndirectListAddressing(const Addr& addr)
65  :
66  storedAddr_(addr)
67  {}
68 
69  //- Move construct from addressing information
70  IndirectListAddressing(Addr&& addr)
71  :
72  storedAddr_(std::move(addr))
73  {}
74 
75 
76  // Member Functions
77 
78  //- Const access to the addressing
79  const Addr& addressing() const noexcept
80  {
81  return storedAddr_;
82  }
83 
84  //- Non-const access to the addressing
85  Addr& addressing() noexcept
86  {
87  return storedAddr_;
88  }
89 };
90 
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 } // End namespace Foam
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 #endif
99 
100 // ************************************************************************* //
IndirectListAddressing(const Addr &addr)
Copy construct from addressing information.
const direction noexcept
Definition: Scalar.H:258
const Addr & addressing() const noexcept
Const access to the addressing.
A class for storing list addressing (labels, slices etc), which are normally to used by IndirectList...
Namespace for OpenFOAM.