File: img_base.h

package info (click to toggle)
meshlab 1.3.0a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 23,416 kB
  • sloc: cpp: 214,034; ansic: 4,493; makefile: 72
file content (69 lines) | stat: -rwxr-xr-x 1,912 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef IMG_BASE_H_
#define IMG_BASE_H_
/*! \file img_base.h
    \brief basic definitions for the img module

    This header contains the basic module definitions.
*/

/// base of the static assertion mechanism
template<bool> struct NON_TRUE_EXPR_CompileTimeError;
/// partial instantiation for the static assertion mechanism
template<> struct NON_TRUE_EXPR_CompileTimeError<true> {};

/// the static assertion mechanism
#define STATIC_ASSERT(exp) (NON_TRUE_EXPR_CompileTimeError< (exp) >())  

/// base of the static typecheck mechanism
template<typename> struct NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError;
/// partial instantiation for the static typecheck mechanism
template<> struct NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError<float> {};
/// partial instantiation for the static typecheck mechanism
template<> struct NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError<double> {};

/// the static typecheck mechanism
#define STATIC_FLOAT_OR_DOUBLE_TYPECHECK(type) (NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError< type >())

/// define NULL pointer value
#ifndef NULL
 #ifdef __cplusplus
  #define NULL 0
 #else
  #define NULL ((void *)0)
 #endif
#endif

#include <assert.h>
#include <math.h>
#include <exception>
#include <typeinfo>

/*! \brief the img module namespace

  this is the main image module namespace.
*/
namespace img {

/*! \brief the basic exception class

  this is the basic image exception class, it simply carries an error string to the console.
*/
class ImageException: public std::exception
{
public:
  /// the error string
  const char *message;
  /// default constructor
  ImageException():exception(),message("no message"){}
  /*! \brief message carrying constructor

    \param arg_message the error string
  */
  ImageException(const char *arg_message):exception(),message(arg_message){}
  /// the destructor
  virtual ~ImageException () throw (){}
};

} //end namespace img

#endif /*IMG_BASE_H_*/