NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
gridtable.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2019 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#include <wx/grid.h>
20
21#include "../../kernel/core/datamanagement/table.hpp"
23
24#ifndef GRIDTABLE_HPP
25#define GRIDTABLE_HPP
26
27
33class GridNumeReTable : public wxGridTableBase
34{
35 private:
37 int getNumHeadlines() const;
39
40 public:
42 GridNumeReTable(int numRows, int numCols);
43 GridNumeReTable(NumeRe::Table&& _extTable);
44 virtual ~GridNumeReTable() {}
45
47 {
48 return _table;
49 }
50
53
54 virtual int GetNumberRows();
55 virtual int GetNumberCols();
56
57 virtual bool CanGetValueAs(int row, int col, const wxString& sTypeName);
58 virtual double GetValueAsDouble(int row, int col);
59 virtual bool GetValueAsBool(int row, int col);
60 virtual void* GetValueAsCustom(int row, int col, const wxString& sTypeName);
61
62 virtual wxString GetValue(int row, int col);
63 virtual void SetValue(int row, int col, const wxString& value);
64
65 virtual void Clear();
66 virtual bool InsertRows(size_t pos = 0, size_t numRows = 1);
67 virtual bool AppendRows(size_t numRows = 1);
68 virtual bool DeleteRows(size_t pos = 0, size_t numRows = 1);
69 virtual bool InsertCols(size_t pos = 0, size_t numRows = 1);
70 virtual bool AppendCols(size_t numRows = 1);
71 virtual bool DeleteCols(size_t pos = 0, size_t numRows = 1);
72
73 virtual wxString GetRowLabelValue(int row);
74 virtual wxString GetColLabelValue(int col);
75
76 double min(const wxGridCellCoordsContainer& coords) const;
77 double max(const wxGridCellCoordsContainer& coords) const;
78 mu::value_type avg(const wxGridCellCoordsContainer& coords) const;
79 mu::value_type sum(const wxGridCellCoordsContainer& coords) const;
80
81 std::vector<int> getColumnTypes() const;
82 std::vector<std::string> getCategories(int col) const;
83};
84
85
86
87#endif // GRIDTABLE_HPP
88
This class is a specialisation for the standard wxGridTableBase supporting complex numbers as well as...
Definition: gridtable.hpp:34
mu::value_type sum(const wxGridCellCoordsContainer &coords) const
This member function calculates the sum of the range (r1,c1)->(r2,c2).
Definition: gridtable.cpp:610
mu::value_type avg(const wxGridCellCoordsContainer &coords) const
This member function calculates the average value of the range (r1,c1)->(r2,c2).
Definition: gridtable.cpp:571
virtual wxString GetRowLabelValue(int row)
This virtual member function will return the label for the selected row as a string.
Definition: gridtable.cpp:475
virtual void Clear()
This virtual function redirects the control directly to the internal buffer and cleares it contents.
Definition: gridtable.cpp:306
virtual bool AppendCols(size_t numRows=1)
This virtual function redirects the control directly to the internal buffer and appends columns.
Definition: gridtable.cpp:424
std::vector< std::string > getCategories(int col) const
Returns the categories in the selected column, if this is a categorical column.
Definition: gridtable.cpp:659
virtual bool GetValueAsBool(int row, int col)
This virtual member function returns the selected cell value as a bool.
Definition: gridtable.cpp:206
NumeRe::Table getTable()
Definition: gridtable.hpp:46
virtual wxString GetColLabelValue(int col)
This virtual member function will return the label for the selected column as a string.
Definition: gridtable.cpp:493
virtual bool AppendRows(size_t numRows=1)
This virtual function redirects the control directly to the internal buffer and appends rows.
Definition: gridtable.cpp:347
virtual bool DeleteRows(size_t pos=0, size_t numRows=1)
This virtual function redirects the control directly to the internal buffer and deletes rows.
Definition: gridtable.cpp:373
GridNumeReTable()
Default constructor.
Definition: gridtable.cpp:27
virtual ~GridNumeReTable()
Definition: gridtable.hpp:44
virtual int GetNumberRows()
This member function will return the number of lines including the headlines handled by this data pro...
Definition: gridtable.cpp:109
double max(const wxGridCellCoordsContainer &coords) const
This member function calculates the maximal value in the range (r1,c1)->(r2,c2).
Definition: gridtable.cpp:539
NumeRe::Table getTableCopy()
This member function returns a copy of the internal table.
Definition: gridtable.cpp:81
std::vector< int > getColumnTypes() const
Returns the types of the handled table.
Definition: gridtable.cpp:640
virtual bool InsertRows(size_t pos=0, size_t numRows=1)
This virtual function redirects the control directly to the internal buffer and inserts rows.
Definition: gridtable.cpp:322
virtual bool InsertCols(size_t pos=0, size_t numRows=1)
This virtual function redirects the control directly to the internal buffer and inserts columns.
Definition: gridtable.cpp:399
virtual bool DeleteCols(size_t pos=0, size_t numRows=1)
This virtual function redirects the control directly to the internal buffer and deletes columns.
Definition: gridtable.cpp:450
virtual int GetNumberCols()
This member function will return the number of columns handled by this data provider class.
Definition: gridtable.cpp:123
NumeRe::Table _table
Definition: gridtable.hpp:36
virtual bool CanGetValueAs(int row, int col, const wxString &sTypeName)
This virtual member function will tell the grid, which data types may be returned by the current cell...
Definition: gridtable.cpp:140
double min(const wxGridCellCoordsContainer &coords) const
This member function calculates the minimal value in the range (r1,c1)->(r2,c2).
Definition: gridtable.cpp:507
virtual void SetValue(int row, int col, const wxString &value)
This virtual member function sets the passed value in the internal buffer. It's decided automatically...
Definition: gridtable.cpp:270
NumeRe::Table & getTableRef()
This member function returns a reference to the internal table.
Definition: gridtable.cpp:95
virtual double GetValueAsDouble(int row, int col)
This virtual member function returns the selected cell value as a double.
Definition: gridtable.cpp:184
int getNumHeadlines() const
This member function will return the number of headlines available in the internal buffer.
Definition: gridtable.cpp:68
mu::value_type value
Definition: gridtable.hpp:38
virtual wxString GetValue(int row, int col)
This virtual member function returns the value of the selected cell as string.
Definition: gridtable.cpp:246
virtual void * GetValueAsCustom(int row, int col, const wxString &sTypeName)
This member function will return the internal data as a void pointer referencing the internal mu::val...
Definition: gridtable.cpp:230
This data container is a copy- efficient table to interchange data between Kernel and GUI.
Definition: table.hpp:87
A class to simplify the access to different types of grid cell coords. Especially useful in the conte...
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:251