6 #include <boost/algorithm/string.hpp> 7 #include <boost/regex.hpp> 8 #include <boost/lexical_cast.hpp> 26 const std::vector<uint64_t>&
28 LinkMap::const_iterator it =
links_.find(i);
29 if ( it ==
links_.end() ) {
37 if (!
file_.is_open()) {
70 std::vector<std::string>
82 using namespace boost;
86 while (
file_.good()) {
106 std::vector< std::vector<uint64_t> > chans( links.size(), std::vector<uint64_t>(data.size()) );
109 for (
size_t i(0);
i<links.size(); ++
i) {
110 for (
size_t j(0); j<data.size(); ++j) {
111 chans[
i][j] = data[j][
i];
116 for (
size_t i(0);
i<links.size(); ++
i) {
117 s.
links_.insert( std::make_pair(links[
i],chans[i]) );
135 while (getline(
file_, line)) {
139 if (line.empty())
continue;
140 if (line[0] ==
'#')
continue;
142 if (boost::regex_match(line, what,
reBoard_)) {
156 std::vector<uint32_t>
161 while (getline(
file_, line)) {
164 if (line.empty())
continue;
165 if (line[0] ==
'#')
continue;
172 if (boost::regex_match(line, what,
reLink_)) {
174 std::vector<std::string> tokens;
179 boost::split(tokens, tmp, boost::is_any_of(
" \t"), boost::token_compress_on);
181 std::vector<uint32_t> links;
182 std::transform(tokens.begin(), tokens.end(), std::back_inserter(links), boost::lexical_cast<uint32_t,
const std::string&>);
185 throw std::logic_error(
"Unexpected line found!");
188 throw std::logic_error(
"No list of links found");
194 if (!boost::regex_match(token, what,
reValid_)) {
195 throw std::logic_error(
"Token '" + token +
"' doesn't match the valid format");
199 value += std::stoul(what[2].
str(),
nullptr, 16);
204 std::vector< std::vector<uint64_t> >
208 std::vector< std::vector<uint64_t> >
data;
209 int place =
file_.tellg();
210 while (getline(
file_, line)) {
212 if (boost::regex_match(line, what,
reBoard_)) {
218 if (boost::regex_match(line, what,
reFrame_)) {
220 uint32_t
n = boost::lexical_cast<uint32_t>(what[1].str());
222 if (n != data.size()) {
223 std::stringstream ss;
224 ss <<
"Frame misalignment! (expected " << data.size() <<
" found " <<
n;
225 throw std::logic_error(ss.str());
227 std::vector<std::string> tokens;
230 boost::split(tokens, tmp, boost::is_any_of(
" \t"), boost::token_compress_on);
232 std::vector<uint64_t> row;
238 place =
file_.tellg();
static boost::regex reBoard_
static boost::regex reFrame_
static void trim(std::string &s)
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_
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
std::vector< uint32_t > searchLinks()
std::string searchBoard()