7 #include <boost/algorithm/string.hpp>
8 #include <boost/regex.hpp>
9 #include <boost/foreach.hpp>
10 #include <boost/lexical_cast.hpp>
28 const std::vector<uint64_t>&
30 LinkMap::const_iterator it =
links_.find(i);
31 if ( it ==
links_.end() ) {
39 if (!
file_.is_open()) {
72 std::vector<std::string>
84 using namespace boost;
88 while (
file_.good()) {
108 std::vector< std::vector<uint64_t> > chans( links.size(), std::vector<uint64_t>(data.size()) );
111 for (
size_t i(0);
i<links.size(); ++
i) {
112 for (
size_t j(0);
j<data.size(); ++
j) {
113 chans[
i][
j] = data[
j][
i];
118 for (
size_t i(0);
i<links.size(); ++
i) {
119 s.
links_.insert( std::make_pair(links[
i],chans[i]) );
137 while (getline(
file_, line)) {
141 if (line.empty())
continue;
142 if (line[0] ==
'#')
continue;
144 if (boost::regex_match(line, what,
reBoard_)) {
158 std::vector<uint32_t>
163 while (getline(
file_, line)) {
166 if (line.empty())
continue;
167 if (line[0] ==
'#')
continue;
174 if (boost::regex_match(line, what,
reLink_)) {
176 std::vector<std::string> tokens;
181 boost::split(tokens, tmp, boost::is_any_of(
" \t"), boost::token_compress_on);
183 std::vector<uint32_t>
links;
184 std::transform(tokens.begin(), tokens.end(), std::back_inserter(links), boost::lexical_cast<uint32_t,
const std::string&>);
187 throw std::logic_error(
"Unexpected line found!");
190 throw std::logic_error(
"No list of links found");
196 if (!boost::regex_match(token, what,
reValid_)) {
197 throw std::logic_error(
"Token '" + token +
"' doesn't match the valid format");
201 value += std::stoul(what[2].str(), 0x0, 16);
206 std::vector< std::vector<uint64_t> >
210 std::vector< std::vector<uint64_t> >
data;
211 int place =
file_.tellg();
212 while (getline(
file_, line)) {
214 if (boost::regex_match(line, what,
reBoard_)) {
220 if (boost::regex_match(line, what,
reFrame_)) {
222 uint32_t
n = boost::lexical_cast<uint32_t>(what[1].str());
224 if (n != data.size()) {
225 std::stringstream
ss;
226 ss <<
"Frame misalignment! (expected " << data.size() <<
" found " <<
n;
227 throw std::logic_error(ss.str());
229 std::vector<std::string> tokens;
232 boost::split(tokens, tmp, boost::is_any_of(
" \t"), boost::token_compress_on);
234 std::vector<uint64_t> row;
240 place =
file_.tellg();
static boost::regex reBoard_
static boost::regex reFrame_
const std::string & path() const
source file path
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_
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()