- Main Page
- Tutorials
- Functions
- Release Notes
- Examples

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
17 namespace af {
18
19 class AFAPI exception : public std::exception
20 {
21 private:
22 char m_msg[1024];
23 af_err m_err;
24 public:
25 af_err err() { return m_err; }
26 exception();
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 virtual ~exception() throw() {}
31 virtual const char *what() const throw() { return m_msg; }
32 friend inline std::ostream& operator<<(std::ostream &s, const exception &e)
33 { return s << e.what(); }
34 };
35
36 }
37
38 #endif
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 AFAPI void af_get_last_error(char **msg, dim_t *len);
45 AFAPI const char *af_err_to_string(const af_err err);
46
47 #ifdef __cplusplus
48 }
49 #endif
af::exception
Definition: exception.h:19
af
Definition: algorithm.h:14
af_get_last_error
AFAPI void af_get_last_error(char **msg, dim_t *len)
af::exception::operator<<
friend std::ostream & operator<<(std::ostream &s, const exception &e)
Definition: exception.h:32
af::exception::~exception
virtual ~exception()
Definition: exception.h:30
af::exception::err
af_err err()
Definition: exception.h:25
af_err
af_err
Definition: defines.h:67
defines.h
dim_t
long long dim_t
Definition: defines.h:50
AFAPI
#define AFAPI
Definition: defines.h:31
af::exception::what
virtual const char * what() const
Definition: exception.h:31
af_err_to_string
AFAPI const char * af_err_to_string(const af_err err)