Skip to content

Commit

Permalink
#3
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejiang committed Jan 12, 2018
1 parent 004ef0c commit c0a713e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
12 changes: 7 additions & 5 deletions inst/include/cytolib/GatingHierarchy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ struct OurVertexPropertyWriterR {

class GatingHierarchy{
private:
unsigned short g_loglevel;// debug print is turned off by default

compensation comp; /*< compensation object */

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

public:


void set_loglevel(unsigned short _g_loglevel){g_loglevel = _g_loglevel;};

/**
* load the in-memory copy of frm
Expand Down Expand Up @@ -338,7 +340,7 @@ class GatingHierarchy{
* , customized copy and assignment constructor is required
*
*/
GatingHierarchy(const GatingHierarchy & _gh)
GatingHierarchy(const GatingHierarchy & _gh):g_loglevel(NO_LOG)
{
comp = _gh.comp;

Expand All @@ -365,8 +367,8 @@ class GatingHierarchy{
* GatingHierarchy *curGh=new GatingHierarchy();
* \endcode
*/
GatingHierarchy(){}
GatingHierarchy(compensation _comp, PARAM_VEC _transFlag, trans_local _trans):comp(_comp), transFlag(_transFlag),trans(_trans) {};
GatingHierarchy():g_loglevel(NO_LOG){}
GatingHierarchy(compensation _comp, PARAM_VEC _transFlag, trans_local _trans):g_loglevel(NO_LOG),comp(_comp), transFlag(_transFlag),trans(_trans) {};
void convertToPb(pb::GatingHierarchy & gh_pb){
pb::populationTree * ptree = gh_pb.mutable_tree();
/*
Expand Down Expand Up @@ -402,7 +404,7 @@ class GatingHierarchy{

}

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

Expand Down
16 changes: 12 additions & 4 deletions inst/include/cytolib/GatingSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ using namespace std;
*
*/
class GatingSet{
unsigned short g_loglevel;// debug print is turned off by default

biexpTrans globalBiExpTrans; //default bi-exponential transformation functions
linTrans globalLinTrans;
Expand All @@ -52,6 +53,13 @@ class GatingSet{
return ghs.find(sampleName);
}
size_t erase ( const string& k ){return ghs.erase(k);}

void set_loglevel(unsigned short _g_loglevel){
g_loglevel = _g_loglevel;
for(auto & it :ghs)
it.second.set_loglevel(_g_loglevel);
};
unsigned short get_loglevel(){return g_loglevel;};
/**
* insert
* @param sampleName
Expand Down Expand Up @@ -122,7 +130,7 @@ class GatingSet{

}

GatingSet(){};
GatingSet():g_loglevel(NO_LOG){};

/**
* separate filename from dir to avoid to deal with path parsing in c++
Expand Down Expand Up @@ -204,7 +212,7 @@ class GatingSet{
* @param format
* @param isPB
*/
GatingSet(string filename)
GatingSet(string filename):g_loglevel(NO_LOG)
{
GOOGLE_PROTOBUF_VERIFY_VERSION;
ifstream input(filename.c_str(), ios::in | ios::binary);
Expand Down Expand Up @@ -423,7 +431,7 @@ class GatingSet{
* compensation and transformation,more options can be allowed in future like providing different
* comp and trans
*/
GatingSet(const GatingHierarchy & gh_template,vector<string> sampleNames){
GatingSet(const GatingHierarchy & gh_template,vector<string> sampleNames):g_loglevel(NO_LOG){



Expand Down Expand Up @@ -458,7 +466,7 @@ class GatingSet{
}
}

GatingSet(vector<string> sampleNames){
GatingSet(vector<string> sampleNames):g_loglevel(NO_LOG){
vector<string>::iterator it;
for(it=sampleNames.begin();it!=sampleNames.end();it++)
{
Expand Down
16 changes: 7 additions & 9 deletions inst/include/cytolib/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
#ifndef GLOBAL_HPP_
#define GLOBAL_HPP_

#define GATING_SET_LEVEL 1
#define GATING_HIERARCHY_LEVEL 2
#define POPULATION_LEVEL 3
#define GATE_LEVEL 4

extern unsigned short g_loglevel;
extern bool my_throw_on_error;
enum loglevel_t{
NO_LOG = 0,
GATING_SET_LEVEL = 1,
GATING_HIERARCHY_LEVEL = 2,
POPULATION_LEVEL = 3,
GATE_LEVEL = 4
};

#ifdef ROUT
#include <R_ext/Print.h>
Expand All @@ -27,8 +27,6 @@ extern bool my_throw_on_error;
#include <vector>
using namespace std;

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

inline void PRINT(string a){
#ifdef ROUT
Expand Down

0 comments on commit c0a713e

Please sign in to comment.