From cf5e12dad7fc098e2c60dd05a433043f7ce6c6d8 Mon Sep 17 00:00:00 2001 From: Sancar Adali Date: Fri, 1 Sep 2017 22:34:10 -0400 Subject: [PATCH] fix initialization of struct for the parameters --- src/graphm/algorithm.cpp | 10 +++++----- src/graphm/rpc.h | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/graphm/algorithm.cpp b/src/graphm/algorithm.cpp index 71fdc6d..57d3fdc 100644 --- a/src/graphm/algorithm.cpp +++ b/src/graphm/algorithm.cpp @@ -100,8 +100,8 @@ double algorithm::graph_dist(graph &g,graph &h,gsl_matrix* gm_P,char cscore_matr parameter pdebug_f = get_param("debugprint_file"); pdebug.strvalue=pdebug_f.strvalue; bool print_debug = false; - if ((pdebug.ivalue != NULL) && (pdebug.ivalue)) - print_debug = 1; + if ((pdebug.ivalue != -1) && (pdebug.ivalue)) + print_debug = true; long N=g.getN(); gsl_matrix* gm_Ag=g.get_descmatrix(cscore_matrix); gsl_matrix* gm_At=gsl_matrix_alloc(N,N); @@ -126,9 +126,9 @@ double algorithm::graph_dist(graph &g, graph &h,char cscore_matrix){ parameter pdebug = get_param("debugprint"); parameter pdebug_f = get_param("debugprint_file"); pdebug.strvalue=pdebug_f.strvalue; - bool print_debug = 0; - if ((pdebug.ivalue != NULL) && (pdebug.ivalue)) - print_debug = 1; + bool print_debug = false; + if ((pdebug.ivalue != -1) && (pdebug.ivalue)) + print_debug = true; gsl_matrix* gm_Ag=g.get_descmatrix(cscore_matrix); gsl_matrix* gm_Ah=h.get_descmatrix(cscore_matrix); gsl_matrix_sub(gm_Ag,gm_Ah); diff --git a/src/graphm/rpc.h b/src/graphm/rpc.h index 5360786..933bd8f 100644 --- a/src/graphm/rpc.h +++ b/src/graphm/rpc.h @@ -34,6 +34,7 @@ Special root class which support parameter control, setting, reading etc. */ struct parameter { + parameter() : ptype(5), dvalue(-1.0), cvalue(char(0)), ivalue(-1), fvalue(-1.0), strvalue("") {} std::string pname; /*parameter type: 1: double @@ -60,7 +61,7 @@ class rpc{ int set_param(std::string pname,int pvalue); int set_param(std::string pname,float pvalue); int set_param(std::string pname,std::string pvalue); - + int set_param(std::string pname, const char *pvalue); parameter get_param(std::string pname); double get_param_d(std::string pname){parameter p=get_param(pname); return p.dvalue;};