Skip to content

Commit

Permalink
Update DataTable
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Jul 18, 2024
1 parent ed5aedf commit 0888379
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 15 deletions.
54 changes: 39 additions & 15 deletions include/momo/DataTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -748,17 +748,25 @@ class DataTable
}

template<typename... Items>
internal::EnableIf<(sizeof...(Items) != 1),
ConstSelection> Select(Equality<Items>... equals) const
internal::EnableIf<(sizeof...(Items) > 1),
ConstSelection> Select(Equality<Items>... equals) const MOMO_DEPRECATED
{
return pvSelect<Selection>(EmptyRowFilter(), equals...);
}

template<typename RowFilter, typename... Items>
template<typename RowFilter = EmptyRowFilter>
internal::EnableIf<internal::IsInvocable<const RowFilter&, bool, ConstRowReference>::value,
ConstSelection> Select(const RowFilter& rowFilter, Equality<Items>... equals) const
ConstSelection> Select(const RowFilter& rowFilter = RowFilter()) const
{
return pvSelect<Selection>(rowFilter, equals...);
return pvSelect<Selection>(rowFilter);
}

template<typename RowFilter, typename Item, typename... Items>
internal::EnableIf<internal::IsInvocable<const RowFilter&, bool, ConstRowReference>::value,
ConstSelection> Select(const RowFilter& rowFilter, Equality<Item> equal,
Equality<Items>... equals) const
{
return pvSelect<Selection>(rowFilter, equal, equals...);
}

template<typename RowFilter = EmptyRowFilter,
Expand All @@ -770,17 +778,25 @@ class DataTable
}

template<typename... Items>
internal::EnableIf<(sizeof...(Items) != 1),
Selection> Select(Equality<Items>... equals)
internal::EnableIf<(sizeof...(Items) > 1),
Selection> Select(Equality<Items>... equals) MOMO_DEPRECATED
{
return pvSelect<Selection>(EmptyRowFilter(), equals...);
}

template<typename RowFilter, typename... Items>
template<typename RowFilter = EmptyRowFilter>
internal::EnableIf<internal::IsInvocable<const RowFilter&, bool, ConstRowReference>::value,
Selection> Select(const RowFilter& rowFilter = RowFilter())
{
return pvSelect<Selection>(rowFilter);
}

template<typename RowFilter, typename Item, typename... Items>
internal::EnableIf<internal::IsInvocable<const RowFilter&, bool, ConstRowReference>::value,
Selection> Select(const RowFilter& rowFilter, Equality<Items>... equals)
Selection> Select(const RowFilter& rowFilter, Equality<Item> equal,
Equality<Items>... equals)
{
return pvSelect<Selection>(rowFilter, equals...);
return pvSelect<Selection>(rowFilter, equal, equals...);
}

template<typename RowFilter = EmptyRowFilter,
Expand All @@ -792,17 +808,25 @@ class DataTable
}

template<typename... Items>
internal::EnableIf<(sizeof...(Items) != 1),
size_t> SelectCount(Equality<Items>... equals) const
internal::EnableIf<(sizeof...(Items) > 1),
size_t> SelectCount(Equality<Items>... equals) const MOMO_DEPRECATED
{
return pvSelect<size_t>(EmptyRowFilter(), equals...);
}

template<typename RowFilter, typename... Items>
template<typename RowFilter = EmptyRowFilter>
internal::EnableIf<internal::IsInvocable<const RowFilter&, bool, ConstRowReference>::value,
size_t> SelectCount(const RowFilter& rowFilter, Equality<Items>... equals) const
size_t> SelectCount(const RowFilter& rowFilter = RowFilter()) const
{
return pvSelect<size_t>(rowFilter);
}

template<typename RowFilter, typename Item, typename... Items>
internal::EnableIf<internal::IsInvocable<const RowFilter&, bool, ConstRowReference>::value,
size_t> SelectCount(const RowFilter& rowFilter, Equality<Item> equal,
Equality<Items>... equals) const
{
return pvSelect<size_t>(rowFilter, equals...);
return pvSelect<size_t>(rowFilter, equal, equals...);
}

template<typename RowFilter = EmptyRowFilter,
Expand Down
1 change: 1 addition & 0 deletions test/sources/SimpleDataTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ class SimpleDataTester
assert(table.Select(momo::DataEquality<>().And(dblCol, 1.0)).GetCount() == 1);
assert(ctable.Select(momo::DataEquality<>().And(dblCol, 1.0)).GetCount() == 1);

// deprecated funtions
assert(table.SelectCount(
ColumnInfo::MakeEquality(strCol, "0"), ColumnInfo::MakeEquality(intCol, 1)) == 1);
assert(table.Select(
Expand Down

0 comments on commit 0888379

Please sign in to comment.