Removed throw.

This commit is contained in:
Robert Osfield 2009-11-16 15:17:57 +00:00
parent 03e95d97f1
commit af906310f1
3 changed files with 33 additions and 23 deletions

View File

@ -2,7 +2,7 @@
//
//////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 Tanguy Fautré.
// Copyright (C) 2002 Tanguy Fautr<EFBFBD>.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -20,7 +20,7 @@
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
// Tanguy Fautré
// Tanguy Fautr<EFBFBD>
// softdev@pandora.be
//
//////////////////////////////////////////////////////////////////////
@ -258,20 +258,12 @@ inline void graph_array<nodetype, arctype>::setsize(const size_t NbNodes) {
template <class nodetype, class arctype>
inline typename graph_array<nodetype, arctype>::node & graph_array<nodetype, arctype>::operator [] (const nodeid & i) {
// Debug check
// assert(i < size());
if (i >= size()) throw "graph_array<nodetype, arctype>::operator [] out of range";
return m_Nodes[i];
}
template <class nodetype, class arctype>
inline const typename graph_array<nodetype, arctype>::node & graph_array<nodetype, arctype>::operator [] (const nodeid & i) const {
// Debug check
// assert(i < size());
if (i >= size()) throw "graph_array<nodetype, arctype>::operator [] out of range";
return m_Nodes[i];
}

View File

@ -2,7 +2,7 @@
//
//////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 Tanguy Fautré.
// Copyright (C) 2002 Tanguy Fautr<EFBFBD>.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -20,7 +20,7 @@
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
// Tanguy Fautré
// Tanguy Fautr<EFBFBD>
// softdev@pandora.be
//
//////////////////////////////////////////////////////////////////////
@ -44,7 +44,6 @@
#ifndef TRISTRIP_HEAP_ARRAY_H
#define TRISTRIP_HEAP_ARRAY_H
// namespace common_structures
namespace common_structures {
@ -148,8 +147,10 @@ inline size_t heap_array<T, CmpT>::size() const {
template <class T, class CmpT>
inline const T & heap_array<T, CmpT>::top() const {
// Debug check to ensure heap is not empty
//assert(! empty());
if (empty()) throw "heap_array<T, CmpT>::top() error, heap empty";
if (empty())
{
osg::notify(osg::NOTICE)<<"TriStripVisitor:: heap_array<T, CmpT>::top() error, heap empty."<<std::endl;
}
return m_Heap.front().m_Elem;
}
@ -159,7 +160,10 @@ template <class T, class CmpT>
inline const T & heap_array<T, CmpT>::peek(size_t i) const {
// Debug check to ensure element is still present
//assert(! removed(i));
if (removed(i)) throw "heap_array<T, CmpT>::peek(size_t i) error";
if (removed(i))
{
osg::notify(osg::NOTICE)<<"TriStripVisitor:: heap_array<T, CmpT>::peek(size_t i) error."<<std::endl;
}
return (m_Heap[m_Finder[i]].m_Elem);
}
@ -176,8 +180,11 @@ inline void heap_array<T, CmpT>::pop() {
m_Locked = true;
// Debug check to ensure heap is not empty
//assert(! empty());
if (empty()) throw "heap_array<T, CmpT>::pop() error, heap empty";
if (empty())
{
osg::notify(osg::NOTICE)<<"TriStripVisitor:: heap_array<T, CmpT>::pop() error, heap empty."<<std::endl;;
return;
}
Swap(0, size() - 1);
m_Heap.pop_back();
@ -188,7 +195,10 @@ inline void heap_array<T, CmpT>::pop() {
template <class T, class CmpT>
inline size_t heap_array<T, CmpT>::push(const T & Elem) {
if (m_Locked)
throw "heap_is_locked";
{
osg::notify(osg::NOTICE)<<"TriStripVisitor:: heap_array<T, CmpT>::push() heap_is_locked."<<std::endl;;
return 0;
}
size_t Id = size();
m_Finder.push_back(Id);
@ -204,8 +214,12 @@ inline void heap_array<T, CmpT>::erase(size_t i) {
m_Locked = true;
// Debug check to ensure element is still present
if (removed(i)) throw "heap_array<T, CmpT>::erase(size_t i) error";
if (removed(i))
{
osg::notify(osg::NOTICE)<<"TriStripVisitor:: heap_array<T, CmpT>::erase(size_t i) error."<<std::endl;;
return;
}
size_t j = m_Finder[i];
if (j==m_Heap.size()-1)
@ -239,7 +253,11 @@ template <class T, class CmpT>
inline void heap_array<T, CmpT>::update(size_t i, const T & Elem) {
// Debug check to ensure element is still present
// assert(! removed(i));
if (removed(i)) throw "heap_array<T, CmpT>::update(size_t i, const T & Elem) error";
if (removed(i))
{
osg::notify(osg::NOTICE)<<"TriStripVisitor:: heap_array<T, CmpT>::update(size_t i, const T & Elem) error."<<std::endl;;
return;
}
size_t j = m_Finder[i];
m_Heap[j].m_Elem = Elem;

View File

@ -18,8 +18,8 @@
//
//////////////////////////////////////////////////////////////////////
#include "TriStrip_tri_stripper.h"
#include <osg/Notify>
#include "TriStrip_tri_stripper.h"
// namespace triangle_stripper