![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
00001 /* 00002 * The GURLS Package in C++ 00003 * 00004 * Copyright (C) 2011-1013, IIT@MIT Lab 00005 * All rights reserved. 00006 * 00007 * authors: M. Santoro 00008 * email: msantoro@mit.edu 00009 * website: http://cbcl.mit.edu/IIT@MIT/IIT@MIT.html 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions 00013 * are met: 00014 * 00015 * * Redistributions of source code must retain the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer. 00018 * * Redistributions in binary form must reproduce the above 00019 * copyright notice, this list of conditions and the following 00020 * disclaimer in the documentation and/or other materials 00021 * provided with the distribution. 00022 * * Neither the name(s) of the copyright holders nor the names 00023 * of its contributors or of the Massacusetts Institute of 00024 * Technology or of the Italian Institute of Technology may be 00025 * used to endorse or promote products derived from this software 00026 * without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00029 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00030 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00031 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00032 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00033 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00034 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00035 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00036 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00037 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00038 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00039 * POSSIBILITY OF SUCH DAMAGE. 00040 */ 00041 00042 00043 #ifndef _GURLS_EXCEPTIONS_H_ 00044 #define _GURLS_EXCEPTIONS_H_ 00045 00046 #include "gurls++/exports.h" 00047 #include <iostream> 00048 #include <string> 00049 #include <map> 00050 #include <vector> 00051 #include <exception> 00052 00053 namespace gurls { 00054 00055 /* 00056 STATIC GLOBAL FIELDS DEFINED IN THE NAMESPACE TO IDENTIFY TYPICAL EXCEPTIONS 00057 */ 00058 00064 static std::string 00065 Exception_Incipit("ERROR! "); 00066 00068 // * \ingroup Exceptions 00069 // * 00070 // * Message displayed when a method tryes to modify an array that is not the owner of its data 00071 // */ 00072 //static std::string 00073 //Exception_Wrong_Ownership(Exception_Incipit+"An attempt to modify an array that is not the owner of its data occurred."); 00074 00080 static std::string 00081 Exception_Wrong_Memory_Access(Exception_Incipit+"An attempt to acces a non-existent memory location occurred."); 00082 00088 static std::string 00089 Exception_Inconsistent_Size(Exception_Incipit+"An attempt to combine arrays with inconsistent dimensions occurred."); 00090 00096 static std::string 00097 Exception_Functionality_Not_Implemented(Exception_Incipit+"An attempt to use a functionality that is not implemented yet occurred."); 00098 00104 static std::string 00105 Exception_Square_Matrix_Required(Exception_Incipit+"An attempt to use a general matrix instead of the required square matrix occurred."); 00106 00112 static std::string 00113 Exception_Unknown_Option(Exception_Incipit+"An unknown option has been used."); 00114 00120 static std::string 00121 Exception_Required_Parameter_Missing(Exception_Incipit+"One of the parameters required to run the algorithm is missing."); 00122 00128 static std::string 00129 Exception_Parameter_Not_Definied_Yet(Exception_Incipit+"The requested parameter has not been defined yet."); 00130 00136 static std::string 00137 Exception_Parameter_Already_Definied(Exception_Incipit+"The parameter has been already defined."); 00138 00144 static std::string 00145 Exception_Logical_Operator(Exception_Incipit+"An unknown logical comparison has been required."); 00146 00152 static std::string 00153 Exception_Illegal_Dynamic_Cast(Exception_Incipit+"An illegal dynamic cast occured."); 00154 00160 static std::string 00161 Exception_Illegal_Argument_Value(Exception_Incipit+"The value of the input variable is not allowed."); 00162 00168 static std::string 00169 Exception_Invalid_Reshape_Arguments(Exception_Incipit+"To RESHAPE the number of elements must not change."); 00170 00176 static std::string 00177 Exception_Index_Out_of_Bound(Exception_Incipit+"Index exceeds matrix dimensions."); 00178 00184 static std::string 00185 Exception_Gurls_Inconsistent_Processes_Number(Exception_Incipit+"The number of elements in the list of processes/tasks is not consistent."); 00186 00192 static std::string 00193 Exception_Gurls_Invalid_ProcessID(Exception_Incipit+"Invalid process ID."); 00194 00200 static std::string 00201 Exception_Invalid_TaskSequence(Exception_Incipit+"Invalid task name specification."); 00202 00208 static std::string 00209 Exception_Unknown_Function(Exception_Incipit+"Unknown function."); 00210 00216 static std::string 00217 Exception_Unsupported_MatrixType(Exception_Incipit+"Matrix type actually unsupported."); 00218 00219 00220 #ifdef _WIN32 00221 #pragma warning(push) 00222 #pragma warning(disable : 4251) 00223 #endif 00224 00235 class GURLS_EXPORT gException: public std::exception { 00236 private: 00237 std::string msg; 00238 public: 00242 gException( std::string message ) : msg(message) { } 00243 virtual ~gException() throw () { } 00247 inline std::string getMessage() const { return std::string("[")+std::exception::what()+"]: " + msg; } 00251 inline const char* what() const throw (){ return getMessage().c_str(); } 00252 }; 00253 00254 00255 #ifdef _WIN32 00256 #pragma warning(pop) 00257 #endif 00258 00259 } 00260 00261 #endif // _GURLS_EXCEPTIONS_H_