fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Drawables / Geometry / Util / OSGFastTriangleIterator.inl
blobc1d1ce0ab76139548ca59fd34e7b267abcddb8e6
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                Copyright (C) 2011 by the OpenSG Forum                     *
6  *                                                                           *
7  *                            www.opensg.org                                 *
8  *                                                                           *
9  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
10  *                                                                           *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13  *                                License                                    *
14  *                                                                           *
15  * This library is free software; you can redistribute it and/or modify it   *
16  * under the terms of the GNU Library General Public License as published    *
17  * by the Free Software Foundation, version 2.                               *
18  *                                                                           *
19  * This library is distributed in the hope that it will be useful, but       *
20  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
22  * Library General Public License for more details.                          *
23  *                                                                           *
24  * You should have received a copy of the GNU Library General Public         *
25  * License along with this library; if not, write to the Free Software       *
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
27  *                                                                           *
28 \*---------------------------------------------------------------------------*/
30 OSG_BEGIN_NAMESPACE
32 inline Int32
33 FastTriangleIterator::getIndex(Int32 which) const
35     return Inherited::getIndex(_triPntIndex[which]);
38 inline Int32
39 FastTriangleIterator::getIndex(void) const
41     return _triIndex;
44 inline Int32
45 FastTriangleIterator::getPropertyIndex(UInt16 att, Int32 which) const
47     return Inherited::getPropertyIndex(att, _triPntIndex[which]);
50 template <class ReturnT>
51 inline ReturnT
52 FastTriangleIterator::getPropertyValue(UInt16 att, Int32 which) const
54     Int32 ind = getPropertyIndex(att, which);
56     return _props[att]->getValue<ReturnT>(ind);
59 inline FastTriangleIterator
60 FastTriangleIterator::operator++(int)
62     FastTriangleIterator returnValue(*this);
64     ++(*this);
66     return returnValue;
69 inline bool
70 FastTriangleIterator::operator<(const FastTriangleIterator &lhs) const
72     return (*static_cast<const Inherited *>(this) <  lhs) ||
73          ( (*static_cast<const Inherited *>(this) == lhs)       &&
74            _triIndex                              <  lhs._triIndex);
77 inline bool
78 FastTriangleIterator::operator==(const FastTriangleIterator &lhs) const
80     if(isAtEnd() && lhs.isAtEnd())
81         return true;
83     if(isAtEnd() || lhs.isAtEnd())
84         return false;
86     return (*static_cast<const Inherited *>(this) == lhs          ) &&
87            (_triIndex                             == lhs._triIndex);
90 inline bool
91 FastTriangleIterator::operator!=(const FastTriangleIterator &lhs) const
93     return !(*this == lhs);
96 OSG_END_NAMESPACE