Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
matrix-to-buffer.h
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21
22#ifndef __ANTARES_LIBS_ARRAY_MATRIX_TO_BUFFER_SENDER_H__
23#define __ANTARES_LIBS_ARRAY_MATRIX_TO_BUFFER_SENDER_H__
24
25#include <yuni/core/string.h>
26
27namespace Antares
28{
29template<class T, class ReadWriteT>
30class Matrix;
31}
32
33namespace Antares
34{
35// Forward declarations
36const char* get_format(bool isDecimal, uint precision);
37template<class T, class ReadWriteT, class PredicateT>
38class I_mtx_to_buffer_dumper;
39
41{
42public:
44 {
45 }
46
48 {
49 }
50
51 template<class T, class ReadWriteT, class PredicateT>
53 std::string& data,
54 PredicateT& predicate);
55};
56
57template<class T, class ReadWriteT, class PredicateT>
59{
60public:
62 std::string& data,
63 PredicateT& predicate):
64 mtx_(mtx),
65 buffer_(data),
66 predicate_(predicate),
67 format_(nullptr)
68 {
69 }
70
71 void set_print_format(bool isDecimal, uint precision);
72 virtual void run() = 0;
73
75 {
76 delete format_;
77 }
78
79protected:
80 const Matrix<T, ReadWriteT>* mtx_;
81 std::string& buffer_;
82 PredicateT& predicate_;
83 const char* format_;
84};
85
86template<class T, class ReadWriteT, class PredicateT>
87class one_column__dumper: public I_mtx_to_buffer_dumper<T, ReadWriteT, PredicateT>
88{
89public:
90 one_column__dumper(const Matrix<T, ReadWriteT>* mtx, std::string& data, PredicateT& predicate):
92 {
93 }
94
95 void run() override;
96};
97
98template<class T, class ReadWriteT, class PredicateT>
99class multiple_columns__dumper: public I_mtx_to_buffer_dumper<T, ReadWriteT, PredicateT>
100{
101public:
103 std::string& data,
104 PredicateT& predicate):
106 {
107 }
108
109 void run() override;
110};
111
112} // namespace Antares
113
114#include "matrix-to-buffer.hxx"
115
116#endif // __ANTARES_LIBS_ARRAY_MATRIX_TO_BUFFER_SENDER_H__
Definition matrix-to-buffer.h:59
A n-by-n matrix.
Definition jit.h:30
Definition matrix-to-buffer.h:41
Definition matrix-to-buffer.h:100
Definition matrix-to-buffer.h:88