MCPcopy Create free account
hub / github.com/comaps/comaps / Apply

Function Apply

libs/coding/compressed_bit_vector.cpp:200–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198
199template <typename TBinaryOp>
200unique_ptr<coding::CompressedBitVector> Apply(TBinaryOp const & op, CompressedBitVector const & lhs,
201 CompressedBitVector const & rhs)
202{
203 using strat = CompressedBitVector::StorageStrategy;
204 auto const stratA = lhs.GetStorageStrategy();
205 auto const stratB = rhs.GetStorageStrategy();
206 if (stratA == strat::Dense && stratB == strat::Dense)
207 {
208 DenseCBV const & a = static_cast<DenseCBV const &>(lhs);
209 DenseCBV const & b = static_cast<DenseCBV const &>(rhs);
210 return op(a, b);
211 }
212 if (stratA == strat::Dense && stratB == strat::Sparse)
213 {
214 DenseCBV const & a = static_cast<DenseCBV const &>(lhs);
215 SparseCBV const & b = static_cast<SparseCBV const &>(rhs);
216 return op(a, b);
217 }
218 if (stratA == strat::Sparse && stratB == strat::Dense)
219 {
220 SparseCBV const & a = static_cast<SparseCBV const &>(lhs);
221 DenseCBV const & b = static_cast<DenseCBV const &>(rhs);
222 return op(a, b);
223 }
224 if (stratA == strat::Sparse && stratB == strat::Sparse)
225 {
226 SparseCBV const & a = static_cast<SparseCBV const &>(lhs);
227 SparseCBV const & b = static_cast<SparseCBV const &>(rhs);
228 return op(a, b);
229 }
230
231 return nullptr;
232}
233
234// Returns true if a bit vector with popCount bits set out of totalBits
235// is fit to be represented as a DenseCBV. Note that we do not

Callers 5

IntersectMethod · 0.85
SubtractMethod · 0.85
UnionMethod · 0.85
RenderMethod · 0.85
OnContextCreateMethod · 0.85

Calls 1

GetStorageStrategyMethod · 0.80

Tested by

no test coverage detected