Compare commits
2 Commits
a745f803b3
...
d97798d063
| Author | SHA1 | Date | |
|---|---|---|---|
| d97798d063 | |||
| 247759b364 |
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
|
||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
project(PIP)
|
||||
set(PIP_MAJOR 3)
|
||||
set(PIP_MINOR 17)
|
||||
set(PIP_MINOR 18)
|
||||
set(PIP_REVISION 1)
|
||||
set(PIP_SUFFIX )
|
||||
set(PIP_COMPANY SHS)
|
||||
|
||||
@@ -679,6 +679,61 @@ public:
|
||||
return outm;
|
||||
}
|
||||
|
||||
//! \~english
|
||||
//! \brief Returns this matrix with another element type.
|
||||
//! \~russian
|
||||
//! \brief Возвращает эту матрицу с другим типом элементов.
|
||||
template<typename T>
|
||||
PIMathMatrixT<Rows, Cols, T> toType() const {
|
||||
PIMathMatrixT<Cols, Rows, T> ret;
|
||||
PIMM_FOR ret[r][c] = element(r, c);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//! \~english
|
||||
//! \brief Returns the submatrix with size SubRows x SubCols. Elements takes from coordinates "row_offset" and "col_offset".
|
||||
//! \details
|
||||
//! \~russian
|
||||
//! \brief Возвращает подматрицу с размерами SubRows x SubCols. Элементы берутся с координат "row_offset" и "col_offset".
|
||||
//! \details Координаты могут быть отрицательными. Возвращаемая матрица может быть любого размера. Если исходные элементы выходят
|
||||
//! за границы исходной матрицы, то в подматрице будут нули.
|
||||
template<uint SubRows, uint SubCols = SubRows>
|
||||
PIMathMatrixT<SubRows, SubCols, Type> submatrix(int row_offset = 0, int col_offset = 0) const {
|
||||
PIMathMatrixT<SubRows, SubCols, Type> ret;
|
||||
for (int r = 0; r < (int)SubRows; ++r) {
|
||||
int sr = r + row_offset;
|
||||
if (sr < 0 || sr >= (int)Rows) continue;
|
||||
for (int c = 0; c < (int)SubCols; ++c) {
|
||||
int sc = c + col_offset;
|
||||
if (sc < 0 || sc >= (int)Cols) continue;
|
||||
ret.element(r, c) = element(sr, sc);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//! \~english
|
||||
//! \brief Set the submatrix "m" in coordinates "row_index" and "col_index".
|
||||
//! \details
|
||||
//! \~russian
|
||||
//! \brief Устанавливает подматрицу "m" в координаты "row_index" и "col_index".
|
||||
//! \details Присваивает значения из матрицы "m" в прямоугольную область текущией матрицы, ограниченную
|
||||
//! размерами "m", самой матрицы и границами, исходя из координат установки. Координаты могут быть отрицательными.
|
||||
//! Матрица "m" может быть любого размера. Возвращает ссылку на эту матрицу.
|
||||
template<uint SubRows, uint SubCols = SubRows>
|
||||
PIMathMatrixT<Rows, Cols, Type> & setSubmatrix(int row_index, int col_index, const PIMathMatrixT<SubRows, SubCols, Type> & m) {
|
||||
for (int r = 0; r < (int)SubRows; ++r) {
|
||||
int sr = r + row_index;
|
||||
if (sr < 0 || sr >= (int)Rows) continue;
|
||||
for (int c = 0; c < (int)SubCols; ++c) {
|
||||
int sc = c + col_index;
|
||||
if (sc < 0 || sc >= (int)Cols) continue;
|
||||
element(sr, sc) = m.element(r, c);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
Type m[Rows][Cols];
|
||||
};
|
||||
|
||||
@@ -302,6 +302,7 @@ bool writeClassStreamMembersOut(PIIOTextStream & ts, const PICodeParser::Entity
|
||||
PISet<int> used_id;
|
||||
for (const PICodeParser::Member & m: ml) {
|
||||
if (is_union && m.isBitfield()) continue;
|
||||
if (m.attributes[PICodeParser::Static]) continue;
|
||||
if (m.meta.value("id") == "-") continue;
|
||||
++cnt;
|
||||
if (m.meta.contains("id")) cnt = m.meta.value("id").toInt();
|
||||
@@ -355,6 +356,7 @@ bool writeClassStreamMembersIn(PIIOTextStream & ts, const PICodeParser::Entity *
|
||||
PISet<int> used_id;
|
||||
for (const PICodeParser::Member & m: ml) {
|
||||
if (is_union && m.isBitfield()) continue;
|
||||
if (m.attributes[PICodeParser::Static]) continue;
|
||||
if (m.meta.value("id") == "-") continue;
|
||||
++cnt;
|
||||
if (m.meta.contains("id")) cnt = m.meta.value("id").toInt();
|
||||
@@ -421,6 +423,7 @@ bool needClassStream(const PICodeParser::Entity * e) {
|
||||
if (e->meta.contains("no-stream")) return false;
|
||||
for (const PICodeParser::Member & m: e->members) {
|
||||
if (m.is_type_ptr || m.isBitfield() || !m.dims.isEmpty() || (m.visibility != PICodeParser::Public)) continue;
|
||||
if (m.attributes[PICodeParser::Static]) continue;
|
||||
if (m.meta.value("id") == "-") continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user