File: UnitParametersManager.h

package info (click to toggle)
dyssol 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,184 kB
  • sloc: cpp: 53,870; sh: 85; python: 59; makefile: 11
file content (1005 lines) | stat: -rw-r--r-- 45,314 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
/* Copyright (c) 2020, Dyssol Development Team.
 * Copyright (c) 2024, DyssolTEC GmbH.
 * All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */

#pragma once

#include <vector>
#include <string>
#include <map>
#include <memory>

#include "UnitParameters.h"

/**
 * \brief Manager of unit parameters for each unit.
 * \details Each parameter may be a member of one or several groups, to allow showing / hiding of some parameters in GUI.
 * Block is defined by a single CComboUnitParameter or CCheckboxUnitParameter and may have several options to choose.
 * Each option is a group of one or several parameters, which should be shown / hidden together, depending on the selection of the corresponding CComboUnitParameter or CCheckboxUnitParameter.
 * One parameter can belong to several groups and several blocks.
 * Block is stored as an index of a CComboUnitParameter or CCheckboxUnitParameter. Group is stored as indices of parameters, which belong to this group.
 */
class CUnitParametersManager
{
	static constexpr unsigned m_cnSaveVersion{ 1 };

	using group_map_t = std::map<size_t, std::map<size_t, std::vector<size_t>>>; ///< map<iParameter, map<iBlock, vector<iGroups>>>

	std::vector<std::unique_ptr<CBaseUnitParameter>> m_parameters; ///< All parameters.
	group_map_t m_groups;                                          ///< List of group blocks and corresponding groups, to which parameters belong. Is used to determine activity of parameters.

public:
	/**
	 * \private
	 * \brief Default constructor.
	 */
	CUnitParametersManager() = default;
	/**
	 * \private
	 * \brief Copy constructor.
	 */
	CUnitParametersManager(const CUnitParametersManager& _other);
	/**
	 * \private
	 * \brief Move constructor.
	 */
	CUnitParametersManager(CUnitParametersManager&& _other) noexcept;
	/**
	 * \private
	 * \brief Copy assignment operator.
	 */
	CUnitParametersManager& operator=(CUnitParametersManager _other);
	/**
	 * \private
	 * \brief Move assignment operator.
	 */
	CUnitParametersManager& operator=(CUnitParametersManager&& _other) noexcept;
	/**
	 * \private
	 * \brief Destructor.
	 */
	~CUnitParametersManager() = default;

	/**
	 * \brief Swaps the content of two managers.
	 * \param _first First manager.
	 * \param _second Second manager.
	 */
	friend void swap(CUnitParametersManager& _first, CUnitParametersManager& _second) noexcept;

	/**
	 * \brief Returns number of specified unit parameters.
	 * \return Number of parameters defined in the unit.
	 */
	size_t ParametersNumber() const;
	/**
	 * \brief Checks whether unit parameter with given name exists.
	 * \param _name Name of unit parameter.
	 * \return Whether unit parameter with given name exists.
	 */
	bool IsNameExist(const std::string& _name) const;

	/**
	 * \private
	 * \brief Adds new real constant unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddConstRealParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, double _min, double _max, double _value);
	/**
	 * \private
	 * \brief Adds new signed integer constant unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddConstIntParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, int64_t _min, int64_t _max, int64_t _value);
	/**
	 * \private
	 * \brief Adds new unsigned integer constant unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddConstUIntParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, uint64_t _min, uint64_t _max, uint64_t _value);
	/**
	 * \private
	 * \brief Adds new dependent unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddDependentParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, double _min, double _max, double _value, const std::string& _paramName, const std::wstring& _paramUnits, double _paramMin, double _paramMax, double _paramValue);
	/**
	 * \private
	 * \brief Adds new time-dependent unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddTDParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, double _min, double _max, double _value);
	/**
	 * \private
	 * \brief Adds new string unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddStringParameter(const std::string& _name, const std::string& _description, const std::string& _value);
	/**
	 * \private
	 * \brief Adds new check box unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddCheckBoxParameter(const std::string& _name, const std::string& _description, bool _value);
	/**
	 * \private
	 * \brief Adds new solver unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddSolverParameter(const std::string& _name, const std::string& _description, ESolverTypes _type);
	/**
	 * \private
	 * \brief Adds new combo unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddComboParameter(const std::string& _name, const std::string& _description, size_t _itemDefault, const std::vector<size_t>& _items, const std::vector<std::string>& _itemsNames);
	/**
	 * \private
	 * \brief Adds new compound unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddCompoundParameter(const std::string& _name, const std::string& _description);
	/**
	 * \private
	 * \brief Adds new MDB compound unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddMDBCompoundParameter(const std::string& _name, const std::string& _description);
	/**
	 * \private
	 * \brief Adds new reaction unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddReactionParameter(const std::string& _name, const std::string& _description);
	/**
	 * \private
	 * \brief Adds new real list unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddListRealParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, double _min, double _max, const std::vector<double>& _values);
	/**
	 * \private
	 * \brief Adds new signed integer list unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddListIntParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, int64_t _min, int64_t _max, const std::vector<int64_t>& _values);
	/**
	 * \private
	 * \brief Adds new unsigned integer list unit parameter.
	 * \details If parameter with the given name already exists, does nothing.
	 */
	void AddListUIntParameter(const std::string& _name, const std::wstring& _units, const std::string& _description, uint64_t _min, uint64_t _max, const std::vector<uint64_t>& _values);

