RInside Version 0.2.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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  #define HAVE_UINTPTR_T
51 #endif
52 
53 #include <Rembedded.h>
54 #ifndef WIN32
55  #define R_INTERFACE_PTRS
56  #include <Rinterface.h>
57 #endif
58 #include <R_ext/RStartup.h>
59 
60 #include <MemBuf.h>
61 
62 // simple logging help
63 inline void logTxtFunction(const char* file, const int line, const char* expression, const bool verbose) {
64  if (verbose) {
65  std::cout << file << ":" << line << " expression: " << expression << std::endl;
66  }
67 }
68 
69 #ifdef logTxt
70 #undef logTxt
71 #endif
72 //#define logTxt(x, b) logTxtFunction(__FILE__, __LINE__, x, b);
73 #define logTxt(x, b)
74 
75 #endif
void logTxtFunction(const char *file, const int line, const char *expression, const bool verbose)
Definition: RInsideCommon.h:63
bool verbose