Commit 1513d605 authored by Martin Marinov's avatar Martin Marinov
Browse files

Added a file missed @ change 13023.

[git-p4: depot-paths = "//ReForm/ReForm/main/Base/": change = 13024]
parent 0980f220
// (C) Copyright 2015 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary
// to Autodesk, Inc., and considered a trade secret as defined
// in section 499C of the penal code of the State of California.
// Use of this information by anyone other than authorized
// employees of Autodesk, Inc. is granted only under a written
// non-disclosure agreement, expressly prescribing the scope
// and manner of such use.
#ifndef BASE_THROWINFO_HH_INCLUDED
#define BASE_THROWINFO_HH_INCLUDED
// Define the relevant macros to throw
#ifdef DEB_ON
namespace Debug {
class Stream;
//! Basic class to define auxiliary debug info about a throw event
class ThrowInfo
{
public:
ThrowInfo(const char* _modl, const char* _file, const int _line,
const char* _fnct)
: modl_(_modl), file_(_file), line_(_line), fnct_(_fnct)
{}
friend Stream& operator<<(Stream& _ds, const ThrowInfo& _thrw_info);
private:
const char* modl_;
const char* file_;
int line_;
const char* fnct_;
};
//! Extend a generic (code-based) Error exception with ThrowInfo
template <class ErrorT>
struct ErrorExtT : public ErrorT, public ThrowInfo
{
ErrorExtT(const typename ErrorT::Index _err_idx, const ThrowInfo& _thrw_info)
: ErrorT(_err_idx), ThrowInfo(_thrw_info)
{}
};
}//namespace Debug
#define THROW_ERROR_MODULE(MODULE, INDEX) { \
throw Debug::ErrorExtT<MODULE::Error>(MODULE::Error::INDEX, \
Debug::ThrowInfo(#MODULE, __FILE__, __LINE__, __FUNCTION__)); }
#define THROW_ERROR_DEB_MODULE(MODULE, INDEX, EXPR) { \
DEB_error(EXPR); \
throw Debug::ErrorExtT<MODULE::Error>(MODULE::Error::INDEX, \
Debug::ThrowInfo(#MODULE, __FILE__, __LINE__, __FUNCTION__)); }
#else// DEB_ON
#define THROW_ERROR_MODULE(MODULE, INDEX) \
{ throw MODULE::Error(MODULE::Error::INDEX); }
#define THROW_ERROR_DEB_MODULE(MODULE, EXPR) THROW_ERROR_MODULE(MODULE, TODO)
#endif// DEB_ON
#define THROW_ERROR_TODO_MODULE(MODULE, EXPR) \
THROW_ERROR_DEB_MODULE(MODULE, TODO, EXPR)
#endif//BASE_THROWINFO_HH_INCLUDED
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment