libuav original
Dependents: UAVCAN UAVCAN_Subscriber
MachineIDReader Class Reference
This class can find and read machine ID from a text file, represented as 32-char (16-byte) long hexadecimal string, possibly with separators (like dashes or colons). More...
#include <system_utils.hpp>
Public Member Functions | |
MachineIDReader (const std::vector< std::string > &extra_search_locations={}) | |
This class can use extra seach locations. | |
MachineID | read () const |
Just like readAndGetLocation(), but this one doesn't return location where this ID was obtained from. | |
std::pair< MachineID, std::string > | readAndGetLocation () const |
This function checks available search locations and reads the ID from the first valid location. |
Detailed Description
This class can find and read machine ID from a text file, represented as 32-char (16-byte) long hexadecimal string, possibly with separators (like dashes or colons).
If the available ID is more than 16 bytes, extra bytes will be ignored. A shorter ID will not be accepted as valid. In order to be read, the ID must be located on the first line of the file and must not contain any whitespace characters.
Examples of valid ID: 0123456789abcdef0123456789abcdef 20CE0b1E-8C03-07C8-13EC-00242C491652
Definition at line 32 of file system_utils.hpp.
Constructor & Destructor Documentation
MachineIDReader | ( | ) |
This class can use extra seach locations.
If provided, they will be checked first, before default ones.
Definition at line 108 of file system_utils.hpp.
Member Function Documentation
MachineID read | ( | ) | const |
Just like readAndGetLocation(), but this one doesn't return location where this ID was obtained from.
Definition at line 115 of file system_utils.hpp.
std::pair<MachineID, std::string> readAndGetLocation | ( | ) | const |
This function checks available search locations and reads the ID from the first valid location.
It returns std::pair<> with ID and the file path where it was read from. In case if none of the search locations turned out to be valid, uavcan_linux::Exception will be thrown.
Definition at line 122 of file system_utils.hpp.
Generated on Tue Jul 12 2022 17:17:38 by 1.7.2