/usr/include/opencollada/COLLADAFramework/COLLADAFWFloatOrDoubleArray.h is in opencollada-dev 0.1.0~20140703.ddf8f47+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | /*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of COLLADAFramework.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __COLLADAFW_FLOATORDOUBLEARRAY_H__
#define __COLLADAFW_FLOATORDOUBLEARRAY_H__
#include "COLLADAFWPrerequisites.h"
#include "COLLADAFWTypes.h"
#include "COLLADAFWAnimatable.h"
namespace COLLADAFW
{
/** Holds either a float or a double array */
class FloatOrDoubleArray : public Animatable
{
public:
/** Values can be stored as float or double values. */
enum DataType
{
DATA_TYPE_FLOAT = 0,
DATA_TYPE_DOUBLE = 1,
DATA_TYPE_UNKNOWN = 2,
};
private:
/** The data type of the stored position values. */
DataType mType;
/** The position values. */
FloatArray mValuesF;
DoubleArray mValuesD;
public:
/** Constructor. */
FloatOrDoubleArray();
FloatOrDoubleArray(DataType type);
/** Default copy ctor. */
FloatOrDoubleArray( const FloatOrDoubleArray& pre );
/** The data type of the stored values. */
DataType getType() const { return mType; }
/** The data type of the stored values. */
void setType( DataType Type ) { mType = Type; }
/** Returns the count of stored elements in the array. For DATA_TYPE_UNKNOWN 0 is returned.*/
size_t getValuesCount() const;
/** Returns if the array is empty. If type is DATA_TYPE_UNKNOWN, true is returned. Otherwise the array
of the set type is checked.*/
bool empty() const { return getValuesCount() == 0; }
/** Clears the values in the set number array. The data type remains unchanged.*/
void clear();
/** Returns the values array as a template array. */
template <class T>
ArrayPrimitiveType<T>& getValues()
{
if( mType == DATA_TYPE_FLOAT ) return mValuesF;
if( mType == DATA_TYPE_DOUBLE ) return mValuesD;
return 0;
}
/** Returns the values array as a float array. */
const FloatArray* getFloatValues() const;
/** Returns the values array as a double array. */
const DoubleArray* getDoubleValues() const;
/** Returns the values array as a float array. */
FloatArray* getFloatValues();
/** Returns the values array as a double array. */
DoubleArray* getDoubleValues();
/** Set the C-style data array.*/
void setData( float* data, const size_t count );
/** Set the C-style data array.*/
void setData( double* data, const size_t count );
/** Appends the values of the input array to the end of values array.
The programmer must ensure, that the memory allocated,
was large enough to hold another element. No new memory is allocated.*/
bool appendValues( const FloatArray& valuesArray );
/** Appends the values of the input array to the end of values array.
The programmer must ensure, that the memory allocated,
was large enough to hold another element. No new memory is allocated.*/
bool appendValues( const DoubleArray& valuesArray );
/** Destructor. */
virtual ~FloatOrDoubleArray();
private:
/** Disable default assignment operator. */
const FloatOrDoubleArray& operator= ( const FloatOrDoubleArray& pre );
};
} // namespace COLLADAFW
#endif // __COLLADAFW_FLOATORDOUBLEARRAY_H__
|