Template Class DerivedMultiMessage
Defined in File multi.hpp
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
, thenclass 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
andmess_count
values based on the givenstart
&stop
values. This method is reletively light-weight as it does not copy the underlyingmeta
and the actual slicing of the dataframe is applied later whenget_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 ofmeta
defined by pairs of start, stop rows expressed in theranges
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
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 –
Similar to
get_slice_impl
, performs a copy of all attributes innew_message
according to the rows specified byranges
. 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 –