HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
OP_DataBlock.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: OP_DataBlock.h (OP Library, C++)
7
*
8
* COMMENTS: Simple class for holding a chunk of arbitrary binary data
9
* owned by a node.
10
*/
11
12
#ifndef __OP_DATABLOCK_H_INCLUDED__
13
#define __OP_DATABLOCK_H_INCLUDED__
14
15
#include "
OP_API.h
"
16
#include <
UT/UT_IntrusivePtr.h
>
17
#include <
UT/UT_StringHolder.h
>
18
#include <iosfwd>
19
20
class
UT_IStream
;
21
22
class
OP_API
OP_DataBlockInterpreter
23
{
24
public
:
25
OP_DataBlockInterpreter
(
const
UT_StringHolder
&
type
);
26
virtual
~
OP_DataBlockInterpreter
();
27
28
virtual
const
void
*createNativeData(
const
char
*
data
,
29
exint
length
)
const
= 0;
30
virtual
exint
memoryUsedByNativeData(
31
const
void
*nativedata)
const
= 0;
32
virtual
void
deleteNativeData(
const
void
*nativedata)
const
= 0;
33
virtual
void
saveNativeData(
const
void
*nativedata,
34
std::ostream &os)
const
= 0;
35
36
private
:
37
UT_StringHolder
myType;
38
};
39
40
class
OP_API
OP_DataBlock
:
public
UT_IntrusiveRefCounter
<OP_DataBlock>
41
{
42
public
:
43
OP_DataBlock
(
const
UT_StringHolder
&
type
);
44
~
OP_DataBlock
();
45
46
static
const
OP_DataBlockInterpreter
*
47
getInterpreter(
const
UT_StringRef
&blocktype);
48
49
const
UT_StringHolder
&
type
()
const
50
{
return
myType; }
51
const
char
*
data
()
const
52
{
return
myData; }
53
exint
length
()
const
54
{
return
myLength; }
55
exint
getMemoryUsage()
const
;
56
57
const
void
*nativeData();
58
void
adoptData(
const
char
*
data
,
exint
length
);
59
void
adoptNativeData(
const
void
*nativedata);
60
bool
saveData(std::ostream &os)
const
;
61
bool
loadData(
UT_IStream
&is);
62
63
private
:
64
void
deleteData();
65
void
deleteNativeData();
66
67
const
UT_StringHolder
myType;
68
const
char
*myData;
69
exint
myLength;
70
const
void
*myNativeData;
71
bool
myNativeDataIsValid;
72
};
73
74
#endif // __OP_DATABLOCK_H_INCLUDED__
OP_DataBlock
Definition:
OP_DataBlock.h:40
UT_IStream
Definition:
UT_IStream.h:56
exint
int64 exint
Definition:
SYS_Types.h:125
length
GLuint GLsizei GLsizei * length
Definition:
glcorearb.h:795
UT_StringRef
Definition:
UT_StringHolder.h:188
UT_IntrusiveRefCounter
A reference counter base class for use with UT_IntrusivePtr.
Definition:
UT_IntrusivePtr.h:242
OP_API.h
UT_StringHolder
Definition:
UT_StringHolder.h:999
OP_DataBlock::length
exint length() const
Definition:
OP_DataBlock.h:53
OP_DataBlock::data
const char * data() const
Definition:
OP_DataBlock.h:51
OP_DataBlock::type
const UT_StringHolder & type() const
Definition:
OP_DataBlock.h:49
OP_DataBlockInterpreter
Definition:
OP_DataBlock.h:22
UT_StringHolder.h
OP_API
#define OP_API
Definition:
OP_API.h:10
type
type
Definition:
core.h:1059
UT_IntrusivePtr.h
data
Definition:
format.h:895
OP
OP_DataBlock.h
Generated on Tue Dec 17 2024 03:40:03 for HDK by
1.8.6