Skip to content

Commit

Permalink
[ntcore] Map int[] to int64[] for DataLog (#6279)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson committed Jan 21, 2024
1 parent 0c6bd84 commit ad18f35
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ntcore/src/main/native/cpp/LocalStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ bool LocalStorage::MultiSubscriberData::Matches(std::string_view name,
}

int LocalStorage::DataLoggerData::Start(TopicData* topic, int64_t time) {
std::string_view typeStr = topic->typeStr;
// NT and DataLog use different standard representations for int and int[]
if (typeStr == "int") {
typeStr = "int64";
} else if (typeStr == "int[]") {
typeStr = "int64[]";
}
return log.Start(fmt::format("{}{}", logPrefix,
wpi::drop_front(topic->name, prefix.size())),
topic->typeStr == "int" ? "int64" : topic->typeStr,
DataLoggerEntry::MakeMetadata(topic->propertiesStr), time);
typeStr, DataLoggerEntry::MakeMetadata(topic->propertiesStr),
time);
}

void LocalStorage::DataLoggerEntry::Append(const Value& v) {
Expand Down

0 comments on commit ad18f35

Please sign in to comment.