Orthogonal Array Library  1.0.0
Libray for generating orthogonal arrays based on Art Owen's oa library
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
OACommonDefines.h
Go to the documentation of this file.
1 
25 #ifndef OACOMMONDEFINES_H
26 #define OACOMMONDEFINES_H
27 
28 #include <exception>
29 #include <string>
30 #include <vector>
31 #include <cstdio>
32 #include <cmath>
33 #include <cstdlib>
34 #include <algorithm>
35 #include <stdexcept>
36 #include <sstream>
37 #include <iostream>
38 #include <numeric>
39 #include "RWarningException.h"
40 
41 #ifdef RCOMPILE
42 #include <Rcpp.h>
46 #define PRINT_OUTPUT Rcpp::Rcout
47 
50 #define PRINT_WARNINGS false
51 #else
52 
55 #define PRINT_OUTPUT std::cout
56 
59 #define PRINT_WARNINGS true
60 #endif
61 
65 #ifndef NDEBUG
66 #ifndef RANGE_DEBUG
67 #define RANGE_DEBUG
68 #endif
69 #endif
70 
74 #define SUCCESS_CHECK 1
75 
78 #define FAILURE_CHECK 0
79 
82 #define UNCHECKED_RETURN 0
83 
87 namespace oacpp {
93  inline void ostringstream_runtime_error(const std::ostringstream & msg)
94  {
95  const std::string smsg = msg.str();
96  throw std::runtime_error(smsg.c_str());
97  }
98 
104  inline void ostringstream_warning(const std::ostringstream & msg)
105  {
106  const std::string smsg = msg.str();
107 
108  if (PRINT_WARNINGS)
109  {
110  PRINT_OUTPUT << smsg.c_str();
111  }
112  else
113  {
114  throw bclib::RWarningException(smsg);
115  }
116  }
117 }
118 
388 #endif /* OACOMMONDEFINES_H */
PRINT_OUTPUT
#define PRINT_OUTPUT
A print macro to enable printing with or without R.
Definition: OACommonDefines.h:55
oacpp::ostringstream_runtime_error
void ostringstream_runtime_error(const std::ostringstream &msg)
throw a runtime_error with a stringstream message
Definition: OACommonDefines.h:93
oacpp
Orthogonal Array Namespace.
Definition: ak.h:39
PRINT_WARNINGS
#define PRINT_WARNINGS
A macro to determine if warnings are printed or thrown as runtime_error.
Definition: OACommonDefines.h:59
oacpp::ostringstream_warning
void ostringstream_warning(const std::ostringstream &msg)
throw a warning with a streamstring message
Definition: OACommonDefines.h:104