Skip to content

Commit

Permalink
Update DataColumn classes
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Jul 16, 2024
1 parent 3676c20 commit 43fdf55
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions include/momo/DataColumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,8 @@ class DataColumn : public DataColumn<internal::DataMutable<TItem>, TStruct, TCod
typedef TCode Code;

typedef DataColumn BaseColumn;

typedef DataColumn<internal::DataMutable<Item>, Struct, Code> MutableColumn;

typedef DataEquality<DataColumn> Equality;

template<typename ItemArg>
using Assignment = DataAssignment<DataColumn, ItemArg>;

public:
constexpr explicit DataColumn(const char* name) noexcept
: mCode(internal::StrHasher::GetHashCode64(name)),
Expand Down Expand Up @@ -460,15 +454,15 @@ class DataColumn : public DataColumn<internal::DataMutable<TItem>, TStruct, TCod
return false;
}

Equality operator==(const Item& item) const noexcept
DataEquality<DataColumn> operator==(const Item& item) const noexcept
{
return Equality(*this, item);
return DataEquality<DataColumn>(*this, item);
}

template<typename ItemArg>
Assignment<ItemArg> operator=(ItemArg&& itemArg) const noexcept
DataAssignment<DataColumn, ItemArg> operator=(ItemArg&& itemArg) const noexcept
{
return Assignment<ItemArg>(*this, std::forward<ItemArg>(itemArg));
return DataAssignment<DataColumn, ItemArg>(*this, std::forward<ItemArg>(itemArg));
}

private:
Expand Down Expand Up @@ -556,6 +550,20 @@ class DataColumnInfo : public internal::DataColumnInfoBase<TStruct, TCode>
ColumnInfoBase::template ptVisit<DataColumnInfo>(item, ptrVisitor);
}

template<typename Item>
static DataEquality<Column<Item>> MakeEquality(
const Column<Item>& column, const Item& item) noexcept
{
return DataEquality<Column<Item>>(column, item);
}

template<typename Item, typename ItemArg>
static DataAssignment<Column<Item>, ItemArg> MakeAssignment(
const Column<Item>& column, ItemArg&& itemArg) noexcept
{
return DataAssignment<Column<Item>, ItemArg>(column, std::forward<ItemArg>(itemArg));
}

private:
const char* mName;
};
Expand Down Expand Up @@ -604,6 +612,20 @@ class DataColumnInfoNative : public internal::DataColumnInfoBase<TStruct, DataCo
{
ColumnInfoBase::template ptVisit<DataColumnInfoNative>(item, ptrVisitor);
}

template<typename Item>
static DataEquality<Column<Item>> MakeEquality(
const Column<Item>& column, const Item& item) noexcept
{
return DataEquality<Column<Item>>(column, item);
}

template<typename Item, typename ItemArg>
static DataAssignment<Column<Item>, ItemArg> MakeAssignment(
const Column<Item>& column, ItemArg&& itemArg) noexcept
{
return DataAssignment<Column<Item>, ItemArg>(column, std::forward<ItemArg>(itemArg));
}
};

template<bool tKeepRowNumber = false>
Expand Down

0 comments on commit 43fdf55

Please sign in to comment.