Skip to content

Commit

Permalink
[MCH] fixed issues in IC communication
Browse files Browse the repository at this point in the history
The issues are al related to the intepretation of the fields in the
Ic::Data structure, which is of type boost::variant and is accessed
via boost::get

Without those fixes, one gets several boost::bad_get exceptions.
  • Loading branch information
alice-mch authored and kostorr committed Feb 10, 2021
1 parent e07b9e1 commit ab46f2e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Ic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ std::vector<std::pair<Ic::Operation, Ic::Data>> Ic::executeSequence(std::vector<
Data data = it.second;
try {
if (operation == Operation::Read) {
auto out = read(boost::get<uint32_t>(data));
auto out = read(boost::get<IcData>(data));
ret.push_back({ operation, out });
} else if (operation == Operation::Write) {
write(boost::get<IcData>(data));
Expand Down Expand Up @@ -204,8 +204,10 @@ std::string Ic::writeSequence(std::vector<std::pair<Operation, Data>> ops, bool
for (const auto& it : out) {
Operation operation = it.first;
Data data = it.second;
if (operation == Operation::Read || operation == Operation::Write) {
if (operation == Operation::Read) {
resultBuffer << Util::formatValue(boost::get<IcOut>(data)) << "\n";
} else if (operation == Operation::Write) {
resultBuffer << Util::formatValue(boost::get<IcData>(data).data) << "\n";
} else if (operation == Operation::Error) {
std::string errMessage = boost::get<std::string>(data);
resultBuffer << errMessage;
Expand Down

0 comments on commit ab46f2e

Please sign in to comment.