- addressConfigFile.open(fqnOfConfigFile.c_str());
-
- if(addressConfigFile) {
- std::string currentlyParsedCommonApiAddress;
- DBusServiceAddress dbusServiceAddress;
- reset(dbusServiceAddress);
-
- bool currentAddressNotYetContained = false;
- bool atLeastOneAddressFound = false;
-
- while (addressConfigFile.good()) {
- std::string readLine;
- getline(addressConfigFile, readLine);
- const size_t readLineLength = readLine.length();
-
- if (readLine[0] == '[' && readLine[readLineLength - 1] == ']') {
- if (atLeastOneAddressFound) {
- fillUndefinedRequiredValues(dbusServiceAddress, currentlyParsedCommonApiAddress);
- knownDBusAddresses.insert( {currentlyParsedCommonApiAddress, dbusServiceAddress});
- knownCommonAddresses.insert( {dbusServiceAddress, currentlyParsedCommonApiAddress});
- }
- reset(dbusServiceAddress);
- currentlyParsedCommonApiAddress = readLine.substr(1, readLineLength - 2);
- currentAddressNotYetContained =
- knownDBusAddresses.find(currentlyParsedCommonApiAddress) == knownDBusAddresses.end()
- &&
- knownCommonAddresses.find(dbusServiceAddress)
- == knownCommonAddresses.end();
- atLeastOneAddressFound = true;
-
- } else if (currentAddressNotYetContained) {
- readValue(readLine, dbusServiceAddress);
+ if (readLine[0] == '[' && readLine[readLineLength - 1] == ']') {
+ if (newAddressFound) {
+ fillUndefinedValues(serviceDetails, currentlyParsedCommonApiAddress);
+ commonApiAddressDetails.insert( {currentlyParsedCommonApiAddress, serviceDetails});
+ dbusToCommonApiAddress.insert( {std::get<0>(serviceDetails), currentlyParsedCommonApiAddress});
+ }
+ reset(serviceDetails);
+ std::string newAddress = readLine.substr(1, readLineLength - 2);
+ if (isValidCommonApiAddress(newAddress)) {
+ currentlyParsedCommonApiAddress = std::move(newAddress);
+ newAddressFound = commonApiAddressDetails.find(currentlyParsedCommonApiAddress) == commonApiAddressDetails.end();