summaryrefslogtreecommitdiffstats
path: root/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h
diff options
context:
space:
mode:
Diffstat (limited to 'sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h')
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h363
1 files changed, 363 insertions, 0 deletions
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h
new file mode 100644
index 0000000000..0c39d7dede
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#if !defined SDO_EXCEPTIONS_H
+#define SDO_EXCEPTIONS_H
+
+#include "commonj/sdo/export.h"
+
+#include <string>
+#include <iostream>
+
+namespace commonj {
+
+ namespace sdo {
+
+/**
+ * Helper Class for SDORuntimeException constructor. Used with below macros
+ * to collect context information.
+ */
+class SDOExceptionInfo
+{
+public:
+ SDO_API SDOExceptionInfo(const char* fileName, unsigned long lineNumber, const char* functionName);
+ SDO_API SDOExceptionInfo(const SDOExceptionInfo& second);
+ SDO_API ~SDOExceptionInfo();
+ SDO_API SDOExceptionInfo& operator=(const SDOExceptionInfo& second);
+
+private:
+ unsigned long lineNumber;
+ const char* fileName;
+ const char* functionName;
+
+ friend class SDORuntimeException;
+};
+
+#ifdef _WIN32
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __FUNCSIG__)
+#elif linux
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__)
+#elif defined(__SUNPRO_CC)
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, 0)
+#elif defined(__HP_aCC)
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__)
+#elif defined(__IBMCPP__)
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __func__)
+#else
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(0, 0, 0)
+#endif
+
+
+/**
+ * SDORuntimeException - Exception base class.
+ *
+ */
+class SDORuntimeException
+{
+ public:
+ // Constructor
+ SDO_API SDORuntimeException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDORuntimeException");
+
+ SDO_API SDORuntimeException(const SDORuntimeException& c);
+
+ // Destructor
+ SDO_API virtual ~SDORuntimeException();
+
+ /** getEClassName() get the exception class
+ *
+ * returns the name of the exception class, which will be
+ * a subclass of SDORuntimeException
+ */
+
+ SDO_API const char* getEClassName() const;
+
+ /**
+ * Return message text associated with exception
+ */
+
+ SDO_API const char* getMessageText() const;
+
+ /** getFileName() the file where the exception occurred
+ *
+ * Return file name where exception was raised
+ */
+
+ SDO_API const char* getFileName() const;
+
+ /** getLineNumber gives the line where the exception occurred
+ *
+ * Return line number where exception was raised
+ */
+
+ SDO_API unsigned long getLineNumber() const;
+
+ /** getFunctionName give the name of the raising function
+ *
+ * Return function name where exception was raised
+ */
+
+ SDO_API const char* getFunctionName() const;
+
+ private:
+ const char* class_name;
+ char* message_text; // Description of exception
+ SDOExceptionInfo info;
+}; // End SDORuntimeException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOOutOfMemoryException - Exception for no-storage
+ *
+ * ***************************************************************************
+ */
+
+class SDOOutOfMemoryException: public SDORuntimeException
+{
+ public:
+ SDOOutOfMemoryException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOOutOfMemoryException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOOutOfMemory class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDONullPointerException - Exception for no-storage
+ *
+ * ***************************************************************************
+ */
+
+class SDONullPointerException: public SDORuntimeException
+{
+ public:
+ SDONullPointerException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDONullPointerException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOOutOfMemory class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOPathNotFoundException - Exception for bad path
+ *
+ ****************************************************************************
+ */
+class SDOPathNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOPathNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOPathNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOPathNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOPropertyNotFoundException - Exception for property not found
+ *
+ ****************************************************************************
+ */
+
+class SDOPropertyNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOPropertyNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOPropertyNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOPropertyNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOTypeNotFoundException - Exception for type not found.
+ *
+ ****************************************************************************
+ */
+class SDOTypeNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOTypeNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOTypeNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOFileNotFoundException - Exception for file not found
+ *
+ ****************************************************************************
+ */
+
+class SDOFileNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOFileNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOFileNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+ private:
+}; // End SDOFileNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOPropertyNotSetException - Exception for asking for the value of an
+ * unset/undefaulted prop
+ *
+ ****************************************************************************
+ */
+class SDOPropertyNotSetException: public SDORuntimeException
+{
+ public:
+ SDOPropertyNotSetException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOPropertyNotSetException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOPropertyNotSetException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOUnsupportedOperationException - Invalid action or unimplemented method.
+ *
+ ****************************************************************************
+ */
+class SDOUnsupportedOperationException: public SDORuntimeException
+{
+ public:
+ SDOUnsupportedOperationException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOUnsupportedOperationException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOInvalidConversionException - Invalid conversion - cannot convert to type.
+ *
+ ****************************************************************************
+ */
+class SDOInvalidConversionException: public SDORuntimeException
+{
+ public:
+ SDOInvalidConversionException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOInvalidConversionException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOIllegalArgumentException - Invalid argument passed (null name?).
+ *
+ ****************************************************************************
+ */
+class SDOIllegalArgumentException: public SDORuntimeException
+{
+ public:
+ SDOIllegalArgumentException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOIllegalArgumentException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ****************************************************************************
+ *
+ * SDOIndexOutOfRangeException - element index not in a list.
+ *
+ ****************************************************************************
+ */
+class SDOIndexOutOfRangeException: public SDORuntimeException
+{
+ public:
+ SDOIndexOutOfRangeException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOIndexOutOfRangeException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOXMLParserException - XMLParser error
+ *
+ ****************************************************************************
+ */
+class SDOXMLParserException: public SDORuntimeException
+{
+ public:
+ SDOXMLParserException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOXMLParserException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+} // end namespace sdo
+} // end namespace commonj
+
+SDO_API std::ostream& operator<<(std::ostream& os,
+ const commonj::sdo::SDORuntimeException& except);
+
+#endif
+
+