diff --git a/src/DataTree.hh b/src/DataTree.hh index 8afab57caa9aee9b01d7ce158b3df1e44b62bddd..1319fee2247a133e86a3a209b5ab9c79ef79afbc 100644 --- a/src/DataTree.hh +++ b/src/DataTree.hh @@ -287,9 +287,13 @@ public: }; //! Raised when a trend is declared twice - struct TrendException + class TrendException : public std::exception { - string name; + private: + const string name; + + public: + TrendException(string name_arg) : name(name_arg) {} }; // Returns the derivation ID, or throws an exception if the derivation ID does not exist @@ -337,10 +341,14 @@ public: return false; }; - struct UnknownLocalVariableException + class UnknownLocalVariableException : public std::exception { + private: //! Symbol ID int id; + + public: + UnknownLocalVariableException(int id_arg) : id(id_arg) {} }; expr_t diff --git a/src/EquationTags.hh b/src/EquationTags.hh index 9ac418bddfb85659fd9692d22c1eaeca53a46d4b..befe2042c08452548190281d11a6a27fa04df658 100644 --- a/src/EquationTags.hh +++ b/src/EquationTags.hh @@ -32,6 +32,18 @@ class EquationTags private: map<int, map<string, string>> eqn_tags; public: + class TagNotFoundException : public std::exception + { + private: + const string key, value; + + public: + TagNotFoundException(const string key_arg, const string value_arg) : key(key_arg), + value(value_arg) + { + } + }; + // Add multiple equation tags for the given equation void add(int eqn, map<string, string> tags) diff --git a/src/ExternalFunctionsTable.hh b/src/ExternalFunctionsTable.hh index 39fbd67f760aab07b22183ade1c3023ae4143c62..3d9626f92597104126a982a670ce65bb47b0f062 100644 --- a/src/ExternalFunctionsTable.hh +++ b/src/ExternalFunctionsTable.hh @@ -33,10 +33,14 @@ class ExternalFunctionsTable { public: //! Thrown when trying to access an unknown symbol (by id) - struct UnknownExternalFunctionSymbolIDException + class UnknownExternalFunctionSymbolIDException : public std::exception { + private: //! Symbol ID int id; + + public: + UnknownExternalFunctionSymbolIDException(int id_arg) : id(id_arg) {} }; /* For all arguments, -2 means not set diff --git a/src/SymbolTable.hh b/src/SymbolTable.hh index 818334fce2845eea0a5dca816f7c8299d5cd337f..cce17027fccce1644df4f41f7c86f33a8bcdd02f 100644 --- a/src/SymbolTable.hh +++ b/src/SymbolTable.hh @@ -148,36 +148,63 @@ private: public: //! Thrown when trying to access an unknown symbol (by name) - struct UnknownSymbolNameException + class UnknownSymbolNameException : public std::exception { + private: //! Symbol name const string name; + + public: + UnknownSymbolNameException(const string name_arg) : name(name_arg) {} }; //! Thrown when trying to access an unknown symbol (by id) - struct UnknownSymbolIDException + class UnknownSymbolIDException : public std::exception { + private: //! Symbol ID const int id; + + public: + UnknownSymbolIDException(const int id_arg) : id(id_arg) {} }; //! Thrown when trying to access an unknown type specific ID - struct UnknownTypeSpecificIDException + class UnknownTypeSpecificIDException : public std::exception { + private: const int tsid; const SymbolType type; + + public: + UnknownTypeSpecificIDException(int tsid_arg, SymbolType type_arg) : tsid(tsid_arg), + type(type_arg) + { + } }; /* Thrown when requesting the type specific ID of a symbol which doesn’t have one */ - struct NoTypeSpecificIDException + class NoTypeSpecificIDException : public std::exception { + private: + //! Symbol ID const int symb_id; + + public: + NoTypeSpecificIDException(int symb_id_arg) : symb_id(symb_id_arg) {} }; //! Thrown when trying to declare a symbol twice - struct AlreadyDeclaredException + class AlreadyDeclaredException : public std::exception { + private: //! Symbol name const string name; //! Was the previous declaration done with the same symbol type ? const bool same_type; + + public: + AlreadyDeclaredException(string name_arg, bool same_type_arg) : name(name_arg), + same_type(same_type_arg) + { + } }; //! Thrown when table is frozen and trying to modify it class FrozenException