Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/express/nativeNumericData.I

Go to the documentation of this file.
00001 // Filename: nativeNumericData.I
00002 // Created by:  drose (09May01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: NativeNumericData::Constructor
00022 //       Access: Public
00023 //  Description: This constructor accepts the address of a numeric
00024 //               variable, and its sizeof.
00025 ////////////////////////////////////////////////////////////////////
00026 INLINE NativeNumericData::
00027 NativeNumericData(const void *data, size_t) :
00028   _source(data)
00029 {
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: NativeNumericData::Constructor
00034 //       Access: Public
00035 //  Description: This constructor accepts a pointer to a data array
00036 //               containing a packed numeric value, the offset within
00037 //               the array at which the numeric value starts, and the
00038 //               size of the numeric value.
00039 //
00040 //               It is essential that the array not be destructed or
00041 //               modified as long as the NumericData object remains;
00042 //               it may just store a pointer into that string's
00043 //               internal buffer.
00044 ////////////////////////////////////////////////////////////////////
00045 INLINE NativeNumericData::
00046 NativeNumericData(const void *data, size_t start, size_t) {
00047   _source = (void *)((const char *)data + start);
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: NativeNumericData::store_value
00052 //       Access: Public
00053 //  Description: Copies the data, with byte reversal if appropriate,
00054 //               into the indicated numeric variable, whose address
00055 //               and sizeof are given.
00056 ////////////////////////////////////////////////////////////////////
00057 INLINE void NativeNumericData::
00058 store_value(void *dest, size_t length) const {
00059   memcpy(dest, _source, length);
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: NativeNumericData::get_data
00064 //       Access: Public
00065 //  Description: Returns the pointer to the first byte of the data,
00066 //               either reversed or nonreversed, as appropriate.
00067 ////////////////////////////////////////////////////////////////////
00068 INLINE const void *NativeNumericData::
00069 get_data() const {
00070   return _source;
00071 }

Generated on Fri May 2 00:38:27 2003 for Panda by doxygen1.3