	/**
	 * \brief Returns list of all defined unit parameters.
	 * \return List of all defined unit parameters.
	 */
	[[nodiscard]] std::vector<CBaseUnitParameter*> GetParameters() const;
	/**
	 * \private
	 * \brief Returns list of all defined unit parameters of the given type.
	 * \return List of unit parameters.
	 */
	template <EUnitParameter... Args, std::enable_if_t<(sizeof...(Args) > 0), bool> = true>
	[[nodiscard]] std::vector<CBaseUnitParameter*> GetParameters() const
	{
		std::vector<CBaseUnitParameter*> result;
		auto loop = [this](std::vector<CBaseUnitParameter*>& _result, EUnitParameter _param)
			{
				for (size_t i = 0; i < ParametersNumber(); ++i)
				{
					const CBaseUnitParameter* unitParameter = GetParameter(i);
					if (unitParameter && unitParameter->GetType() == _param)
						_result.emplace_back(const_cast<CBaseUnitParameter*>(unitParameter));
				}
			};

		(loop(result, Args), ...);

		return result;
	}

	/**
	 * \brief Returns list of all active unit parameters.
	 * \return List of all active unit parameters.
	 */
	[[nodiscard]] std::vector<CBaseUnitParameter*> GetActiveParameters() const;

	/**
	 * \brief Returns const pointer to the unit parameter with the specified index.
	 * \param _index Index of the unit parameter.
	 * \return Const pointer to the unit parameter.
	 */
	const CBaseUnitParameter* GetParameter(size_t _index) const;
	/**
	 * \brief Returns const pointer to the unit parameter with the specified index.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CBaseUnitParameter* GetParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the unit parameter with the specified name.
	 * \param _name Name of the unit parameter.
	 * \return Const pointer to the unit parameter.
	 */
	const CBaseUnitParameter* GetParameter(const std::string& _name) const;
	/**
	 * \brief Returns const pointer to the unit parameter with the specified name.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CBaseUnitParameter* GetParameter(const std::string& _name);

	/**
	 * \brief Returns const pointer to the real constant unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CConstRealUnitParameter* GetConstRealParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the constant real unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CConstRealUnitParameter* GetConstRealParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the signed integer constant unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CConstIntUnitParameter* GetConstIntParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the constant signed integer unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CConstIntUnitParameter* GetConstIntParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the unsigned integer constant unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CConstUIntUnitParameter* GetConstUIntParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the constant unsigned integer unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CConstUIntUnitParameter* GetConstUIntParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the dependent unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CDependentUnitParameter* GetDependentParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the dependent unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CDependentUnitParameter* GetDependentParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the time-dependent unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CTDUnitParameter* GetTDParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the time-dependent unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CTDUnitParameter* GetTDParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the string unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CStringUnitParameter* GetStringParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the string unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CStringUnitParameter* GetStringParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the check box unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CCheckBoxUnitParameter* GetCheckboxParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the check box unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CCheckBoxUnitParameter* GetCheckboxParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the solver unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CSolverUnitParameter* GetSolverParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the solver unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CSolverUnitParameter* GetSolverParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the combo unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CComboUnitParameter* GetComboParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the combo unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CComboUnitParameter* GetComboParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the compound unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CCompoundUnitParameter* GetCompoundParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the compound unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CCompoundUnitParameter* GetCompoundParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the MDB compound unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CMDBCompoundUnitParameter* GetMDBCompoundParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the MDB compound unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CMDBCompoundUnitParameter* GetMDBCompoundParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the reaction unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CReactionUnitParameter* GetReactionParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the reaction unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CReactionUnitParameter* GetReactionParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the real list unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CListRealUnitParameter* GetListRealParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the list real unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CListRealUnitParameter* GetListRealParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the signed integer list unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CListIntUnitParameter* GetListIntParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the signed integer list unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CListIntUnitParameter* GetListIntParameter(size_t _index);
	/**
	 * \brief Returns const pointer to the unsigned integer list unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CListUIntUnitParameter* GetListUIntParameter(size_t _index) const;
	/**
	 * \brief Returns pointer to the unsigned integer list unit parameter with the specified index.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CListUIntUnitParameter* GetListUIntParameter(size_t _index);

	/**
	 * \brief Returns const pointer to the real constant unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CConstRealUnitParameter* GetConstRealParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the constant real unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CConstRealUnitParameter* GetConstRealParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the signed integer constant unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CConstIntUnitParameter* GetConstIntParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the constant signed integer unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CConstIntUnitParameter* GetConstIntParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the unsigned integer constant unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CConstUIntUnitParameter* GetConstUIntParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the constant unsigned integer unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CConstUIntUnitParameter* GetConstUIntParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the dependent unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CDependentUnitParameter* GetDependentParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the time-dependent unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CDependentUnitParameter* GetDependentParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the time-dependent unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CTDUnitParameter* GetTDParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the time-dependent unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CTDUnitParameter* GetTDParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the string unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CStringUnitParameter* GetStringParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the string unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CStringUnitParameter* GetStringParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the check box unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CCheckBoxUnitParameter* GetCheckboxParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the check box unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CCheckBoxUnitParameter* GetCheckboxParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the solver unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CSolverUnitParameter* GetSolverParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the solver unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CSolverUnitParameter* GetSolverParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the combo unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CComboUnitParameter* GetComboParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the combo unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CComboUnitParameter* GetComboParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the compound unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CCompoundUnitParameter* GetCompoundParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the compound unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CCompoundUnitParameter* GetCompoundParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the MDB compound unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CMDBCompoundUnitParameter* GetMDBCompoundParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the MDB compound unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CMDBCompoundUnitParameter* GetMDBCompoundParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the reaction unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CReactionUnitParameter* GetReactionParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the reaction unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CReactionUnitParameter* GetReactionParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the real list unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CListRealUnitParameter* GetListRealParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the list real unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CListRealUnitParameter* GetListRealParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the signed integer list unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CListIntUnitParameter* GetListIntParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the list signed integer unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CListIntUnitParameter* GetListIntParameter(const std::string& _name);
	/**
	 * \brief Returns const pointer to the unsigned integer list unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	const CListUIntUnitParameter* GetListUIntParameter(const std::string& _name) const;
	/**
	 * \brief Returns pointer to the list unsigned integer unit parameter with the specified _name.
	 * \details If such parameter does not exist, returns nullptr.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	CListUIntUnitParameter* GetListUIntParameter(const std::string& _name);

	/**
	 * \brief Returns value of a constant real unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a constant real parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	double GetConstRealParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a constant signed integer unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a constant signed integer parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	int64_t GetConstIntParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a constant unsigned integer unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a constant unsigned integer parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	uint64_t GetConstUIntParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a dependent unit parameter with the specified _index and _param.
	 * \details If such parameter does not exist or is not a dependent parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \param _param Dependent parameter.
	 * \return Pointer to the unit parameter.
	 */
	double GetDependentParameterValue(size_t _index, double _param) const;
	/**
	 * \brief Returns value of a TD unit parameter with the specified _index and _time.
	 * \details If such parameter does not exist or is not a TD parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \param _time Time point.
	 * \return Pointer to the unit parameter.
	 */
	double GetTDParameterValue(size_t _index, double _time) const;
	/**
	 * \brief Returns value of a string unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a string parameter, returns "".
		 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetStringParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a check box unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a check box parameter, returns false.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	bool GetCheckboxParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a solver unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a solver parameter, returns "".
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetSolverParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a combo unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a combo parameter, returns -1.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	size_t GetComboParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a compound unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a compound parameter, returns "".
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetCompoundParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a MDB compound unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a MDB compound parameter, returns "".
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetMDBCompoundParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a reaction unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a reaction parameter, returns empty vector.
	 * \param _index Index of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::vector<CChemicalReaction> GetReactionParameterValue(size_t _index) const;
	/**
	 * \brief Returns value of a list real unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a list real parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \param _valueIndex Index of the value.
	 * \return Pointer to the unit parameter.
	 */
	double GetListRealParameterValue(size_t _index, size_t _valueIndex) const;
	/**
	 * \brief Returns value of a list signed integer unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a list signed integer parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \param _valueIndex Index of the value.
	 * \return Pointer to the unit parameter.
	 */
	int64_t GetListIntParameterValue(size_t _index, size_t _valueIndex) const;
	/**
	 * \brief Returns value of a list unsigned integer unit parameter with the specified _index.
	 * \details If such parameter does not exist or is not a list unsigned integer parameter, returns 0.
	 * \param _index Index of the unit parameter.
	 * \param _valueIndex Index of the value.
	 * \return Pointer to the unit parameter.
	 */
	uint64_t GetListUIntParameterValue(size_t _index, size_t _valueIndex) const;

	/**
	 * \brief Returns value of a constant real unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a constant real parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	double GetConstRealParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a constant signed integer unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a constant signed integer parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	int64_t GetConstIntParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a constant unsigned integer unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a constant unsigned integer parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	uint64_t GetConstUIntParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a dependent unit parameter with the specified _name and _param.
	 * \details If such parameter does not exist or is not a dependent parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \param _param Dependent parameter.
	 * \return Pointer to the unit parameter.
	 */
	double GetDependentParameterValue(const std::string& _name, double _param) const;
	/**
	 * \brief Returns value of a TD unit parameter with the specified _name and _time.
	 * \details If such parameter does not exist or is not a TD parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \param _time Time point.
	 * \return Pointer to the unit parameter.
	 */
	double GetTDParameterValue(const std::string& _name, double _time) const;
	/**
	 * \brief Returns value of a string unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a string parameter, returns "".
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetStringParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a check box unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a check box parameter, returns "".
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	bool GetCheckboxParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a solver unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a solver parameter, returns "".
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetSolverParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a combo unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a combo parameter, returns -1.
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	size_t GetComboParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a compound unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a compound parameter, returns "".
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetCompoundParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a MDB compound unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a MDB compound parameter, returns "".
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::string GetMDBCompoundParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a reaction unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a reaction parameter, returns "".
	 * \param _name Name of the unit parameter.
	 * \return Pointer to the unit parameter.
	 */
	std::vector<CChemicalReaction> GetReactionParameterValue(const std::string& _name) const;
	/**
	 * \brief Returns value of a list real unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a list real parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \param _index Index of the value in the list.
	 * \return Pointer to the unit parameter.
	 */
	double GetListRealParameterValue(const std::string& _name, size_t _index) const;
	/**
	 * \brief Returns value of a list signed integer unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a list signed integer parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \param _index Index of the value in the list.
	 * \return Pointer to the unit parameter.
	 */
	int64_t GetListIntParameterValue(const std::string& _name, size_t _index) const;
	/**
	 * \brief Returns value of a list unsigned integer unit parameter with the specified _name.
	 * \details If such parameter does not exist or is not a list unsigned integer parameter, returns 0.
	 * \param _name Name of the unit parameter.
	 * \param _index Index of the value in the list.
	 * \return Pointer to the unit parameter.
	 */
	uint64_t GetListUIntParameterValue(const std::string& _name, size_t _index) const;

	/**
	 * \private
	 * \brief Returns const pointers to all specified reaction unit parameters.
	 * \return Const pointers to all reaction unit parameters.
	 */
	std::vector<const CReactionUnitParameter*> GetAllReactionParameters() const;
	/**
	 * \private
	 * \brief Returns pointers to all specified reaction unit parameters.
	 * \return Pointers to all reaction unit parameters.
	 */
	std::vector<CReactionUnitParameter*> GetAllReactionParameters();
	/**
	 * \private
	 * \brief Returns const pointers to all specified compound and MDB compound unit parameters.
	 * \return Const pointers to all compound and MDB compound unit parameters.
	 */
	std::vector<const CCompoundUnitParameter*> GetAllCompoundParameters() const;
	/**
	 * \private
	 * \brief Returns pointers to all specified compound and MDB compound unit parameters.
	 * \return Pointers to all compound and MDB compound unit parameters.
	 */
	std::vector<CCompoundUnitParameter*> GetAllCompoundParameters();

	/**
	 * \private
	 * \brief Returns const pointers to all specified solver unit parameters.
	 * \return Const pointers to all specified solver unit parameters.
	 */
	std::vector<const CSolverUnitParameter*> GetAllSolverParameters() const;
	/**
	 * \private
	 * \brief Returns pointers to all specified solver unit parameters.
	 * \return Pointers to all specified solver unit parameters.
	 */
	std::vector<CSolverUnitParameter*> GetAllSolverParameters();
	/**
	 * \brief Returns a sorted list of time points defined in all unit parameters.
	 * \return Sorted vector of time points.
	 */
	[[nodiscard]] std::vector<double> GetAllTimePoints() const;
	/**
	 * \brief Returns a sorted list of time points form the given interval defined in all unit parameters.
	 * \param _tBeg Begin of the time interval.
	 * \param _tEnd End of the time interval.
	 * \return Sorted vector of time points.
	 */
	[[nodiscard]] std::vector<double> GetAllTimePoints(double _tBeg, double _tEnd) const;

