1 #ifdef STANDALONE_PARSER
20 : mSaleaeDirectory(filename)
23 std::string SaleaeParser::strim(std::string s)
25 if (s.empty())
return s;
27 int p1 = s.length()-1;
28 while (p0 <= p1 && isspace(s.at(p0))) p0++;
29 while (p0 <= p1 && isspace(s.at(p1))) p1--;
30 if (s.at(p0) ==
'"' && s.at(p1) ==
'"' && p1-p0 >= 2)
35 return s.substr(p0,p1-p0+1);
40 auto it = mNextValueMap.begin();
41 if (it == mNextValueMap.end())
return false;
42 uint64_t currT = it->first;
43 DataFileHandle wff = it->second;
44 mNextValueMap.erase(it);
46 wff.callback(wff.obj,currT,wff.value);
53 uint64_t nextT = sdt.
mTime;
54 mNextValueMap.insert(std::pair<uint64_t,DataFileHandle>(nextT,wff));
78 if (path.empty())
return false;
80 if (!datafile->good())
82 std::cerr <<
"Error loading SALEAE datafile <" << datafile->
get_last_error()
83 <<
"> path: <" << path <<
"> net: <" <<
name <<
"> id: " <<
id << std::endl;
87 mNextValueMap.insert(std::pair<uint64_t,DataFileHandle>(0,{callback, datafile, datafile->
get_next_value().mValue, obj}));
uint64_t mTime
Transition time.
bool readError() const
Indicates that there was an error and no data was returned.
std::string get_datafile_path(int index) const
Get full path to waveform data file.
uint64_t get_max_time() const
Getter for maximum time.
bool next_event()
Call to parser to deliver next event via registered callbacks (see above).
bool register_callback(const std::string &name, uint32_t id, std::function< void(void *, uint64_t, int)> callback, void *obj)
Registers callback which gets executed upon next_event()
uint64_t get_max_time() const
Get last simulated time from SALEAE directory.
static uint64_t sTimeScaleFactor
conversion factor to be applied when converting double values from original SALEAE file to integer va...
SaleaeParser(const std::string &filename)