25 file.open(absPathToDMapFile.c_str());
31 while(std::getline(file, line)) {
33 line.erase(line.begin(), std::find_if(line.begin(), line.end(), [](
int c) { return !isspace(c); }));
48 if(dmap->getSize() == 0) {
55 const std::string& file_name,
const std::string& line, uint32_t line_nr,
const DeviceInfoMapPointer& dmap) {
58 std::string key, value;
61 if(s && (key ==
"@LOAD_LIB")) {
70 const std::string& file_name,
const std::string& line, uint32_t line_nr,
const DeviceInfoMapPointer& dmap) {
71 std::istringstream inStream;
83 dmap->insert(deviceInfo);
86 std::istringstream inStream2;
95 dmap->insert(deviceInfo);
114 std::stringstream errorMessage;
115 errorMessage <<
"Error in dmap file: \"" << file_name <<
"\" in line (" << line_nr <<
") \"" << line <<
"\"";
static void raiseException(const std::string &file_name, const std::string &line, uint32_t line_nr)
static void parseRegularLine(const std::string &file_name, const std::string &line, uint32_t line_nr, const DeviceInfoMapPointer &dmap)
static void parseForLoadLib(const std::string &file_name, const std::string &line, uint32_t line_nr, const DeviceInfoMapPointer &dmap)
static std::string absPathOfDMapContent(const std::string &dmapContent, const std::string &dmapFileName)
static DeviceInfoMapPointer parse(const std::string &file_name)
Performs parsing of specified DMAP file.
Stores information about one device.
std::string uri
uri which describes the device (or name of the device file in /dev in backward compatibility mode)
std::string dmapFileName
name of the DMAP file
std::string mapFileName
name of the MAP file storing information about PCIe registers mapping
uint32_t dmapFileLineNumber
line number in DMAP file storing listed above information
std::string deviceName
logical name of the device
Exception thrown when a logic error has occured.
std::string extractDirectory(std::string const &path)
Returns the path to the directory containing the file provided as the input parameter.
std::string concatenatePaths(const std::string &path1, const std::string &path2)
Concatenates two given paths using custom rules.
std::string convertToAbsolutePath(std::string const &relativePath)
Converts a relative path to its absolute path.
boost::shared_ptr< DeviceInfoMap > DeviceInfoMapPointer
Introduce specialisation of shared_pointer template for pointers to RegisterInfoMap object as a Devic...