foamGltfBufferView.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::bufferView
28 
29 Description
30  glTF buffer view - provides a view/slice of the glTF buffer
31 
32 Note
33  Implements the glTF v2 specification
34 
35 SourceFiles
36  foamGltfBufferView.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef foam_gltf_bufferview_H
41 #define foam_gltf_bufferview_H
42 
43 #include "foamGltfBase.H"
44 #include "Ostream.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace glTF
51 {
52  class bufferView;
53 }
54 
55 Ostream& operator<<(Ostream&, const glTF::bufferView& bv);
56 
57 namespace glTF
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class glTF::bufferView Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class bufferView
65 :
66  public base
67 {
68 protected:
69 
70  // Protected Data
71 
72  //- Buffer index
73  label buffer_;
74 
75  //- Byte offset
76  label byteOffset_;
77 
78  //- Byte length
79  label byteLength_;
80 
81  //- Target
82  label target_;
83 
84 
85 public:
86 
87  // Constructors
88 
89  //- Default construct
90  bufferView();
91 
92  //- Construct with name
93  explicit bufferView(const word& name);
94 
95 
96  //- Destructor
97  ~bufferView() = default;
98 
99 
100  // Public Member Functions
101 
102  //- Return the buffer index
103  label& buffer() noexcept;
104 
105  //- Return the byte offset
106  label& byteOffset() noexcept;
107 
108  //- Return the byte length
109  label& byteLength() noexcept;
110 
111  //- Return the target
112  label& target() noexcept;
113 
114  //- Write
115  void write(Ostream& os) const;
116 
117 
118  // Member Operators
119 
120  void operator=(const bufferView& bv);
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace glTF
127 } // End namespace Foam
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
132 
133 // ************************************************************************* //
Foam::glTF::bufferView::target
label & target() noexcept
Return the target.
Definition: foamGltfBufferView.C:72
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::glTF::bufferView::byteLength_
label byteLength_
Byte length.
Definition: foamGltfBufferView.H:78
Foam::glTF::bufferView::buffer
label & buffer() noexcept
Return the buffer index.
Definition: foamGltfBufferView.C:54
Foam::glTF::base::name
const word & name() const noexcept
Return const access to the name.
Definition: foamGltfBase.H:165
Foam::glTF::bufferView::buffer_
label buffer_
Buffer index.
Definition: foamGltfBufferView.H:72
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::glTF::base
Base class for glTF entities.
Definition: foamGltfBase.H:121
Foam::glTF::bufferView
glTF buffer view - provides a view/slice of the glTF buffer
Definition: foamGltfBufferView.H:63
Foam::glTF::bufferView::~bufferView
~bufferView()=default
Destructor.
foamGltfBase.H
Foam::glTF::bufferView::target_
label target_
Target.
Definition: foamGltfBufferView.H:81
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::glTF::bufferView::byteOffset_
label byteOffset_
Byte offset.
Definition: foamGltfBufferView.H:75
Ostream.H
Foam::glTF::bufferView::byteOffset
label & byteOffset() noexcept
Return the byte offset.
Definition: foamGltfBufferView.C:60
Foam::glTF::bufferView::bufferView
bufferView()
Default construct.
Definition: foamGltfBufferView.C:32
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::glTF::bufferView::write
void write(Ostream &os) const
Write.
Definition: foamGltfBufferView.C:78
Foam::glTF::bufferView::byteLength
label & byteLength() noexcept
Return the byte length.
Definition: foamGltfBufferView.C:66