Template Class DerivedMultiMessage

Base Type

  • public BasesT

template<typename DerivedT, typename ...BasesT>
class DerivedMultiMessage : public BasesT

All classes that are derived from MultiMessage should use this class. It will automatically add the get_slice function with the correct return type. Uses the CRTP pattern. This supports multiple base classes but in reality it should not be used. Multiple base classes are used to make template specialization easier.

Template Parameters
  • DerivedT – The deriving class. Should be used like class MyDerivedMultiMessage: public DerivedMultiMessage<MyDerivedMultiMessage, MultiMessage>

  • BasesT – The base classes that the class should derive from. If the class should function like class MyDerivedMultiMessage: public MyBaseMultiMessage, then class MyDerivedMultiMessage: public DerivedMultiMessage<MyDerivedMultiMessage, MyBaseMultiMessage> shoud be used.

Public Functions

virtual ~DerivedMultiMessage() = default

inline std::shared_ptr<DerivedT> get_slice(TensorIndex start, TensorIndex stop) const

Creates a copy of the current message calculating new mess_offset and mess_count values based on the given start & stop values. This method is reletively light-weight as it does not copy the underlying meta and the actual slicing of the dataframe is applied later when get_meta is called.

Parameters
  • start

  • stop

Returns

std::shared_ptr<DerivedT>

inline std::shared_ptr<DerivedT> copy_ranges(const std::vector<RangeType> &ranges, TensorIndex num_selected_rows) const

Creates a deep copy of the current message along with a copy of the underlying meta selecting the rows of meta defined by pairs of start, stop rows expressed in the ranges argument.

This allows for copying several non-contiguous rows from the underlying dataframe into a new dataframe, however this comes at a much higher cost compared to the get_slice method.

Parameters
  • ranges

  • num_selected_rows

Returns

std::shared_ptr<DerivedT>

Protected Functions

virtual void get_slice_impl(std::shared_ptr<MultiMessage> new_message, TensorIndex start, TensorIndex stop) const = 0

Applies a slice of the attribures contained in new_message. Subclasses need only be concerned with their own attributes, and can safely avoid overriding this method if they don’t add any new attributes to their base.

Parameters
  • new_message

  • start

  • stop

virtual void copy_ranges_impl(std::shared_ptr<MultiMessage> new_message, const std::vector<RangeType> &ranges, TensorIndex num_selected_rows) const = 0

Similar to get_slice_impl, performs a copy of all attributes in new_message according to the rows specified by ranges. Subclasses need only be concerned with copying their own attributes, and can safely avoid overriding this method if they don’t add any new attributes to their base.

Parameters
  • new_message

  • ranges

  • num_selected_rows

© Copyright 2023, NVIDIA. Last updated on Apr 11, 2023.