Coin3D is Free Software,
published under the
BSD 3-clause license
.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SbByteBuffer.h
1
/*
2
Defining Private variables in exactly one location, to keep them in
3
sync, remember to undefine this, so this is not visible outside this
4
header, unless included from an .icc file
5
*/
6
/*
7
NOTE: This define is done outside the Header guard, and undefined in
8
the end. This is to make it possible to include this from an .icc
9
file, even if the header has been included from before.
10
*/
11
#define SBBYTEBUFFER_PRIVATE_VARIABLES \
12
size_t size_; \
13
std::shared_ptr<char> buffer; \
14
SbBool invalid; \
15
static SbByteBuffer invalidBuffer_;
16
17
#ifndef COIN_SBBYTEBUFFER_H
18
#define COIN_SBBYTEBUFFER_H
19
20
#include <cstring>
21
#include <memory>
22
#include <Inventor/SbBasic.h>
23
24
#ifndef ABI_BREAKING_OPTIMIZE
25
class
SbByteBufferP;
26
#endif
//ABI_BREAKING_OPTIMIZE
27
28
29
30
//Consider making a general Buffer class for non bytes;
31
//Implements as a minimum the Buffer concept as defined by
32
//http://www.boost.org/doc/libs/1_37_0/libs/graph/doc/Buffer.html
33
class
COIN_DLL_API
SbByteBuffer
{
34
public
:
35
SbByteBuffer
(
const
char
* buffer);
36
SbByteBuffer
(
const
SbByteBuffer
& buffer);
37
SbByteBuffer
(
size_t
size = 0,
const
char
* buffer = NULL);
38
SbByteBuffer
(
size_t
size,
const
unsigned
char
* buffer);
39
~SbByteBuffer
();
40
41
SbBool isValid()
const
;
42
size_t
size()
const
;
43
SbBool empty()
const
;
44
45
const
char
& operator[](
size_t
idx)
const
;
46
SbByteBuffer
& operator=(
const
SbByteBuffer
& in);
47
SbBool operator==(
const
SbByteBuffer
& that)
const
;
48
SbByteBuffer
& operator+=(
const
SbByteBuffer
& buf) {
49
this->push(buf);
50
return
*
this
;
51
}
52
53
void
push(
const
SbByteBuffer
& buf);
54
55
const
char
* constData()
const
;
56
char
* data();
57
58
static
SbByteBuffer
& invalidBuffer();
59
void
makeUnique();
60
61
private
:
62
#ifndef ABI_BREAKING_OPTIMIZE
63
SbByteBufferP * pimpl;
64
#else
65
SBBYTEBUFFER_PRIVATE_VARIABLES
66
#endif
//ABI_BREAKING_OPTIMIZE
67
};
68
69
#ifdef ABI_BREAKING_OPTIMIZE
70
#include "SbByteBufferP.icc"
71
#endif
//ABI_BREAKING_OPTIMIZE
72
73
#endif
// !COIN_SBBYTEBUFFER_H
74
75
//The SBBYTEBUFFER_PRIVATE_VARIABLES must survive an inclusion from the .icc file
76
#ifndef COIN_ICC_INCLUDE
77
#undef SBBYTEBUFFER_PRIVATE_VARIABLES
78
#endif
//COIN_ICC_INCLUDE
SbByteBuffer
Definition
SbByteBuffer.h:33
include
Inventor
SbByteBuffer.h
Generated on Wed Jun 17 2026 05:25:18 for Coin by
doxygen
1.12.0