foamGltfList.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) 2021 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::glTF::List
28 
29 Description
30  Container for glTF entities
31 
32 Note
33  Implements the glTF v2 specification
34 
35 SourceFiles
36  foamGltfList.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef foam_gltf_list_H
41 #define foam_gltf_list_H
42 
43 #include "DynamicList.H"
44 #include "Ostream.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace glTF
51 {
52  template<class Type> class List;
53 }
54 
55 template<class Type>
57 
58 namespace glTF
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class glTF::List Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type>
66 class List
67 {
68  // Private Data
69 
70  //- Storage
71  DynamicList<Type> data_;
72 
73 
74 public:
75 
76  // Constructors
77 
78  //- Default construct
79  List() = default;
80 
81 
82  //- Destructor
83  ~List() = default;
84 
85 
86  // Public Member Functions
87 
88  //- Helper to create a new Type on the list and set the ID
89  Type& create(const word& name);
90 
91  //- Return const access to the underlying list
92  const DynamicList<Type>& data() const noexcept;
93 
94  //- List contains no data
95  bool empty() const noexcept;
96 
97  //- Return the list size
98  label size() const noexcept;
99 
100  //- Write
101  void write(Ostream& os, const word& keyword, bool firstEntry = false);
102 
103  //- Write
104  void write(Ostream& os) const;
105 
106  Type& operator[](const label i);
107 };
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace glTF
113 } // End namespace Foam
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 #ifdef NoRepository
118  #include "foamGltfList.C"
119 #endif
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #endif
124 
125 // ************************************************************************* //
Foam::glTF::List::size
label size() const noexcept
Return the list size.
Definition: foamGltfList.C:58
Foam::glTF::List::~List
~List()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::DynamicList< Type >
Foam::glTF::List::List
List()=default
Default construct.
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::glTF::List::create
Type & create(const word &name)
Helper to create a new Type on the list and set the ID.
Definition: foamGltfList.C:33
Foam::glTF::List::write
void write(Ostream &os, const word &keyword, bool firstEntry=false)
Write.
Definition: foamGltfList.C:66
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::glTF::List::data
const DynamicList< Type > & data() const noexcept
Return const access to the underlying list.
Definition: foamGltfList.C:44
Foam::glTF::List
Container for glTF entities.
Definition: foamGltfList.H:51
Ostream.H
Foam::glTF::List::empty
bool empty() const noexcept
List contains no data.
Definition: foamGltfList.C:51
foamGltfList.C
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
DynamicList.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56