Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/flucoma/clients/nrt/DataSetClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ class DataSetClient : public FluidBaseClient,
return OK();
}

MessageResult<double> containsId(string id) const
{
return mAlgorithm.contains(id) ? 1 : 0;
}

MessageResult<FluidTensor<rt::string, 1>> kNearest(InputBufferPtr data,
index nNeighbours) const
{
Expand Down Expand Up @@ -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));
}
Expand Down
8 changes: 7 additions & 1 deletion include/flucoma/clients/nrt/LabelSetClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ class LabelSetClient
return OK();
}

MessageResult<double> containsId(string id) const
{
return mAlgorithm.contains(id) ? 1 : 0;
}

MessageResult<string> print()
{
return "LabelSet " + std::string(get<kName>()) + ": " + mAlgorithm.print();
Expand All @@ -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; }
Expand Down
7 changes: 6 additions & 1 deletion include/flucoma/data/FluidDataSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool add(idType const& id, FluidTensorView<const dataType, N> point)
return pos->second;
}

bool update(idType const& id, FluidTensorView<const dataType, N> point)
bool update(idType const& id, FluidTensorView<const dataType, N> point)
{
auto pos = mIndex.find(id);
if (pos == mIndex.end())
Expand All @@ -130,6 +130,11 @@ bool update(idType const& id, FluidTensorView<const dataType, N> point)
return true;
}

bool contains(idType const& id) const
{
return (mIndex.count(id) == 1);
}

FluidTensorView<dataType, N + 1> getData() { return mData; }
FluidTensorView<idType, 1> getIds() { return mIds; }
FluidTensorView<const dataType, N + 1> getData() const { return mData; }
Expand Down
Loading