4 #include <boost/algorithm/string.hpp>
5 #include <boost/regex.hpp>
6 #include <boost/foreach.hpp>
7 #include <boost/lexical_cast.hpp>
25 const std::vector<uint64_t>&
27 LinkMap::const_iterator it =
links_.find(i);
29 throw std::runtime_error(
"Link id not found");
36 if (!
file_.is_open()) {
56 std::vector<std::string>
68 using namespace boost;
72 while (
file_.good()) {
92 std::vector< std::vector<uint64_t> > chans( links.size(), std::vector<uint64_t>(data.size()) );
95 for (
size_t i(0);
i<links.size(); ++
i) {
96 for (
size_t j(0);
j<data.size(); ++
j) {
97 chans[
i][
j] = data[
j][
i];
102 for (
size_t i(0);
i<links.size(); ++
i) {
103 s.
links_.insert( std::make_pair(links[
i],chans[i]) );
121 while (getline(
file_, line)) {
125 if (line.empty())
continue;
126 if (line[0] ==
'#')
continue;
128 if (boost::regex_match(line, what,
reBoard_)) {
134 throw std::logic_error(
"Unexpected line found!");
137 throw std::logic_error(
"No board found");
141 std::vector<uint32_t>
146 while (getline(
file_, line)) {
149 if (line.empty())
continue;
150 if (line[0] ==
'#')
continue;
157 if (boost::regex_match(line, what,
reLink_)) {
159 std::vector<std::string> tokens;
164 boost::split(tokens, tmp, boost::is_any_of(
" \t"), boost::token_compress_on);
166 std::vector<uint32_t>
links;
167 std::transform(tokens.begin(), tokens.end(), std::back_inserter(links), boost::lexical_cast<uint32_t,
const std::string&>);
170 throw std::logic_error(
"Unexpected line found!");
173 throw std::logic_error(
"No list of links found");
179 if (!boost::regex_match(token, what,
reValid_)) {
180 throw std::logic_error(
"Token '" + token +
"' doesn't match the valid format");
184 value += std::stoul(what[2].str(), 0x0, 16);
189 std::vector< std::vector<uint64_t> >
193 std::vector< std::vector<uint64_t> >
data;
194 int place =
file_.tellg();
195 while (getline(
file_, line)) {
197 if (boost::regex_match(line, what,
reBoard_)) {
203 if (boost::regex_match(line, what,
reFrame_)) {
205 uint32_t
n = boost::lexical_cast<uint32_t>(what[1].str());
207 if (n != data.size()) {
208 std::stringstream
ss;
209 ss <<
"Frame misalignment! (expected " << data.size() <<
" found " <<
n;
210 throw std::logic_error(ss.str());
212 std::vector<std::string> tokens;
215 boost::split(tokens, tmp, boost::is_any_of(
" \t"), boost::token_compress_on);
217 std::vector<uint64_t> row;
223 place =
file_.tellg();
static boost::regex reBoard_
static boost::regex reFrame_
const FileData & get(size_t k) const
data getter via index
std::vector< std::vector< uint64_t > > readRows()
static const uint16_t valid_
static boost::regex reLink_
tuple path
else: Piece not in the list, fine.
MP7FileReader(const std::string &path)
static uint64_t validStrToUint64(const std::string &token)
static boost::regex reQuadChan_
unsigned long long uint64_t
std::vector< FileData > buffers_
const std::string & name() const
std::vector< std::string > names() const
raw data name collector
std::vector< std::vector< double > > tmp
char data[epos_bytes_allocation]
static boost::regex reValid_
const std::vector< uint64_t > & link(uint32_t i) const
volatile std::atomic< bool > shutdown_flag false
std::vector< uint32_t > searchLinks()
std::string searchBoard()