This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ################################################################################ | |
| * BEGIN UTILITY FUNCTIONS | |
| ################################################################################ */ | |
| #define NONEMPTY_(_FRAME_) \ | |
| CHAR(PRINTNAME(TAG(_FRAME_)))[0] != '.' && CAR(_FRAME_) != R_UnboundValue | |
| static int FrameSize(SEXP frame, int all) | |
| { | |
| int count = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SEXP call_function(SEXP call, SEXP rho){ | |
| /* advance to 2nd element (CAR) of call pairlist; 1st element is just the call_function function */ | |
| SEXP args = CDR(call); | |
| /* get function (2rd element) and advance to 3th element */ | |
| SEXP funSymbol = install("FUN"); | |
| args = CDR(args); | |
| /* make the function call */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| class CSingleton final | |
| { | |
| public: | |
| static CSingleton* GetInstance(); | |
| void set_x(const int& x_){x = x_;}; | |
| int get_x(){return x;}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Rcpp.h> | |
| #include <math.h> | |
| #include <iostream> | |
| using namespace Rcpp; | |
| /* Convert degrees to radians */ | |
| inline double deg2rad(const double& deg){return deg*M_PI/180;}; | |
| /* Earth mean radius [km] */ | |
| const static double R_earth = 6371; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // human.hpp | |
| #ifndef human_hpp | |
| #define human_hpp | |
| #include <stdio.h> | |
| #include <string> | |
| #include <iostream> | |
| class human { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <fstream> | |
| #include <string> | |
| #include <iostream> | |
| /* singleton for logging */ | |
| class logger { | |
| private: | |
| std::ofstream output; | |
| static logger* l_instance; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <memory> | |
| #include <utility> | |
| #include <string> | |
| #include <vector> | |
| class human; | |
| typedef std::unique_ptr<human> human_ptr; | |
| typedef std::vector<human_ptr> human_vector; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef test_rng_hpp | |
| #define test_rng_hpp | |
| #include <random> | |
| #include <stdio.h> | |
| class rng_test { | |
| public: | |
| rng_test(const uint_least32_t &seed) : rng(seed) { | |
| runif = std::uniform_real_distribution<double>(0,1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <memory.h> | |
| #include <utility> | |
| #include <vector> | |
| class human; | |
| typedef std::unique_ptr<human> human_ptr; | |
| typedef std::vector<human_ptr> humans_obj; | |
| class human { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| class GlobalClass | |
| { | |
| int m_value; | |
| static GlobalClass *s_instance; | |
| GlobalClass(int v = 0){ | |
| std::cout << "global singleton being born at " << this << std::endl; | |
| m_value = v; | |
| }; |