31#include "datastorage.hpp"
35#include "sysutils_p3.hpp"
41#include <initializer_list>
48#define GDX_NS gdxlib::
51namespace GDX_NS gdlib::gmsstrm
63 constexpr explicit operator int *()
noexcept {
return data(); }
64 constexpr explicit operator const int *()
const noexcept {
return data(); }
66class TgdxValues :
public std::array<double, GMS_VAL_SCALE + 1> {
68 constexpr explicit operator double*()
noexcept {
return data(); }
69 constexpr explicit operator const double *()
const noexcept {
return data(); }
72using TDomainIndexProc_t = void ( * )(
int RawIndex,
int MappedIndex,
void *Uptr );
73using TDataStoreProc_t = void ( * )(
const int *Indx,
const double *Vals );
74using TDataStoreFiltProc_t = int ( * )(
const int *Indx,
const double *Vals,
void *Uptr );
75using TDataStoreExProc_t = int ( * )(
const int *Indx,
const double *Vals,
const int afdim,
void *Uptr );
77using TDataStoreExProc_F = int ( * )(
const int *Indx,
const double *Vals,
const int afdim, int64_t Uptr );
78using TDataStoreFiltProc_F = int ( * )(
const int *Indx,
const double *Vals, int64_t Uptr );
79using TDomainIndexProc_F = void ( * )(
int RawIndex,
int MappedIndex, int64_t Uptr );
81const std::array<int, GMS_DT_ALIAS + 1> DataTypSize { 1, 1, 5, 5, 0 };
83constexpr int DOMC_UNMAPPED = -2,
87constexpr std::string_view BADUEL_PREFIX =
"?L__",
88 BADStr_PREFIX =
"?Str__",
89 strGDXCOMPRESS =
"GDXCOMPRESS",
90 strGDXCONVERT =
"GDXCONVERT";
93 int FiltNumber {}, FiltMaxUel {};
94 gdlib::gmsobj::TBooleanBitArray FiltMap {};
97 TDFilter(
int Nr,
int UserHigh ) : FiltNumber { Nr },
98 FiltMaxUel { UserHigh }
104 [[nodiscard]]
int MemoryUsed()
const
106 return FiltMap.MemoryUsed();
109 [[nodiscard]]
bool InFilter(
int V )
const
111 return V >= 0 && V <= FiltMaxUel && FiltMap.GetBit( V );
114 void SetFilter(
int ix,
bool v )
116 FiltMap.SetBit( ix, v );
120using TSetBitMap = gdlib::gmsobj::TBooleanBitArray;
122enum class TgdxDAction : uint8_t
135using TDomainList = std::array<TDomain, GLOBAL_MAX_INDEX_DIM>;
137using TCommentsList = gdlib::gmsobj::TXStrings;
142 int SDim, SDataCount, SErrors;
146 utils::sstring SExplTxt;
149 std::unique_ptr<int[]> SDomSymbols,
151 std::optional<TCommentsList> SCommentsList;
152 std::unique_ptr<TSetBitMap> SSetBitMap;
156enum TgdxIntlValTyp : uint8_t
172enum TgxFileMode : uint8_t
195class TgxModeSet final :
public utils::IContainsPredicate<TgxFileMode>
197 std::array<bool, tgxfilemode_count> modeActive {};
201 constexpr TgxModeSet(
const std::initializer_list<TgxFileMode> &modes )
203 for(
const auto mode: modes )
205 modeActive[mode] =
true;
211 [[nodiscard]]
bool contains(
const TgxFileMode &mode )
const override;
212 [[nodiscard]]
bool empty()
const;
215enum class TgdxElemSize : uint8_t
228 int64_t FCapacity {}, FMapBytes {};
229 int64_t FMAXCAPACITY { std::numeric_limits<int>::max() +
static_cast<int64_t
>( 1 ) };
230 int FHighestIndex {};
233 void growMapping(
int F );
238 [[nodiscard]]
int MemoryUsed()
const;
239 [[nodiscard]]
int GetHighestIndex()
const;
240 [[nodiscard]]
int GetMapping(
int F )
const;
241 void SetMapping(
int F,
int T );
242 [[nodiscard]]
int size()
const;
243 [[nodiscard]]
bool empty()
const;
247enum class TUELUserMapStatus : uint8_t
257using TXStrHashListImpl = gdlib::strhash::TXStrHashList<T>;
260using TXCSStrHashListImpl = gdlib::strhash::TXCSStrHashList<T>;
264 TUELUserMapStatus FMapToUserStatus { TUELUserMapStatus::map_unknown };
267 std::unique_ptr<TIntegerMapping> UsrUel2Ent {};
269 [[nodiscard]]
int size()
const;
270 [[nodiscard]]
bool empty()
const;
271 [[nodiscard]]
int GetUserMap(
int i )
const;
272 void SetUserMap(
int EN,
int N );
273 int NewUsrUel(
int EN );
274 int AddUsrNew(
const char *s,
size_t slen );
275 int AddUsrIndxNew(
const char *s,
size_t slen,
int UelNr );
276 [[nodiscard]]
int GetMaxUELLength()
const;
277 const char *operator[](
int index )
const;
278 [[nodiscard]]
int MemoryUsed()
const;
279 void LoadFromStream( gdlib::gmsstrm::TXStream &S );
280 TUELUserMapStatus GetMapToUserStatus();
281 void ResetMapToUserStatus();
284int MakeGoodExplText(
char *s );
287 std::string AcrName, AcrText;
288 int AcrMap {}, AcrReadMap { -1 };
291 TAcronym(
const char *Name,
const char *Text,
int Map );
292 explicit TAcronym( gdlib::gmsstrm::TXStream &S );
295 [[nodiscard]]
int MemoryUsed()
const;
296 void SaveToStream( gdlib::gmsstrm::TXStream &S )
const;
297 void SetNameAndText(
const char *Name,
const char *Text );
302 bool useBatchAlloc {};
303 gdlib::gmsobj::TXList<TAcronym> FList;
304 gdlib::batchalloc::BatchAllocator<
sizeof(
TAcronym)> batchAlloc;
308 explicit TAcronymList(
bool _useBatchAlloc) : useBatchAlloc{_useBatchAlloc} {}
310 int FindEntry(
int Map );
311 int FindName(
const char *Name );
312 int AddEntry(
const char *Name,
const char *Text,
int Map );
313 void CheckEntry(
int Map );
314 void SaveToStream( gdlib::gmsstrm::TXStream &S );
315 void LoadFromStream( gdlib::gmsstrm::TXStream &S );
317 [[nodiscard]]
int size()
const;
323 gdlib::gmsobj::TXList<TDFilter> FList;
329 void DeleteFilter(
int ix );
331 [[nodiscard]]
size_t MemoryUsed()
const;
334using TIntlValueMapDbl = std::array<double, vm_count>;
335using TIntlValueMapI64 = std::array<int64_t, vm_count>;
337using LinkedDataType = gdlib::datastorage::TLinkedData<int, double>;
338using LinkedDataIteratorType = gdlib::datastorage::TLinkedDataRec<int, double> *;
340using TSetTextList = TXCSStrHashListImpl<int>;
342using TNameList = TXStrHashListImpl<PgdxSymbRecord>;
345using TTblGamsDataImpl = gdlib::gmsdata::TTblGamsData<T>;
347using TDomainStrList = TXStrHashListImpl<uint8_t>;
349enum tvarvaltype : uint8_t
358extern p3_global_storage std::string DLLLoadPath;
366bool IsGoodIdent(
const char *S );
367bool CanBeQuoted(
const char *s,
size_t slen );
368bool GoodUELString(
const char *s,
size_t slen );
370int ConvertGDXFile(
const std::string &fn,
const std::string &MyComp );
Definition: gxfile.hpp:301
Definition: gxfile.hpp:322
Definition: gxfile.hpp:227
Definition: gxfile.hpp:263
Definition: gxfile.hpp:61
Definition: gxfile.hpp:66
Definition: gxfile.hpp:196
Definition: gxfile.hpp:286
Definition: gxfile.hpp:92
Definition: gxfile.hpp:130
Definition: gxfile.hpp:139
Definition: gxfile.hpp:361