	/**
	 * \brief Adds the list of parameters by their indices to existing group of existing block.
	 * \details If block, group or some of the parameters do not exist, does nothing.
	 * \param _block Index of a block of unit parameters.
	 * \param _group Index of a group of unit parameters shown/hidden together.
	 * \param _parameters Indices of unit parameters to add to the group.
	 */
	void AddParametersToGroup(size_t _block, size_t _group, const std::vector<size_t>& _parameters);
	/**
	 * \brief Adds the list of _parameters by their names to existing _group of existing _block.
	 * \details If block, group or some of the parameters do not exist, does nothing.
	 * \param _block Name of a block of unit parameters (name of the combobox unit parameter).
	 * \param _group Value of the combobox, specifying a group of unit parameters shown/hidden together.
	 * \param _parameters Names of unit parameters to add to the group.
	 */
	void AddParametersToGroup(const std::string& _block, const std::string& _group, const std::vector<std::string>& _parameters);
	/**
	 * \brief Adds the list of _parameters by their names to existing _group of existing _block.
	 * \details If block, group or some of the parameters do not exist, does nothing.
	 * \param _block Name of a block of unit parameters (name of the checkbox unit parameter).
	 * \param _group Value of the checkbox, specifying a group of unit parameters shown/hidden together.
	 * \param _parameters Names of unit parameters to add to the group.
	 */
	void AddParametersToGroup(const std::string & _block, bool _group, const std::vector<std::string>&_parameters);
	/**
	 * \brief Returns true if unit parameter with the specified index is selected in at least one group of any block, or if it is a not grouped parameter.
	 * \param _index Index of the unit parameter.
	 * \return Whether unit parameter is selected in one of the groups.
	 */
	bool IsParameterActive(size_t _index) const;
	/**
	 * \brief Returns true if this parameter is selected in at least one group of any block, or if it is a not grouped parameter.
	 * \param _parameter Reference to unit parameter.
	 * \return Whether unit parameter is selected in one of the groups.
	 */
	bool IsParameterActive(const CBaseUnitParameter& _parameter) const;
	/**
	 * \brief Returns true if the given unit parameter defines a group of parameters.
	 * \param _parameter Reference to unit parameter.
	 * \return Whether unit parameter is selected in the group.
	 */
	[[nodiscard]] bool IsGroupSelector(const CBaseUnitParameter& _parameter) const;

	/**
	 * \private
	 * \brief Clears all parameter groups.
	 */
	void ClearGroups();

	/**
	 * \private
	 * \brief Saves data to file.
	 * \param _h5Saver Reference to the file handler.
	 * \param _path Path to data in the file.
	 */
	void SaveToFile(CH5Handler& _h5Saver, const std::string& _path);
	/**
	 * \private
	 * \brief Loads data from file.
	 * \param _h5Loader Reference to the file handler.
	 * \param _path Path to data in the file.
	 */
	void LoadFromFile(const CH5Handler& _h5Loader, const std::string& _path);

private:
	/**
	 * \brief Makes parameter with index _parameter a member of the corresponding _block and _group.
	 */
	void AddToGroup(size_t _parameter, size_t _block, size_t _group);

	/**
	 * \brief Returns index of a unit parameter with the given name.
	 */
	size_t Name2Index(const std::string& _name) const;
	/**
	 * \brief Returns indices of unit parameter with the given names.
	 */
	std::vector<size_t> Name2Index(const std::vector<std::string>& _names) const;
};