Panda3D
Loading...
Searching...
No Matches
reversedNumericData.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file reversedNumericData.I
10 * @author drose
11 * @date 2001-05-09
12 */
13
14/**
15 * This constructor accepts the address of a numeric variable, and its sizeof.
16 */
18ReversedNumericData(const void *data, size_t length) {
19 reverse_assign((const char *)data, length);
20}
21
22/**
23 * This constructor accepts a pointer to a data array containing a packed
24 * numeric value, the offset within the array at which the numeric value
25 * starts, and the size of the numeric value.
26 *
27 * It is essential that the array not be destructed or modified as long as the
28 * NumericData object remains; it may just store a pointer into that string's
29 * internal buffer.
30 */
32ReversedNumericData(const void *data, size_t start, size_t length) {
33 reverse_assign((const char *)data + start, length);
34}
35
36/**
37 * Copies the data, with byte reversal if appropriate, into the indicated
38 * numeric variable, whose address and sizeof are given.
39 */
41store_value(void *dest, size_t length) const {
42 memcpy(dest, _data, length);
43}
44
45/**
46 * Returns the pointer to the first byte of the data, either reversed or
47 * nonreversed, as appropriate.
48 */
49INLINE const void *ReversedNumericData::
50get_data() const {
51 return _data;
52}
ReversedNumericData(const void *data, size_t length)
This constructor accepts the address of a numeric variable, and its sizeof.
const void * get_data() const
Returns the pointer to the first byte of the data, either reversed or nonreversed,...
void store_value(void *dest, size_t length) const
Copies the data, with byte reversal if appropriate, into the indicated numeric variable,...