sec = date->sec;
}
-bool Date::before(Date date2) {
+bool Date::before(Date *date2) {
bool ret_val;
+ string s1;
+ string s2;
- string s1 = this->to_sortable_string();
- string s2 = date2.to_sortable_string();
ret_val = false;
- if (s1.compare(s2) < 0) {
- ret_val = true;
+ if (date2 != NULL) {
+ s1 = this->to_sortable_string();
+ s2 = date2->to_sortable_string();
+ if (s1.compare(s2) < 0) {
+ ret_val = true;
+ }
}
return ret_val;
}
-bool Date::equals(Date date2) {
+bool Date::equals(Date *date2) {
bool ret_val;
ret_val = false;
- if ((this->sec == date2.sec) &&
- (this->min == date2.min) &&
- (this->hour == date2.hour) &&
- (this->day == date2.day) &&
- (this->month == date2.month) &&
- (this->year == date2.year)) {
- ret_val = true;
+ if (date2 != NULL) {
+ if ((this->sec == date2->sec) &&
+ (this->min == date2->min) &&
+ (this->hour == date2->hour) &&
+ (this->day == date2->day) &&
+ (this->month == date2->month) &&
+ (this->year == date2->year)) {
+ ret_val = true;
+ }
}
return ret_val;
}
void inc_seconds(int seconds);
Date *clone();
void copy(Date *date);
- bool before(Date date2);
- bool equals(Date date2);
+ bool before(Date *date2);
+ bool equals(Date *date2);
int year;
int month;
int day;
#define DEVICE_CONFIG_VALUE_KEY__NAME "name"
namespace w1 {
- enum enum_summary_calculation {SUM, DELTA, MEAN, MAX, MIN};
+ enum enum_summary_calculation {SUM, DELTA, MIN, MAX, MEAN};
struct ConfigHandle {
public:
case DELTA:
ret_val = store->get_delta();
break;
- case MEAN:
- default:
- ret_val = store->get_mean();
- break;
case MAX:
ret_val = store->get_max();
break;
case MIN:
ret_val = store->get_min();
break;
+ case MEAN:
+ default:
+ ret_val = store->get_mean();
+ break;
}
if (ret_val != NULL) {
ret_val->printout();
ret_val = NULL;
date = start_date->clone();
- while(date->before(*end_date)) {
+ while(date->before(end_date)) {
data = get_daily_summary(date);
if (data != NULL) {
if (ret_val == NULL) {
ret_val = NULL;
date = start_date->clone();
- while(date->before(*end_date)) {
+ while(date->before(end_date)) {
dta_lst = get_hourly_summary(date);
for(iter = dta_lst->begin(); iter != dta_lst->end(); iter++) {
data = (Data *)*iter;
}
else {
date = data->get_date();
- if (date.before(*limit_d)) {
+ if (date.before(limit_d)) {
for (jj = 0; jj < col_count; jj++) {
calc->value_arr[jj] = calc->value_arr[jj] + data->value_arr[jj];
}
}
else {
date = data->get_date();
- if (date.before(*limit_d)) {
+ if (date.before(limit_d)) {
for (jj = 0; jj < col_count; jj++) {
calc->value_arr[jj] = calc->value_arr[jj] + data->value_arr[jj];
}
}
else {
date = data->get_date();
- if (date.before(*limit_d)) {
+ if (date.before(limit_d)) {
if (calc2 != NULL) {
delete(calc2);
}
}
else {
date = data->get_date();
- if (date.before(*limit_d)) {
+ if (date.before(limit_d)) {
if (max == true) {
for (jj = 0; jj < col_count; jj++) {
if (calc->value_arr[jj] < data->value_arr[jj]) {