# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

ligo_error.cpp

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #include "ligo_error.h"
00027 
00028 namespace NLLIGO
00029 {
00030 
00031 // ***************************************************************************
00032 
00033 CLigoError::CLigoError()
00034 {
00035         clear ();
00036 }
00037 
00038 // ***************************************************************************
00039 
00040 void CLigoError::pushVertexError (TError code, uint id, uint edge)
00041 {
00042         // Check if this vertex exist in the error list
00043         uint vertex;
00044         for (vertex=0; vertex<_VertexError.size(); vertex++)
00045         {
00046                 if (_VertexError[vertex].Id == id)
00047                 {
00048                         _VertexError[vertex] = CVertex (code, id, edge);
00049                         break;
00050                 }
00051         }
00052 
00053         // Not found ?
00054         if (vertex == _VertexError.size())
00055         {
00056                 // Add a vertex error
00057                 _VertexError.push_back (CVertex (code, id, edge));
00058         }
00059 }
00060 
00061 // ***************************************************************************
00062 
00063 uint CLigoError::numVertexError () const
00064 {
00065         return _VertexError.size ();
00066 }
00067 
00068 // ***************************************************************************
00069 
00070 CLigoError::TError CLigoError::getVertexError (uint error, uint &id, uint &edge) const
00071 {
00072         const CVertex &vertex = _VertexError[error];
00073         id = vertex.Id;
00074         edge = vertex.Edge;
00075         return vertex.Code;
00076 }
00077 
00078 // ***************************************************************************
00079 
00080 void CLigoError::clear ()
00081 {
00082         MainError = NoError;
00083         _VertexError.clear ();
00084 }
00085 
00086 // ***************************************************************************
00087 
00088 const char* CLigoError::_StringError[CLigoError::ErrorCount]=
00089 {
00090         "No error",                                             // NoError
00091         "No vertex in the edge list",   // NoEdgeVertices
00092         "Opened edges detected",                // OpenedEdge
00093         "Mulitple edge on the boundary",// MultipleEdge
00094         "Vertex list invalid. One vertex should be a corner",   // VertexList
00095         "The vertex has not been inserted in the edge list",    // NotInserted
00096         "The vertex has been inserted in the edge list",                // Inserted
00097         "Flat zone, all vertices are in the same corner",               // FlatZone
00098         "The zone must have 4 edges to define a material",      // MustHave4Edges
00099         "A edge of the zone is not symetrical",         // NotSymetrical
00100         "Not the same number of vertex",        // NotSameVerticesNumber
00101         "Some vertices are not the same",       // NotSameVertex
00102         "No corner found",                                      // NoCornerFound
00103         "A edge has two times the same corner", // TwoCornerVertices
00104         "A corner is missing in this edge", // CornerIsMissing
00105         "A boundary vertex is used by multiple edges", // VertexAlreadyUsed
00106         "Unkown error",                                         // UnknownError
00107 };
00108 
00109 // ***************************************************************************
00110 
00111 const char* CLigoError::getStringError (TError errorCode)
00112 {
00113         if (errorCode<=ErrorCount)
00114         {
00115                 return _StringError[errorCode];
00116         }
00117         else
00118         {
00119                 return _StringError[UnknownError];
00120         }
00121 }
00122 
00123 // ***************************************************************************
00124 
00125 }