]> pilppa.org Git - lib1wire.git/blobdiff - src/Store.cc
Moved files that were not w1 specific to libplp.
[lib1wire.git] / src / Store.cc
diff --git a/src/Store.cc b/src/Store.cc
deleted file mode 100644 (file)
index ff85260..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Store.cc
- *
- *  Created on: Jan 20, 2011
- *      Author: lamikr
- */
-#include <fstream>
-
-#include "Store.hh"
-
-#include <plp/log.h>
-
-using namespace std;
-using namespace plp;
-
-Store::Store(string device_id_param,
-               Date *date_param) {
-       device_id       = device_id_param;
-       if (date_param != NULL) {
-               date            = date_param->clone();
-       }
-       else {
-               date    = NULL;
-       }
-       store_data      = NULL;
-       range_data      = NULL;
-}
-
-Store::~Store() {
-       if (store_data != NULL) {
-               delete(store_data);
-               store_data      = NULL;
-       }
-       if (date != NULL) {
-               delete(date);
-       }
-}
-
-bool Store::load(string fname_param) {
-       Data            *data;
-       ifstream        in;
-       string          data_str;
-       bool            ret_val;
-
-       ret_val = false;
-       if (store_data != NULL) {
-               delete(store_data);
-               store_data      = NULL;
-       }
-       if (access(fname_param.c_str(), R_OK) == 0) {
-               //log_debug("opening file: %s\n", fname_param.c_str());
-               in.open(fname_param.c_str());
-               if (in.is_open() == true) {
-                       while (in.eof() == false) {
-                               getline(in, data_str);
-                               if (data_str.empty() == false) {
-                                       data    = Data::parse_string(data_str);
-                                       if (data != NULL) {
-                                               if (store_data == NULL) {
-                                                       store_data      = new DataRange(data);
-                                               }
-                                               else {
-                                                       store_data->add(data);
-                                               }
-                                               delete(data);
-                                       }
-                               }
-                       }
-                       ret_val = true;
-               }
-               else {
-                       log_error("Could not open data file: %s\n", fname_param.c_str());
-               }
-       }
-       else {
-               log_error("Could not find file: %s\n", fname_param.c_str());
-       }
-       return ret_val;
-}