Message Transmitters are not seperated

Issue #2 resolved
Former user created an issue

The use of a std::set<std::string> for the message transmitters implies that each transmitter should be added as single std::string. As far as I could evaluate all transmitters are added as one std::string, seperated with a ',' so each std::set has only one object containing all transmitters. Is this intended? I'm using the C++11 Regex Option.

void File::readMessageTransmitter(Network & network, std::string & line)
{
    smatch m;
    regex re(REGEX_SOL "BO_TX_BU_" REGEX_SPACE REGEX_UINT REGEX_DELIM(":") REGEX_TO_END REGEX_EOL_DELIM);
    if (regex_search(line, m, re)) {
        unsigned int messageId = stoul(m[1]);
        Message & message = network.messages[messageId];

        /* Message Identifier */
        message.id = messageId;

        /* Transmitters */
        std::istringstream iss(m[2]);
        while(iss.good()) {
            std::string transmitter;
            iss >> transmitter;
            message.transmitters.insert(transmitter);
        }
        return;
    }

    /* format doesn't match */
    if (statusCallback != nullptr) {
        statusCallback(network, Status::MalformedMessageTransmitter);
    }
}

Comments (3)

  1. Tobias Lorenz repo owner

    Fix Database.dbc. Merge tests Regression+Message. Remove std::cout.

    The Database.dbc contained BO_TX_BU_ with wrong transmitter seperation. Seperator is " " and not ",". Fixes #2.

    Also merge regression test into message test.

    Remove unnecessary std::cout, which just created noise during test execution.

    Signed-off-by: Tobias Lorenz tobias.lorenz@gmx.net

    → <<cset 8ab404018c2f>>

  2. Tobias Lorenz repo owner

    Sorry, for the delay. I'm currently in vacation :-)

    The problem was the database used for testing. It contained BO_TX_BU with wrong transmitter seperation. Seperator is " " and not ",", at is was before. So I fixed the database and enhanced the test cases to cover this issue.

    I'm glad, there was no change in the library itself necessary ;-)

    Bye Tobias

  3. Log in to comment