From 9160ca70337912fd53cebfaea17e9392eaa5bdaf Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Sun, 24 May 2026 15:02:32 +0200 Subject: [PATCH] first commit - functional - iterface questions pending --- include/flucoma/clients/nrt/DataSetClient.hpp | 6 ++++++ include/flucoma/clients/nrt/LabelSetClient.hpp | 8 +++++++- include/flucoma/data/FluidDataSet.hpp | 7 ++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/flucoma/clients/nrt/DataSetClient.hpp b/include/flucoma/clients/nrt/DataSetClient.hpp index 2b75cb780..42c5d0434 100644 --- a/include/flucoma/clients/nrt/DataSetClient.hpp +++ b/include/flucoma/clients/nrt/DataSetClient.hpp @@ -229,6 +229,11 @@ class DataSetClient : public FluidBaseClient, return OK(); } + MessageResult containsId(string id) const + { + return mAlgorithm.contains(id) ? 1 : 0; + } + MessageResult> kNearest(InputBufferPtr data, index nNeighbours) const { @@ -324,6 +329,7 @@ class DataSetClient : public FluidBaseClient, makeMessage("fromBuffer", &DataSetClient::fromBuffer), makeMessage("toBuffer", &DataSetClient::toBuffer), makeMessage("getIds", &DataSetClient::getIds), + makeMessage("containsId", &DataSetClient::containsId), makeMessage("kNearestDist", &DataSetClient::kNearestDist), makeMessage("kNearest", &DataSetClient::kNearest)); } diff --git a/include/flucoma/clients/nrt/LabelSetClient.hpp b/include/flucoma/clients/nrt/LabelSetClient.hpp index 49febf3ab..ef0a95a86 100644 --- a/include/flucoma/clients/nrt/LabelSetClient.hpp +++ b/include/flucoma/clients/nrt/LabelSetClient.hpp @@ -142,6 +142,11 @@ class LabelSetClient return OK(); } + MessageResult containsId(string id) const + { + return mAlgorithm.contains(id) ? 1 : 0; + } + MessageResult print() { return "LabelSet " + std::string(get()) + ": " + mAlgorithm.print(); @@ -164,7 +169,8 @@ class LabelSetClient makeMessage("clear", &LabelSetClient::clear), makeMessage("write", &LabelSetClient::write), makeMessage("read", &LabelSetClient::read), - makeMessage("getIds", &LabelSetClient::getIds)); + makeMessage("getIds", &LabelSetClient::getIds), + makeMessage("containsId", &LabelSetClient::containsId)); } const LabelSet getLabelSet() const { return mAlgorithm; } diff --git a/include/flucoma/data/FluidDataSet.hpp b/include/flucoma/data/FluidDataSet.hpp index 9c4612276..45f997f13 100644 --- a/include/flucoma/data/FluidDataSet.hpp +++ b/include/flucoma/data/FluidDataSet.hpp @@ -104,7 +104,7 @@ bool add(idType const& id, FluidTensorView point) return pos->second; } -bool update(idType const& id, FluidTensorView point) + bool update(idType const& id, FluidTensorView point) { auto pos = mIndex.find(id); if (pos == mIndex.end()) @@ -130,6 +130,11 @@ bool update(idType const& id, FluidTensorView point) return true; } + bool contains(idType const& id) const + { + return (mIndex.count(id) == 1); + } + FluidTensorView getData() { return mData; } FluidTensorView getIds() { return mIds; } FluidTensorView getData() const { return mData; }