diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
commit | 99aa8c60282c7b8072eb35eb9ac815702f5bf586 (patch) | |
tree | bda96bf8c3a4c2875a083d7b16720533c8ffeaf4 /ACE/contrib/utility/Utility/ExH | |
parent | c4078c377d74290ebe4e66da0b4975da91732376 (diff) | |
download | ATCD-99aa8c60282c7b8072eb35eb9ac815702f5bf586.tar.gz |
undoing accidental deletion
Diffstat (limited to 'ACE/contrib/utility/Utility/ExH')
16 files changed, 696 insertions, 0 deletions
diff --git a/ACE/contrib/utility/Utility/ExH/Compound.hpp b/ACE/contrib/utility/Utility/ExH/Compound.hpp new file mode 100644 index 00000000000..c21f5013853 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Compound.hpp @@ -0,0 +1,49 @@ +// file : Utility/ExH/Compound.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_COMPOUND_HPP +#define UTILITY_EX_H_COMPOUND_HPP + +#include <string> + +namespace Utility +{ + namespace ExH + { + template <typename Type, typename _Base> + class Compound : public virtual _Base + { + public: + typedef _Base Base; + + explicit + Compound (char const* description) throw (); + + explicit + Compound (std::string const& description) throw (); + + template <typename T> + explicit + Compound (T const& description) throw (); + + Compound (Compound const& src) throw (); + + virtual + ~Compound () throw (); + + public: + Compound& + operator= (Compound const& src) throw (); + + protected: + Compound () throw (); + }; + } +} + +#include "Utility/ExH/Compound.tpp" + +#endif // UTILITY_EX_H_COMPOUND_HPP +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Compound.tpp b/ACE/contrib/utility/Utility/ExH/Compound.tpp new file mode 100644 index 00000000000..08c9f8194a9 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Compound.tpp @@ -0,0 +1,74 @@ +// file : Utility/ExH/Compound.tpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#include "Utility/ExH/Converter.hpp" + +namespace Utility +{ + namespace ExH + { + // c-tor's & d-tor + template <typename Type, typename Base> + Compound<Type, Base>:: + Compound () throw () + { + } + + template <typename Type, typename Base> + Compound<Type, Base>:: + Compound (char const* description) throw () + { + Base::init (description); + } + + template <typename Type, typename Base> + Compound<Type, Base>:: + Compound (std::string const& description) throw () + { + try + { + Base::init (description.c_str ()); + } + catch (...) + { + } + } + + template <typename Type, typename Base> + template <typename T> + Compound<Type, Base>:: + Compound (T const& description) throw () + { + Base::init (converter<T> (description).c_str ()); + } + + template <typename Type, typename Base> + Compound<Type, Base>:: + Compound (Compound const& src) throw () + : Base::Base::Base (), + Base::Base (), + Base () + { + Base::init (src.what ()); + } + + template <typename Type, typename Base> + Compound<Type, Base>:: + ~Compound () throw () + { + } + + // operator= + + template <typename Type, typename Base> + Compound<Type, Base>& Compound<Type, Base>:: + operator= (Compound const& src) throw () + { + Base::init (src.what ()); + return *this; + } + } +} +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Converter.hpp b/ACE/contrib/utility/Utility/ExH/Converter.hpp new file mode 100644 index 00000000000..563114fd1c4 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Converter.hpp @@ -0,0 +1,24 @@ +// file : Utility/ExH/Converter.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_CONVERTER_HPP +#define UTILITY_EX_H_CONVERTER_HPP + +#include <string> + +namespace Utility +{ + namespace ExH + { + template <typename T> + std::string + converter (T const& t); + } +} + +#include "Utility/ExH/Converter.tpp" + +#endif // UTILITY_EX_H_CONVERTER_HPP +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Converter.tpp b/ACE/contrib/utility/Utility/ExH/Converter.tpp new file mode 100644 index 00000000000..2d48015fe80 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Converter.tpp @@ -0,0 +1,19 @@ +// file : Utility/ExH/Converter.tpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +namespace Utility +{ + namespace ExH + { + template <typename T> + std::string + converter (T const& t) + { + // Default implementation just assumes that implicit converion exist. + return t; + } + } +} +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/ExH.hpp b/ACE/contrib/utility/Utility/ExH/ExH.hpp new file mode 100644 index 00000000000..722ecd02d25 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/ExH.hpp @@ -0,0 +1,22 @@ +// file : Utility/ExH/ExH.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_EX_H_HPP +#define UTILITY_EX_H_EX_H_HPP + +#include "Utility/ExH/System/Exception.hpp" +#include "Utility/ExH/System/DescriptiveException.hpp" + +#include "Utility/ExH/Logic/Exception.hpp" +#include "Utility/ExH/Logic/DescriptiveException.hpp" + +#include "Utility/ExH/Compound.hpp" + +#include "Utility/ExH/Converter.hpp" +#include "Utility/ExH/StringStreamConverter.hpp" + +#endif // UTILITY_EX_H_EX_H_HPP + +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp new file mode 100644 index 00000000000..160ad74182d --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp @@ -0,0 +1,65 @@ +// file : Utility/ExH/Logic/DescriptiveException.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP +#define UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP + +#include <memory> +#include <string> + + +#include "Utility/ExH/Logic/Exception.hpp" + +namespace Utility +{ + namespace ExH + { + namespace Logic + { + class DescriptiveException : public virtual Exception + { + public: + typedef Exception Base; + + explicit + DescriptiveException (char const* description) throw (); + + explicit + DescriptiveException (std::string const& description) throw (); + + template <typename T> + explicit + DescriptiveException (T const& description) throw (); + + DescriptiveException (DescriptiveException const& src) throw (); + + virtual + ~DescriptiveException () throw (); + + DescriptiveException& + operator= (DescriptiveException const& src) throw (); + + protected: + DescriptiveException () throw (); + + void + init (char const* description) throw (); + + public: + virtual char const* + what () const throw (); + + private: + std::auto_ptr<std::string> description_; + }; + } + } +} + +#include "Utility/ExH/Logic/DescriptiveException.ipp" +#include "Utility/ExH/Logic/DescriptiveException.tpp" + +#endif // UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp new file mode 100644 index 00000000000..0e2fc1e8916 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp @@ -0,0 +1,106 @@ +// file : Utility/ExH/Logic/DescriptiveException.ipp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +namespace Utility +{ + namespace ExH + { + namespace Logic + { + // c-tor's & d-tor + + inline DescriptiveException:: + DescriptiveException () throw () + { + } + + inline DescriptiveException:: + DescriptiveException (char const* description) throw () + { + init (description); + } + + inline DescriptiveException:: + DescriptiveException (std::string const& description) throw () + { + try + { + init (description.c_str ()); + } + catch (...) + { + } + } + + inline DescriptiveException:: + DescriptiveException (DescriptiveException const& src) throw () + : std::exception (), + Exception () + { + init (src.what ()); + } + + inline DescriptiveException:: + ~DescriptiveException () throw () + { + } + + inline DescriptiveException& DescriptiveException:: + operator= (DescriptiveException const& src) throw () + { + init (src.what ()); + return *this; + } + + + // accessors / modifiers + + inline void + DescriptiveException::init (char const* description) throw () + { + try + { + if (description == 0 || description[0] == '\0') + { + description_.reset (0); + } + else + { + if (description_.get () != 0) + { + *description_ = description; + } + else + { + description_.reset (new std::string (description)); + } + } + } + catch (...) + { + description_.reset (0); + } + } + + inline char const* + DescriptiveException::what () const throw () + { + try + { + if (description_.get () != 0) + { + return description_->c_str (); + } + } + catch (...) + { + } + + return Exception::what (); + } + } + } +} +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp new file mode 100644 index 00000000000..02c65a67e2b --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp @@ -0,0 +1,23 @@ +// file : Utility/ExH/Logic/DescriptiveException.ipp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#include "Utility/ExH/Converter.hpp" + +namespace Utility +{ + namespace ExH + { + namespace Logic + { + template <typename T> + DescriptiveException:: + DescriptiveException (T const& description) throw () + { + init (converter<T> (description).c_str ()); + } + } + } +} +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp b/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp new file mode 100644 index 00000000000..613945c09b3 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp @@ -0,0 +1,42 @@ +// file : Utility/ExH/Logic/Exception.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_LOGIC_EXCEPTION_HPP +#define UTILITY_EX_H_LOGIC_EXCEPTION_HPP + +#include "Utility/ExH/System/Exception.hpp" + +namespace Utility +{ + namespace ExH + { + namespace Logic + { + + // Logic::Exception inherits from System::Exception for the + // following reason. Semantically for some part of the + // system particular instance of Logic::Exception may seem as + // opaque System::Exception and the only way to handle it would + // be to propagate it further. In other words Logic::Exception + // can be seemlesly "converted" to System::Exception if there is + // no part of the system interested in handling it. + // + + class Exception : public virtual System::Exception + { + public: + typedef System::Exception Base; + + virtual + ~Exception () throw (); + }; + } + } +} + +#include "Utility/ExH/Logic/Exception.ipp" + +#endif // UTILITY_EX_H_LOGIC_EXCEPTION_HPP +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp b/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp new file mode 100644 index 00000000000..d3b774be937 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp @@ -0,0 +1,20 @@ +// file : Utility/ExH/Logic/Exception.ipp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +namespace Utility +{ + namespace ExH + { + namespace Logic + { + inline Exception:: + ~Exception () throw () + { + } + } + } +} + +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp new file mode 100644 index 00000000000..a9a495f22e2 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp @@ -0,0 +1,26 @@ +// file : Utility/ExH/StringStreamConverter.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP +#define UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP + +#include <sstream> + +#include "Utility/ExH/Converter.hpp" + +namespace Utility +{ + namespace ExH + { + template <> + std::string + converter (std::ostringstream const& t); + } +} + +#include "Utility/ExH/StringStreamConverter.ipp" + +#endif // UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp new file mode 100644 index 00000000000..e454ac3f96c --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp @@ -0,0 +1,18 @@ +// file : Utility/ExH/StringStreamConverter.ipp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +namespace Utility +{ + namespace ExH + { + template <> + inline std::string + converter (std::ostringstream const& t) + { + return t.str (); + } + } +} +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp new file mode 100644 index 00000000000..1045d0ee9ae --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp @@ -0,0 +1,65 @@ +// file : Utility/ExH/System/DescriptiveException.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP +#define UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP + +#include <string> +#include "Utility/ExH/System/Exception.hpp" + +namespace Utility +{ + namespace ExH + { + namespace System + { + class DescriptiveException : public virtual Exception + { + public: + typedef Exception Base; + + explicit + DescriptiveException (char const* description) throw (); + + explicit + DescriptiveException (std::string const& description) throw (); + + template <typename T> + explicit + DescriptiveException (T const& description) throw (); + + DescriptiveException (DescriptiveException const& src) throw (); + + virtual + ~DescriptiveException () throw (); + + DescriptiveException& + operator= (DescriptiveException const& src) throw (); + + protected: + DescriptiveException () throw (); + + void + init (char const* description) throw (); + + public: + virtual char const* + what () const throw (); + + private: + + static unsigned long const DESCRIPTION_SIZE = 256; + + char description_ [DESCRIPTION_SIZE]; + }; + } + } +} + +#include "Utility/ExH/System/DescriptiveException.ipp" +#include "Utility/ExH/System/DescriptiveException.tpp" + +#endif // UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp new file mode 100644 index 00000000000..cedaeacc937 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp @@ -0,0 +1,91 @@ +// file : Utility/ExH/System/DescriptiveException.ipp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#include <cstring> + +namespace Utility +{ + namespace ExH + { + namespace System + { + // c-tor's & d-tor + + inline DescriptiveException:: + DescriptiveException () throw () + { + description_[0] = '\0'; + } + + inline DescriptiveException:: + DescriptiveException (char const* description) throw () + { + init (description); + } + + inline DescriptiveException:: + DescriptiveException (std::string const& description) throw () + { + try + { + init (description.c_str ()); + } + catch (...) + { + } + } + + inline DescriptiveException:: + DescriptiveException (DescriptiveException const& src) throw () + : Base () + { + init (src.what ()); + } + + inline DescriptiveException:: + ~DescriptiveException () throw () + { + } + + inline DescriptiveException& DescriptiveException:: + operator= (DescriptiveException const& src) throw () + { + init (src.what ()); + return *this; + } + + + // accessors / modifiers + + inline void DescriptiveException:: + init (char const* description) throw () + { + if (description != 0) + { + std::strncpy (description_, description, DESCRIPTION_SIZE - 1); + description_[DESCRIPTION_SIZE - 1] = '\0'; + } + else + { + description_[0] = '\0'; + } + } + + inline char const* DescriptiveException:: + what () const throw () + { + if (description_[0] != '\0') + { + return description_; + } + else + { + return Exception::what (); + } + } + } + } +} +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp new file mode 100644 index 00000000000..320216acc2e --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp @@ -0,0 +1,23 @@ +// file : Utility/ExH/System/DescriptiveException.ipp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#include "Utility/ExH/Converter.hpp" + +namespace Utility +{ + namespace ExH + { + namespace System + { + template <typename T> + inline DescriptiveException:: + DescriptiveException (T const& description) throw () + { + init (converter<T> (description).c_str ()); + } + } + } +} +//$Id$ diff --git a/ACE/contrib/utility/Utility/ExH/System/Exception.hpp b/ACE/contrib/utility/Utility/ExH/System/Exception.hpp new file mode 100644 index 00000000000..0ed7fbfa975 --- /dev/null +++ b/ACE/contrib/utility/Utility/ExH/System/Exception.hpp @@ -0,0 +1,29 @@ +// file : Utility/ExH/System/Exception.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// copyright : Copyright (c) 2002-2003 Boris Kolpackov +// license : http://kolpackov.net/license.html + +#ifndef UTILITY_EX_H_SYSTEM_EXCEPTION_HPP +#define UTILITY_EX_H_SYSTEM_EXCEPTION_HPP + +#include <exception> + +namespace Utility +{ + namespace ExH + { + namespace System + { + // This is the only way to make predefined exceptions like + // std::bad_alloc, etc to appear in the right place of the hierarchy. + // + + typedef std::exception Exception; + } + } +} + +#endif // UTILITY_EX_H_SYSTEM_EXCEPTION_HPP + + +//$Id$ |