Panda3D
dtool
src
prc
nativeNumericData.h
1
// Filename: nativeNumericData.h
2
// Created by: drose (09May01)
3
//
4
////////////////////////////////////////////////////////////////////
5
//
6
// PANDA 3D SOFTWARE
7
// Copyright (c) Carnegie Mellon University. All rights reserved.
8
//
9
// All use of this software is subject to the terms of the revised BSD
10
// license. You should have received a copy of this license along
11
// with this source code in a file named "LICENSE."
12
//
13
////////////////////////////////////////////////////////////////////
14
15
#ifndef NATIVENUMERICDATA_H
16
#define NATIVENUMERICDATA_H
17
18
#include "dtoolbase.h"
19
#include "numeric_types.h"
20
21
#include <string.h>
// for memcpy()
22
23
////////////////////////////////////////////////////////////////////
24
// Class : NativeNumericData
25
// Description : NativeNumericData and ReversedNumericData work
26
// together to provide a sneaky interface for
27
// automatically byte-swapping numbers, when necessary,
28
// to transparency support big-endian and little-endian
29
// architectures.
30
//
31
// Both of these classes provide interfaces that accept
32
// a pointer to a numeric variable and the size of the
33
// number, and they can append that data to the end of a
34
// string, or memcpy it into another location.
35
//
36
// The difference is that NativeNumericData simply
37
// passes everything through unchanged, while
38
// ReversedNumericData always byte-swaps everything.
39
// Otherwise, they have the same interface.
40
//
41
// The transparent part comes from LittleEndian and
42
// BigEndian, which are typedeffed to be one of these or
43
// the other, according to the machine's architecture.
44
////////////////////////////////////////////////////////////////////
45
class
EXPCL_DTOOLCONFIG
NativeNumericData
{
46
public
:
47
INLINE
NativeNumericData
(
const
void
*data,
size_t
length);
48
INLINE NativeNumericData(
const
void
*data,
size_t
start,
size_t
length);
49
50
INLINE
void
store_value(
void
*dest,
size_t
length)
const
;
51
INLINE
const
void
*get_data()
const
;
52
53
private
:
54
const
void
*_source;
55
};
56
57
#include "nativeNumericData.I"
58
59
#endif
NativeNumericData
NativeNumericData and ReversedNumericData work together to provide a sneaky interface for automatical...
Definition:
nativeNumericData.h:45
Generated on Wed May 17 2017 23:39:37 for Panda3D by
1.8.13