RInside Version 0.2.16
RInsideCommon.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 //
3 // RInsideCommon.h: R/C++ interface class library -- Easier R embedding into C++
4 //
5 // Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
6 //
7 // This file is part of RInside.
8 //
9 // RInside is free software: you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // RInside is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with RInside. If not, see <http://www.gnu.org/licenses/>.
21 
22 #ifndef RINSIDE_RINSIDECOMMON_H
23 #define RINSIDE_RINSIDECOMMON_H
24 
25 #include <RInsideConfig.h>
26 
27 #include <sys/time.h> // gettimeofday()
28 #include <sys/types.h> // pid_t
29 #include <unistd.h> // getpid()
30 
31 #include <inttypes.h> // intptr_t (one day we use cinttypes from C++11)
32 #include <stdint.h> // uint64_t (one day we use cstdint from C++11)
33 
34 #include <string>
35 #include <vector>
36 #include <iostream>
37 
38 #include <Rcpp.h>
39 
40 #ifdef WIN32
41  #ifndef Win32
42  // needed for parts of Rembedded.h
43  #define Win32
44  #endif
45 #endif
46 
47 #ifndef WIN32
48  // needed to turn-off stack checking, and we already have uintptr_t
49  #define CSTACK_DEFNS
50  #ifndef HAVE_UINTPTR_T
51  #define HAVE_UINTPTR_T
52  #endif
53 #endif
54 
55 #include <Rembedded.h>
56 #include <R_ext/RStartup.h>
57 
58 #include <MemBuf.h>
59 
60 // simple logging help
61 inline void logTxtFunction(const char* file, const int line, const char* expression, const bool verbose) {
62  if (verbose) {
63  std::cout << file << ":" << line << " expression: " << expression << std::endl;
64  }
65 }
66 
67 #ifdef logTxt
68 #undef logTxt
69 #endif
70 //#define logTxt(x, b) logTxtFunction(__FILE__, __LINE__, x, b);
71 #define logTxt(x, b)
72 
73 #endif
void logTxtFunction(const char *file, const int line, const char *expression, const bool verbose)
Definition: RInsideCommon.h:61
bool verbose