Skip to content

Commit c0a713e

Browse files
author
mikejiang
committed
1 parent 004ef0c commit c0a713e

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

inst/include/cytolib/GatingHierarchy.hpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ struct OurVertexPropertyWriterR {
8989

9090
class GatingHierarchy{
9191
private:
92+
unsigned short g_loglevel;// debug print is turned off by default
93+
9294
compensation comp; /*< compensation object */
9395

9496
/* compensation is currently done in R due to the linear Algebra
@@ -104,7 +106,7 @@ class GatingHierarchy{
104106

105107
public:
106108

107-
109+
void set_loglevel(unsigned short _g_loglevel){g_loglevel = _g_loglevel;};
108110

109111
/**
110112
* load the in-memory copy of frm
@@ -338,7 +340,7 @@ class GatingHierarchy{
338340
* , customized copy and assignment constructor is required
339341
*
340342
*/
341-
GatingHierarchy(const GatingHierarchy & _gh)
343+
GatingHierarchy(const GatingHierarchy & _gh):g_loglevel(NO_LOG)
342344
{
343345
comp = _gh.comp;
344346

@@ -365,8 +367,8 @@ class GatingHierarchy{
365367
* GatingHierarchy *curGh=new GatingHierarchy();
366368
* \endcode
367369
*/
368-
GatingHierarchy(){}
369-
GatingHierarchy(compensation _comp, PARAM_VEC _transFlag, trans_local _trans):comp(_comp), transFlag(_transFlag),trans(_trans) {};
370+
GatingHierarchy():g_loglevel(NO_LOG){}
371+
GatingHierarchy(compensation _comp, PARAM_VEC _transFlag, trans_local _trans):g_loglevel(NO_LOG),comp(_comp), transFlag(_transFlag),trans(_trans) {};
370372
void convertToPb(pb::GatingHierarchy & gh_pb){
371373
pb::populationTree * ptree = gh_pb.mutable_tree();
372374
/*
@@ -402,7 +404,7 @@ class GatingHierarchy{
402404

403405
}
404406

405-
GatingHierarchy(pb::GatingHierarchy & pb_gh, map<intptr_t, transformation *> & trans_tbl){
407+
GatingHierarchy(pb::GatingHierarchy & pb_gh, map<intptr_t, transformation *> & trans_tbl):g_loglevel(NO_LOG){
406408
const pb::populationTree & tree_pb = pb_gh.tree();
407409
int nNodes = tree_pb.node_size();
408410

inst/include/cytolib/GatingSet.hpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ using namespace std;
3131
*
3232
*/
3333
class GatingSet{
34+
unsigned short g_loglevel;// debug print is turned off by default
3435

3536
biexpTrans globalBiExpTrans; //default bi-exponential transformation functions
3637
linTrans globalLinTrans;
@@ -52,6 +53,13 @@ class GatingSet{
5253
return ghs.find(sampleName);
5354
}
5455
size_t erase ( const string& k ){return ghs.erase(k);}
56+
57+
void set_loglevel(unsigned short _g_loglevel){
58+
g_loglevel = _g_loglevel;
59+
for(auto & it :ghs)
60+
it.second.set_loglevel(_g_loglevel);
61+
};
62+
unsigned short get_loglevel(){return g_loglevel;};
5563
/**
5664
* insert
5765
* @param sampleName
@@ -122,7 +130,7 @@ class GatingSet{
122130

123131
}
124132

125-
GatingSet(){};
133+
GatingSet():g_loglevel(NO_LOG){};
126134

127135
/**
128136
* separate filename from dir to avoid to deal with path parsing in c++
@@ -204,7 +212,7 @@ class GatingSet{
204212
* @param format
205213
* @param isPB
206214
*/
207-
GatingSet(string filename)
215+
GatingSet(string filename):g_loglevel(NO_LOG)
208216
{
209217
GOOGLE_PROTOBUF_VERIFY_VERSION;
210218
ifstream input(filename.c_str(), ios::in | ios::binary);
@@ -423,7 +431,7 @@ class GatingSet{
423431
* compensation and transformation,more options can be allowed in future like providing different
424432
* comp and trans
425433
*/
426-
GatingSet(const GatingHierarchy & gh_template,vector<string> sampleNames){
434+
GatingSet(const GatingHierarchy & gh_template,vector<string> sampleNames):g_loglevel(NO_LOG){
427435

428436

429437

@@ -458,7 +466,7 @@ class GatingSet{
458466
}
459467
}
460468

461-
GatingSet(vector<string> sampleNames){
469+
GatingSet(vector<string> sampleNames):g_loglevel(NO_LOG){
462470
vector<string>::iterator it;
463471
for(it=sampleNames.begin();it!=sampleNames.end();it++)
464472
{

inst/include/cytolib/global.hpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
#ifndef GLOBAL_HPP_
99
#define GLOBAL_HPP_
1010

11-
#define GATING_SET_LEVEL 1
12-
#define GATING_HIERARCHY_LEVEL 2
13-
#define POPULATION_LEVEL 3
14-
#define GATE_LEVEL 4
15-
16-
extern unsigned short g_loglevel;
17-
extern bool my_throw_on_error;
11+
enum loglevel_t{
12+
NO_LOG = 0,
13+
GATING_SET_LEVEL = 1,
14+
GATING_HIERARCHY_LEVEL = 2,
15+
POPULATION_LEVEL = 3,
16+
GATE_LEVEL = 4
17+
};
1818

1919
#ifdef ROUT
2020
#include <R_ext/Print.h>
@@ -27,8 +27,6 @@ extern bool my_throw_on_error;
2727
#include <vector>
2828
using namespace std;
2929

30-
extern unsigned short g_loglevel;// debug print is turned off by default
31-
extern bool my_throw_on_error;//can be toggle off to get a partially parsed gating tree for debugging purpose
3230

3331
inline void PRINT(string a){
3432
#ifdef ROUT

0 commit comments

Comments
 (0)