13#ifndef RTCTK_COMPONENTFRAMEWORK_MATRIXBUFFER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_MATRIXBUFFER_HPP
27template <
typename T,
typename A = std::allocator<T>>
30 using typename std::vector<T, A>::size_type;
31 using typename std::vector<T, A>::value_type;
32 using typename std::vector<T, A>::reference;
33 using typename std::vector<T, A>::const_reference;
43 std::vector<T, A>::operator=(
other);
44 m_nrows =
other.m_nrows;
45 m_ncols =
other.m_ncols;
50 : std::vector<T, A>(std::forward<MatrixBuffer>(
other))
51 , m_nrows(std::move(
other.m_nrows))
52 , m_ncols(std::move(
other.m_ncols)) {
56 std::allocator_traits<A>::propagate_on_container_move_assignment::value
or
57 std::allocator_traits<A>::is_always_equal::value) {
58 std::vector<T, A>::operator=(std::forward<MatrixBuffer>(
other));
59 m_nrows = std::move(
other.m_nrows);
60 m_ncols = std::move(
other.m_ncols);
65 : std::vector<T,
A>(data), m_nrows(
n), m_ncols(
m) {
73 std::vector<T, A>::resize(
n *
m);
80 std::vector<T, A>::resize(
n *
m, value);
88 return std::vector<T, A>::operator[](
n * m_ncols +
m);
94 return std::vector<T, A>::operator[](
n * m_ncols +
m);
106 return row * m_ncols +
col;
118template <
typename T,
typename A>
121 static_cast<std::vector<T, A>
>(
lhs) ==
static_cast<std::vector<T, A>
>(
rhs);
128template <
typename T,
typename A>
130 return lhs.GetNrows() !=
rhs.GetNrows()
or lhs.GetNcols() !=
rhs.GetNcols()
or
131 static_cast<std::vector<T, A>
>(
lhs) !=
static_cast<std::vector<T, A>
>(
rhs);
142template <
typename T,
typename A>
144 if (
lhs.size() <
rhs.size()) {
146 }
else if (
lhs.size() ==
rhs.size()) {
147 if (
lhs.GetNrows() <
rhs.GetNrows()) {
149 }
else if (
lhs.GetNrows() >
rhs.GetNrows()) {
153 return static_cast<std::vector<T, A>
>(
lhs) <
static_cast<std::vector<T, A>
>(
rhs);
160template <
typename T,
typename A>
162 if (
lhs.size() <
rhs.size()) {
164 }
else if (
lhs.size() ==
rhs.size()) {
165 if (
lhs.GetNrows() <
rhs.GetNrows()) {
167 }
else if (
lhs.GetNrows() >
rhs.GetNrows()) {
171 return static_cast<std::vector<T, A>
>(
lhs) <=
static_cast<std::vector<T, A>
>(
rhs);
182template <
typename T,
typename A>
184 if (
lhs.size() >
rhs.size()) {
186 }
else if (
lhs.size() ==
rhs.size()) {
187 if (
lhs.GetNrows() >
rhs.GetNrows()) {
189 }
else if (
lhs.GetNrows() <
rhs.GetNrows()) {
193 return static_cast<std::vector<T, A>
>(
lhs) >
static_cast<std::vector<T, A>
>(
rhs);
200template <
typename T,
typename A>
202 if (
lhs.size() >
rhs.size()) {
204 }
else if (
lhs.size() ==
rhs.size()) {
205 if (
lhs.GetNrows() >
rhs.GetNrows()) {
207 }
else if (
lhs.GetNrows() <
rhs.GetNrows()) {
211 return static_cast<std::vector<T, A>
>(
lhs) >=
static_cast<std::vector<T, A>
>(
rhs);
A buffer class representing 2D matrix data.
Definition matrixBuffer.hpp:28
constexpr reference operator()(size_type n, size_type m)
Definition matrixBuffer.hpp:85
constexpr void resize(size_type n, size_type m, const value_type &value)
Definition matrixBuffer.hpp:79
constexpr MatrixBuffer(size_type n, size_type m, const std::vector< T, A > &data)
Definition matrixBuffer.hpp:64
size_type GetNcols() const
Definition matrixBuffer.hpp:101
constexpr MatrixBuffer(const MatrixBuffer &other)
Definition matrixBuffer.hpp:38
size_type GetNrows() const
Definition matrixBuffer.hpp:97
constexpr const_reference operator()(size_type n, size_type m) const
Definition matrixBuffer.hpp:91
constexpr MatrixBuffer(MatrixBuffer &&other) noexcept
Definition matrixBuffer.hpp:49
constexpr MatrixBuffer() noexcept(noexcept(A()))
Definition matrixBuffer.hpp:35
constexpr void resize(size_type n, size_type m)
Definition matrixBuffer.hpp:72
constexpr MatrixBuffer & operator=(MatrixBuffer &&other) noexcept(std::allocator_traits< A >::propagate_on_container_move_assignment::value or std::allocator_traits< A >::is_always_equal::value)
Definition matrixBuffer.hpp:55
constexpr MatrixBuffer & operator=(const MatrixBuffer &other)
Definition matrixBuffer.hpp:42
size_t GetElementIndex(size_t row, size_t col)
Definition matrixBuffer.hpp:105
Definition commandReplier.cpp:22
bool operator<(const DataPointPath &lhs, const char *rhs) noexcept
Definition dataPointPath.hpp:362
bool operator>=(const DataPointPath &lhs, const char *rhs) noexcept
Definition dataPointPath.hpp:374
bool operator<=(const DataPointPath &lhs, const char *rhs) noexcept
Definition dataPointPath.hpp:366
constexpr bool operator!=(const MatrixBuffer< T, A > &lhs, const MatrixBuffer< T, A > &rhs) noexcept
Compares two MatrixBuffer objects and returns true if they do not have the same shape or the elements...
Definition matrixBuffer.hpp:129
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
bool operator==(const DataPointPath &lhs, const char *rhs) noexcept
Definition dataPointPath.hpp:358
bool operator>(const DataPointPath &lhs, const char *rhs) noexcept
Definition dataPointPath.hpp:370