4 * Created on: Oct 31, 2010
20 std::string W1Store::location = "/tmp/";
23 // TODO Auto-generated constructor stub
27 // TODO Auto-generated destructor stub
30 void W1Store::set_location(string location_param) {
31 location = location_param;
34 void W1Store::store(std::string device_id, std::list<std::string> string_list) {
36 string file_path = location + device_id + ".txt";
38 ofstream data_file(file_path.c_str(), ios::app);
40 cout << "storing to " << file_path << ", data size " << string_list.size() << endl;
41 // TODO: add mutex to protect string_list while it's read and emptied
42 if (data_file.is_open()) {
43 while(string_list.size() > 0) {
44 text_line = string_list.front();
45 string_list.pop_front();
46 if (text_line.length() > 0) {
47 cout << "storing line: " << text_line << endl;
48 data_file << text_line << endl;
54 cout << "could not open file " << file_path << " for writing data." << endl;