All Classes Namespaces Files Functions Variables Enumerations Enumerator
programs/ScipPlayer/ScipDataReader.cpp
Go to the documentation of this file.
00001 
00010 #include "ScipDataReader.h"
00011 #include <fstream>
00012 
00013 using namespace std;
00014 
00015 
00016 struct ScipDataReader::pImpl
00017 {
00018   string log_file_;
00019   ifstream fin_;
00020 
00021 
00022   pImpl(const string& log_file) : log_file_(log_file)
00023   {
00024     fin_.open(log_file_.c_str());
00025   }
00026 };
00027 
00028 
00029 ScipDataReader::ScipDataReader(const string& log_file)
00030   : pimpl(new pImpl(log_file))
00031 {
00032 }
00033 
00034 
00035 ScipDataReader::~ScipDataReader(void)
00036 {
00037 }
00038 
00039 
00040 bool ScipDataReader::isEmpty(void)
00041 {
00042   if (! pimpl->fin_.is_open()) {
00043     return true;
00044   }
00045   return (pimpl->fin_.eof()) ? true : false;
00046 }
00047 
00048 
00049 bool ScipDataReader::readReplyLines(vector<string>& line_block)
00050 {
00051   line_block.clear();
00052   string line;
00053   while (getline(pimpl->fin_, line) && (! line.empty())) {
00054     //fprintf(stderr, "%s\n", line.c_str());
00055     line_block.push_back(line);
00056   }
00057 
00058   return (! line_block.empty());
00059 }