My Project
exception.h
Go to the documentation of this file.
1/*******************************************************
2 * Copyright (c) 2014, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10#pragma once
11
12#ifdef __cplusplus
13
14#include <iostream>
15#include <af/defines.h>
16
17namespace af {
18
19class AFAPI exception : public std::exception
20{
21private:
22 char m_msg[1024];
23 af_err m_err;
24public:
25 af_err err() { return m_err; }
27 exception(const char *msg);
28 exception(const char *file, unsigned line, af_err err);
29 exception(const char *msg, const char *file, unsigned line, af_err err);
30#if AF_API_VERSION >= 33
31 exception(const char *msg, const char *func, const char *file, unsigned line, af_err err);
32#endif
33 virtual ~exception() throw() {}
34 virtual const char *what() const throw() { return m_msg; }
35 friend inline std::ostream& operator<<(std::ostream &s, const exception &e)
36 { return s << e.what(); }
37};
38
39}
40
41#endif
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47AFAPI void af_get_last_error(char **msg, dim_t *len);
48AFAPI const char *af_err_to_string(const af_err err);
49
50#ifdef __cplusplus
51}
52#endif
Definition exception.h:20
af_err err()
Definition exception.h:25
exception(const char *msg, const char *file, unsigned line, af_err err)
virtual ~exception()
Definition exception.h:33
exception(const char *msg, const char *func, const char *file, unsigned line, af_err err)
virtual const char * what() const
Definition exception.h:34
exception(const char *msg)
exception(const char *file, unsigned line, af_err err)
friend std::ostream & operator<<(std::ostream &s, const exception &e)
Definition exception.h:35
long long dim_t
Definition defines.h:50
af_err
Definition defines.h:63
#define AFAPI
Definition defines.h:31
AFAPI void af_get_last_error(char **msg, dim_t *len)
AFAPI const char * af_err_to_string(const af_err err)
Definition algorithm.h:15