irioCoreCpp Library Module
2.1.0
|
Responsible for managing the parsing of resources for a bitfile. More...
#include <parserManager.h>
Public Member Functions | |
ParserManager (const bfp::BFP &bfp) | |
Constructs a ParserManager object with the given BFP object. More... | |
bool | findRegister (const std::string &resourceName, const GroupResource &group, bfp::Register *reg, const bool optional=false) |
Finds a register with the given resource name. More... | |
bool | findDMA (const std::string &resourceName, const GroupResource &group, bfp::DMA *dma, const bool optional=false) |
Finds a DMA with the given resource name. More... | |
bool | findRegisterAddress (const std::string &resourceName, const GroupResource &group, std::uint32_t *address, const bool optional=false) |
Finds the address of a register with the given resource name. More... | |
bool | findDMANum (const std::string &resourceName, const GroupResource &group, std::uint32_t *address, const bool optional=false) |
Finds the DMA number of a resource with the given name. More... | |
bool | findRegisterEnumAddress (const std::string &resourceName, std::uint32_t nResource, const GroupResource &group, std::unordered_map< std::uint32_t, const std::uint32_t > *mapInsert, const bool optional=false) |
Finds the address of a register with the given resource name. More... | |
bool | findDMAEnumNum (const std::string &resourceName, std::uint32_t nResource, const GroupResource &group, std::unordered_map< std::uint32_t, const std::uint32_t > *mapInsert, const bool optional=false) |
Finds the DMA number of a DMA with the given name, The resource follows an enumeration naming convention. More... | |
void | compareResourcesMap (const std::unordered_map< std::uint32_t, const std::uint32_t > &mapA, const std::string &nameTermA, const std::unordered_map< std::uint32_t, const std::uint32_t > &mapB, const std::string &nameTermB, const GroupResource &group) |
Compares two resource maps and logs any differences. More... | |
void | logResourceError (const std::string &resourceName, const std::string &errMsg, const GroupResource &group) |
Logs an error related to a resource. More... | |
bool | hasErrorOccurred () const |
Checks if an error has occurred during parsing. More... | |
void | printInfo (std::ostream &os=std::cout, const bool onlyErrors=false) const |
Prints resources found, not found and incompatibilities. More... | |
void | printInfoError (std::ostream &os=std::cerr) const |
Prints resources not found and incompatibilities. More... | |
void | printInfoXML (const std::string &filename) const |
Prints resources found, not found and incompatibilities in XML format. More... | |
void | logResourceFound (const std::string &resourceName, const GroupResource &group) |
Logs that a resource has been found. More... | |
void | logResourceNotFound (const std::string &resourceName, const GroupResource &group) |
Logs that a resource has not been found. More... | |
Private Attributes | |
bfp::BFP | m_bfp |
The BFP object used by the parser manager. | |
std::unordered_map< GroupResource, GroupInfo > | m_groupInfo |
Map to divide information of found resources per group. | |
bool | m_error = false |
True if some resource was not found. | |
Responsible for managing the parsing of resources for a bitfile.
The ParserManager class provides methods for finding registers, DMAs, register addresses and DMA numbers. It also logs which resources have been found or not. It provides methods for logging resource incompatibilities and printing the problems found.
Definition at line 76 of file parserManager.h.
|
explicit |
Constructs a ParserManager object with the given BFP object.
bfp | The BFP object to be used for parsing. |
void irio::ParserManager::compareResourcesMap | ( | const std::unordered_map< std::uint32_t, const std::uint32_t > & | mapA, |
const std::string & | nameTermA, | ||
const std::unordered_map< std::uint32_t, const std::uint32_t > & | mapB, | ||
const std::string & | nameTermB, | ||
const GroupResource & | group | ||
) |
Compares two resource maps and logs any differences.
mapA | The first resource map. |
nameTermA | The name of the first resource map. |
mapB | The second resource map. |
nameTermB | The name of the second resource map. |
group | The group of the resources. |
bool irio::ParserManager::findDMA | ( | const std::string & | resourceName, |
const GroupResource & | group, | ||
bfp::DMA * | dma, | ||
const bool | optional = false |
||
) |
Finds a DMA with the given resource name.
resourceName | The name of the resource. |
group | The group of the resource. Used for logging. |
dma | Pointer to store the found DMA. |
optional | Flag indicating if the DMA is optional. If true and the resource is not found, it will not be logged. |
bool irio::ParserManager::findDMAEnumNum | ( | const std::string & | resourceName, |
std::uint32_t | nResource, | ||
const GroupResource & | group, | ||
std::unordered_map< std::uint32_t, const std::uint32_t > * | mapInsert, | ||
const bool | optional = false |
||
) |
Finds the DMA number of a DMA with the given name, The resource follows an enumeration naming convention.
Enumeration convention: resourceName<n> where n is a number
resourceName | The name of the resource. |
nResource | The number of the resource. |
group | The group of the resource. |
mapInsert | Pointer to the enumeration map. |
optional | Flag indicating if the DMA number is optional. |
bool irio::ParserManager::findDMANum | ( | const std::string & | resourceName, |
const GroupResource & | group, | ||
std::uint32_t * | address, | ||
const bool | optional = false |
||
) |
Finds the DMA number of a resource with the given name.
resourceName | The name of the resource. |
group | The group of the resource. Used for logging. |
address | Pointer to store the found DMA number. |
optional | Flag indicating if the resource is optional. If true and the resource is not found, it will not be logged. |
bool irio::ParserManager::findRegister | ( | const std::string & | resourceName, |
const GroupResource & | group, | ||
bfp::Register * | reg, | ||
const bool | optional = false |
||
) |
Finds a register with the given resource name.
resourceName | The name of the resource. |
group | The group of the resource. Used for logging. |
reg | Pointer to store the found register. |
optional | Flag indicating if the register is optional. If true and the resource is not found, it will not be logged. |
bool irio::ParserManager::findRegisterAddress | ( | const std::string & | resourceName, |
const GroupResource & | group, | ||
std::uint32_t * | address, | ||
const bool | optional = false |
||
) |
Finds the address of a register with the given resource name.
resourceName | The name of the resource. |
group | The group of the resource. Used for logging. |
address | Pointer to store the found address. |
optional | Flag indicating if the resource is optional. If true and the resource is not found, it will not be logged. |
bool irio::ParserManager::findRegisterEnumAddress | ( | const std::string & | resourceName, |
std::uint32_t | nResource, | ||
const GroupResource & | group, | ||
std::unordered_map< std::uint32_t, const std::uint32_t > * | mapInsert, | ||
const bool | optional = false |
||
) |
Finds the address of a register with the given resource name.
The register follows an enumeration naming convention.
Enumeration convention: resourceName<n> where n is a number
resourceName | The name of the resource. |
nResource | The number of the resource. |
group | The group of the resource. |
mapInsert | Pointer to the enumeration map. |
optional | Flag indicating if the address is optional. |
bool irio::ParserManager::hasErrorOccurred | ( | ) | const |
Checks if an error has occurred during parsing.
void irio::ParserManager::logResourceError | ( | const std::string & | resourceName, |
const std::string & | errMsg, | ||
const GroupResource & | group | ||
) |
Logs an error related to a resource.
resourceName | The name of the resource. |
errMsg | The error message. |
group | The group of the resource. |
void irio::ParserManager::logResourceFound | ( | const std::string & | resourceName, |
const GroupResource & | group | ||
) |
Logs that a resource has been found.
resourceName | The name of the resource. |
group | The group of the resource. |
void irio::ParserManager::logResourceNotFound | ( | const std::string & | resourceName, |
const GroupResource & | group | ||
) |
Logs that a resource has not been found.
resourceName | The name of the resource. |
group | The group of the resource. |
void irio::ParserManager::printInfo | ( | std::ostream & | os = std::cout , |
const bool | onlyErrors = false |
||
) | const |
Prints resources found, not found and incompatibilities.
os | The output stream to print the information to. |
onlyErrors | Only output not found or error. Default: print everything |
void irio::ParserManager::printInfoError | ( | std::ostream & | os = std::cerr | ) | const |
Prints resources not found and incompatibilities.
os | The output stream to print the error information to. |
void irio::ParserManager::printInfoXML | ( | const std::string & | filename | ) | const |
Prints resources found, not found and incompatibilities in XML format.
filename | The name of the XML file to write the information to. |