/usr/include/opencollada/COLLADAFramework/COLLADAFWEdge.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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | /*
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_EDGE_H__
#define __COLLADAFW_EDGE_H__
#include "COLLADAFWPrerequisites.h"
#include "COLLADABUPlatform.h"
#include "COLLADABUhash_map.h"
#include <assert.h>
#include <climits>
namespace COLLADAFW
{
/*
* An edge contains two int values, which contains the vertex indices of the points,
* which descripe the edge.
*/
class Edge
{
private:
/** The vertex indices of the points, which descripe the edge. */
unsigned int mVertexIndices[2];
/** Flag, if the edge is stored in reverse direction. */
bool mReverse;
public:
/** Constructor. */
Edge () : mReverse (false)
{
mVertexIndices[0] = UINT_MAX;
mVertexIndices[1] = UINT_MAX;
}
/** Constructor. */
Edge ( int index1, int index2 ) : mReverse (false)
{
if ( index1 < index2 )
{
mVertexIndices[0] = index1;
mVertexIndices[1] = index2;
}
else
{
mVertexIndices[0] = index2;
mVertexIndices[1] = index1;
mReverse = true;
}
}
/** Destructor. */
~Edge () {}
/** Set the edge vertex indices sorted. */
void setVertexIndices ( int index1, int index2 )
{
if ( index1 < index2 )
{
mVertexIndices[0] = index1;
mVertexIndices[1] = index2;
mReverse = false;
}
else
{
mVertexIndices[0] = index2;
mVertexIndices[1] = index1;
mReverse = true;
}
}
/** Flag, if the edge is stored in reverse direction. */
const bool& isReverse () const { return mReverse; }
unsigned int operator[](size_t i) const
{
COLLADABU_ASSERT( i < 2 );
return mVertexIndices [i];
}
operator size_t () const
{
size_t retVal = 2166136261U;
retVal = 16777619U * retVal ^ (size_t)mVertexIndices[0];
retVal = 16777619U * retVal ^ (size_t)mVertexIndices[1];
return retVal;
}
bool operator==(const Edge& e2) const
{
if ( mVertexIndices[0] != e2.mVertexIndices[0] ) return false;
if ( mVertexIndices[1] != e2.mVertexIndices[1] ) return false;
return true;
}
bool operator<(const Edge& e2) const
{
if ( mVertexIndices[0] > e2.mVertexIndices[0] ) return false;
if ( mVertexIndices[0] == e2.mVertexIndices[0] )
{
if ( mVertexIndices[1] >= e2.mVertexIndices[1] ) return false;
}
return true;
}
};
} // namespace COLLADAFW
namespace COLLADABU_HASH_NAMESPACE_OPEN
{
template<>
struct COLLADABU_HASH_FUN<COLLADAFW::Edge>
{
size_t operator() (const COLLADAFW::Edge& edge) const { return edge; }
#if defined(_MSC_VER) && _MSC_VER==1400
static const size_t bucket_size=4;
static const size_t min_buckets=8;
bool operator() (const COLLADAFW::Edge& edge1, const COLLADAFW::Edge& edge2) const { return edge1<edge2; }
#endif
};
} COLLADABU_HASH_NAMESPACE_CLOSE
#endif // __COLLADAFW_EDGE_H__
|