GAMS Data eXchange (GDX) API
Low-level "eXPert level" C++ API for reading and writing GAMS Data eXchange files
Loading...
Searching...
No Matches
gdx.hpp
1/*
2 * GAMS - General Algebraic Modeling System GDX API
3 *
4 * Copyright (c) 2017-2025 GAMS Software GmbH <support@gams.com>
5 * Copyright (c) 2017-2025 GAMS Development Corp. <support@gams.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26// WARNING: This file is generated by the "yaml2doxy" script from the API definition file "gdxapi.yaml"
27
28#pragma once
29
30#include "gxfile.hpp"
31
32namespace gdx
33{
34
37{
38public:
44 explicit TGXFileObj( std::string &ErrMsg );
45
52
53 enum class TraceLevels : uint8_t
54 {
55 trl_none,
56 trl_errors,
57 trl_some,
58 trl_all
59 };
60 void SetTraceLevel( TraceLevels tl );
61
68 [[nodiscard]] int gdxStoreDomainSets() const;
69
76 void gdxStoreDomainSetsSet(int flag);
77
88 [[nodiscard]] int gdxAllowBogusDomains() const;
89
101 void gdxAllowBogusDomainsSet(int flag);
102
107 [[nodiscard]] int gdxMapAcronymsToNaN() const;
108
113 void gdxMapAcronymsToNaNSet(int flag);
114
126 int gdxAddAlias( const char *Id1, const char *Id2 );
127
136 int gdxAutoConvert( int NV );
137
142 int64_t gdxGetMemoryUsed();
143
146
171 int gdxAcronymAdd( const char *AName, const char *Txt, int AIndx );
172
178 int gdxAcronymCount() const;
179
192 int gdxAcronymGetInfo( int N, char *AName, char *Txt, int &AIndx ) const;
193
209 int gdxAcronymGetMapping( int N, int &orgIndx, int &newIndx, int &autoIndex );
210
217 int gdxAcronymIndex( double V ) const;
218
230 int gdxAcronymName( double V, char *AName );
231
248 int gdxAcronymNextNr( int NV );
249
272 int gdxAcronymSetInfo( int N, const char *AName, const char *Txt, int AIndx );
273
281 double gdxAcronymValue( int AIndx ) const;
282
284
285
288
297 int gdxSymbolAddComment( int SyNr, const char *Txt );
298
309 int gdxSymbolGetComment( int SyNr, int N, char *Txt );
310
312
313
316
326 int gdxSymbolGetDomain( int SyNr, int *DomainSyNrs );
327
354 int gdxSymbolGetDomainX( int SyNr, char **DomainIDs );
355
369 int gdxSymbolSetDomain( const char **DomainIDs );
370
383 int gdxSymbolSetDomainX( int SyNr, const char **DomainIDs );
384
414 int gdxGetDomainElements( int SyNr, int DimPos, int FilterNr, TDomainIndexProc_t DP, int &NrElem, void *Uptr );
415
417
418
421
426 int gdxErrorCount() const;
427
436 int gdxErrorStr( int ErrNr, char *ErrMsg ) const;
437
447 int gdxGetLastError();
448
450
451
454
461 int gdxClose();
462
485 int gdxOpenAppend( const char *FileName, const char *Producer, int &ErrNr );
486
505 int gdxOpenRead( const char *FileName, int &ErrNr );
506
526 int gdxOpenReadEx( const char *FileName, int ReadMode, int &ErrNr );
527
539 int gdxOpenWrite( const char *FileName, const char *Producer, int &ErrNr );
540
569 int gdxOpenWriteEx( const char *FileName, const char *Producer, int Compr, int &ErrNr );
570
572
573
576
583 int gdxFilterExists( int FilterNr );
584
595 int gdxFilterRegister( int UelMap );
596
603
613 int gdxFilterRegisterStart( int FilterNr );
614
616
617
620
636 int gdxFindSymbol( const char *SyId, int &SyNr );
637
648 int gdxGetUEL( int UelNr, char *Uel ) const;
649
651
652
655
664 int gdxSymbIndxMaxLength( int SyNr, int *LengthInfo );
665
670 int gdxSymbMaxLength() const;
671
677 int gdxUELMaxLength() const;
678
680
681
684
694 int gdxDataErrorCount() const;
695
716 int gdxDataErrorRecord( int RecNr, int *KeyInt, double *Values );
717
736 int gdxDataErrorRecordX( int RecNr, int *KeyInt, double *Values );
737
744 int gdxDataReadDone();
745
806 int gdxDataReadFilteredStart( int SyNr, const int *FilterAction, int &NrRecs );
807
817 int gdxDataReadMap( int RecNr, int *KeyInt, double *Values, int &DimFrst );
818
827 int gdxDataReadMapStart( int SyNr, int &NrRecs );
828
838 int gdxDataReadRaw( int *KeyInt, double *Values, int &DimFrst );
839
860 int gdxDataReadRawFast( int SyNr, TDataStoreProc_t DP, int &NrRecs );
861
889 int gdxDataReadRawFastEx( int SyNr, TDataStoreExProc_t DP, int &NrRecs, void *Uptr );
890
930 int gdxDataReadRawFastFilt( int SyNr, const char **UelFilterStr, TDataStoreFiltProc_t DP );
931
940 int gdxDataReadRawStart( int SyNr, int &NrRecs );
941
963 int gdxDataReadSlice( const char **UelFilterStr, int &Dimen, TDataStoreProc_t DP );
964
974 int gdxDataReadSliceStart( int SyNr, int *ElemCounts );
975
993 int gdxDataReadStr( char **KeyStr, double *Values, int &DimFrst );
994
1013 int gdxDataReadStrStart( int SyNr, int &NrRecs );
1014
1026 int gdxDataSliceUELS( const int *SliceKeyInt, char **KeyStr );
1027
1029
1030
1033
1041 int gdxGetSpecialValues( double *AVals );
1042
1050 int gdxMapValue( double D, int &sv );
1051
1058
1070 int gdxSetReadSpecialValues( const double *AVals );
1071
1084 int gdxSetSpecialValues( const double *AVals );
1085
1087
1088
1091
1097 int gdxFileInfo( int &FileVer, int &ComprLev ) const;
1098
1105 int gdxSymbolDim( int SyNr );
1106
1118 int gdxSymbolInfo( int SyNr, char *SyId, int &Dimen, int &Typ );
1119
1183 int gdxSymbolInfoX( int SyNr, int &RecCnt, int &UserInfo, char *ExplTxt );
1184
1191 int gdxSystemInfo( int &SyCnt, int &UelCnt ) const;
1192
1203 int gdxCurrentDim() const;
1204
1206
1207
1210
1222 int gdxAddSetText( const char *Txt, int &TxtNr );
1223
1259 int gdxGetElemText( int TxtNr, char *Txt, int &Node );
1260
1268 int gdxSetHasText( int SyNr );
1269
1280 int gdxSetTextNodeNr( int TxtNr, int Node );
1281
1283
1284
1287
1292 int gdxUELRegisterDone();
1293
1307 int gdxUELRegisterMap( int UMap, const char *Uel );
1308
1315
1327 int gdxUELRegisterRaw( const char *Uel );
1328
1335
1349 int gdxUELRegisterStr( const char *Uel, int &UelNr );
1350
1357
1365 int gdxUMFindUEL( const char *Uel, int &UelNr, int &UelMap );
1366
1376 int gdxUMUelGet( int UelNr, char *Uel, int &UelMap );
1377
1385 int gdxUMUelInfo( int &UelCnt, int &HighMap ) const;
1386
1395 int gdxRenameUEL( const char *OldName, const char *NewName );
1396
1398
1399
1402
1408 static int gdxGetDLLVersion( char *V );
1409
1418 int gdxFileVersion( char *FileStr, char *ProduceStr ) const;
1419
1426 int gdxSetTraceLevel( int N, const char *s );
1427
1429
1430
1433
1439 int gdxDataWriteDone();
1440
1448 int gdxDataWriteMap( const int *KeyInt, const double *Values );
1449
1513 int gdxDataWriteMapStart( const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo );
1514
1528 int gdxDataWriteRaw( const int *KeyInt, const double *Values );
1529
1595 int gdxDataWriteRawStart( const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo );
1596
1668 int gdxDataWriteRawStartKeyBounds( const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo, const int *MinUELIndices, const int *MaxUELIndices );
1669
1724 int gdxDataWriteStr( const char **KeyStr, const double *Values );
1725
1741 int gdxDataWriteStrStart( const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo );
1742
1744
1745
1746
1747private:
1748std::unique_ptr<gdlib::gmsstrm::TMiBufferedStream> FFile;
1749std::string lastFileName {};
1750TgxFileMode fmode { f_not_open }, fmode_AftReg { f_not_open };
1751enum : uint8_t
1752{
1753 stat_notopen,
1754 stat_read,
1755 stat_write
1756} fstatus { stat_notopen };
1757int fComprLev {};
1758std::unique_ptr<TUELTable> UELTable;
1759std::unique_ptr<TSetTextList> SetTextList {};
1760std::unique_ptr<int[]> MapSetText {};
1761int FCurrentDim {};
1762std::array<int, GLOBAL_MAX_INDEX_DIM> LastElem {}, PrevElem {}, MinElem {}, MaxElem {};
1763std::array<std::array<char, GLOBAL_UEL_IDENT_SIZE>, GLOBAL_MAX_INDEX_DIM> LastStrElem {};
1764int DataSize {};
1765tvarvaltype LastDataField {};
1766std::unique_ptr<TNameList> NameList;
1767std::unique_ptr<TDomainStrList> DomainStrList;
1768std::unique_ptr<LinkedDataType> SortList;
1769std::optional<LinkedDataIteratorType> ReadPtr;
1770std::unique_ptr<TTblGamsDataImpl<double>> ErrorList;
1771PgdxSymbRecord CurSyPtr {};
1772int ErrCnt {}, ErrCntTotal {};
1773int LastError {}, LastRepError {};
1774std::unique_ptr<TFilterList> FilterList;
1775TDFilter *CurFilter {};
1776TDomainList DomainList {};
1777bool StoreDomainSets { true }, AllowBogusDomain { true }, MapAcrToNaN {};
1778TIntlValueMapDbl intlValueMapDbl {}, readIntlValueMapDbl {};
1779TIntlValueMapI64 intlValueMapI64 {};
1780TraceLevels TraceLevel { TraceLevels::trl_all };
1781std::string TraceStr;
1782int VersionRead {};
1783std::string FProducer, FProducer2, FileSystemID;
1784int64_t MajorIndexPosition {};
1785int64_t NextWritePosition {};
1786int DataCount {}, NrMappedAdded {};
1787std::array<TgdxElemSize, GLOBAL_MAX_INDEX_DIM> ElemType {};
1788std::string MajContext;
1789std::array<TIntegerMapping, GLOBAL_MAX_INDEX_DIM> SliceIndxs {}, SliceRevMap {};
1790int SliceSyNr {};
1791std::array<std::string, GMS_MAX_INDEX_DIM> SliceElems;
1792bool DoUncompress {}, // when reading
1793 CompressOut {};// when writing
1794int DeltaForWrite {}; // delta for last dimension or first changed dimension
1795int DeltaForRead {}; // first position indicating change
1796double Zvalacr {}; // tricky
1797std::unique_ptr<TAcronymList> AcronymList;
1798std::array<TSetBitMap *, GLOBAL_MAX_INDEX_DIM> WrBitMaps {};
1799bool ReadUniverse {};
1800int UniverseNr {}, UelCntOrig {};// original uel count when we open the file
1801int AutoConvert { 1 };
1802int NextAutoAcronym {};
1803bool AppendActive {};
1804
1805#ifndef VERBOSE_TRACE
1806const TraceLevels defaultTraceLevel { TraceLevels::trl_none };
1807const bool verboseTrace {};
1808#else
1809const TraceLevels defaultTraceLevel { TraceLevels::trl_all };
1810const bool verboseTrace { true };
1811#endif
1812
1813//api wrapper magic for Fortran
1814TDataStoreFiltProc_t gdxDataReadRawFastFilt_DP {};
1815TDomainIndexProc_t gdxGetDomainElements_DP {};
1816
1817bool PrepareSymbolWrite( std::string_view Caller, const char *AName, const char *AText, int ADim, int AType, int AUserInfo );
1818int PrepareSymbolRead( std::string_view Caller, int SyNr, const int *ADomainNrs, TgxFileMode newmode );
1819
1820void InitErrors();
1821void SetError( int N );
1822void ReportError( int N );
1823bool ErrorCondition( bool cnd, int N );
1824
1825bool MajorCheckMode( std::string_view Routine, TgxFileMode m );
1826bool MajorCheckMode( std::string_view Routine, const TgxModeSet &MS );
1827
1828bool CheckMode( std::string_view Routine );
1829bool CheckMode( std::string_view Routine, TgxFileMode m );
1830bool CheckMode( std::string_view Routine, const TgxModeSet &MS );
1831
1832void WriteTrace( std::string_view s ) const;
1833void InitDoWrite( int NrRecs );
1834bool DoWrite( const int *AElements, const double *AVals );
1835bool DoRead( double *AVals, int &AFDim );
1836void AddToErrorListDomErrs( const std::array<int, GLOBAL_MAX_INDEX_DIM> &AElements, const double *AVals );
1837void AddToErrorList( const int *AElements, const double *AVals );
1838void GetDefaultRecord( double *Avals ) const;
1839double AcronymRemap( double V );
1840bool IsGoodNewSymbol( const char *s );
1841bool ResultWillBeSorted( const int *ADomainNrs ) const;
1842
1843int gdxOpenReadXX( const char *Afn, int filemode, int ReadMode, int &ErrNr );
1844
1845// This one is a helper function for a callback from a Fortran client
1846void gdxGetDomainElements_DP_FC( int RawIndex, int MappedIndex, void *Uptr );
1847int gdxDataReadRawFastFilt_DP_FC( const int *Indx, const double *Vals, void *Uptr );
1848
1849void mapDefaultRecordValues(double *AVals) const;
1850
1851public:
1852bool gdxGetDomainElements_DP_CallByRef {},
1853 gdxDataReadRawFastFilt_DP_CallByRef {},
1854 gdxDataReadRawFastEx_DP_CallByRef {};
1855};
1856
1857}// namespace gdx
Definition: gdx.hpp:37
int gdxDataReadRawFastFilt(int SyNr, const char **UelFilterStr, TDataStoreFiltProc_t DP)
Read a symbol in Raw mode while applying a filter using a callback procedure. Returns zero if the ope...
Definition: gxfile.cpp:3615
int gdxSymbolAddComment(int SyNr, const char *Txt)
Add a line of comment text for a symbol. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3529
int gdxAcronymGetInfo(int N, char *AName, char *Txt, int &AIndx) const
Retrieve acronym information from the acronym table. Non-zero if the index into the acronym table is ...
Definition: gxfile.cpp:2972
int gdxDataWriteRaw(const int *KeyInt, const double *Values)
Write a data element in raw mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2221
int gdxOpenReadEx(const char *FileName, int ReadMode, int &ErrNr)
Open a GDX file for reading allowing for skipping sections. Non-zero if the file can be opened,...
Definition: gxfile.cpp:2706
int gdxDataReadFilteredStart(int SyNr, const int *FilterAction, int &NrRecs)
Initialize the reading of a symbol in filtered mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3101
int gdxSymbolGetComment(int SyNr, int N, char *Txt)
Retrieve a line of comment text for a symbol. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3549
int gdxSetTraceLevel(int N, const char *s)
Set the amount of trace (debug) information generated. Always non-zero.
Definition: gxfile.cpp:3193
int gdxAddSetText(const char *Txt, int &TxtNr)
Register a string in the string table Register a string in the string table and return the integer nu...
Definition: gxfile.cpp:2141
int gdxUELRegisterStrStart()
Start registering unique elements in string mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2639
int gdxDataWriteStr(const char **KeyStr, const double *Values)
Write a data element in string mode. Each element string must follow the GAMS rules for unique elemen...
Definition: gxfile.cpp:473
int gdxUMUelInfo(int &UelCnt, int &HighMap) const
Return information about the unique elements (UELs). Always non-zero.
Definition: gxfile.cpp:2664
int gdxMapAcronymsToNaN() const
Flag to map all acronym values to the GAMS "Not a Number" special value. Disabled by default.
Definition: gxfile.cpp:3605
int gdxFilterRegisterStart(int FilterNr)
Define a unique element filter. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3049
int gdxUELRegisterMapStart()
Start registering unique elements in mapped mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2766
static int gdxGetDLLVersion(char *V)
Returns a version descriptor of the library. Always non-zero.
Definition: gxfile.cpp:3271
int64_t gdxGetMemoryUsed()
Return the number of bytes used by the data objects.
Definition: gxfile.cpp:3404
int gdxSymbolGetDomainX(int SyNr, char **DomainIDs)
Retrieve the domain of a symbol (using relaxed or domain information). Returns zero if the operation ...
Definition: gxfile.cpp:2383
int gdxSetTextNodeNr(int TxtNr, int Node)
Set the Node number for an entry in the string table. After registering a string with AddSetText,...
Definition: gxfile.cpp:3107
double gdxAcronymValue(int AIndx) const
Create an acronym value based on the index (AIndx should be greater than 0). Returns the calculated a...
Definition: gxfile.cpp:3259
int gdxDataReadRawFast(int SyNr, TDataStoreProc_t DP, int &NrRecs)
Read a symbol in Raw mode using a callback procedure. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3668
int gdxGetLastError()
Returns the last error number or zero if there was no error. Calling this function will clear the las...
Definition: gxfile.cpp:2282
int gdxDataWriteRawStart(const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo)
Start writing a new symbol in raw mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2229
int gdxRenameUEL(const char *OldName, const char *NewName)
Rename unique element OldName to NewName.
Definition: gxfile.cpp:2684
int gdxDataErrorRecord(int RecNr, int *KeyInt, double *Values)
Retrieve an error record. Non-zero if the record number is valid.
Definition: gxfile.cpp:2160
int gdxSymbolSetDomain(const char **DomainIDs)
Define the domain of a symbol for which a write data operation just started using DataWriteRawStart,...
Definition: gxfile.cpp:2461
int gdxSymbolSetDomainX(int SyNr, const char **DomainIDs)
Define the domain of a symbol (relaxed version). Returns zero if the operation is not possible.
Definition: gxfile.cpp:2552
int gdxOpenWriteEx(const char *FileName, const char *Producer, int Compr, int &ErrNr)
Create a GDX file for writing with explicitly given compression flag. Non-zero if the file can be ope...
Definition: gxfile.cpp:398
int gdxUELRegisterRaw(const char *Uel)
Register unique element in raw mode. This can only be used while writing to a GDX file....
Definition: gxfile.cpp:2603
int gdxMapValue(double D, int &sv)
Classify a value as a potential special value. Non-zero if D is a special value, zero otherwise.
Definition: gxfile.cpp:3417
int gdxGetDomainElements(int SyNr, int DimPos, int FilterNr, TDomainIndexProc_t DP, int &NrElem, void *Uptr)
Get the unique elements for a given dimension of a given symbol.
Definition: gxfile.cpp:3119
int gdxOpenRead(const char *FileName, int &ErrNr)
Open a GDX file for reading. Non-zero if the file can be opened, zero otherwise.
Definition: gxfile.cpp:1720
int gdxStoreDomainSets() const
Get flag to store one dimensional sets as potential domains, false (0) saves lots of space for large ...
Definition: gxfile.cpp:3585
int gdxOpenAppend(const char *FileName, const char *Producer, int &ErrNr)
Open an existing GDX file for output. Non-zero if the file can be opened, zero otherwise.
Definition: gxfile.cpp:3438
void gdxStoreDomainSetsSet(int flag)
Set flag to store one dimensional sets as potential domains, false (0) saves lots of space for large ...
Definition: gxfile.cpp:3590
int gdxUELRegisterStr(const char *Uel, int &UelNr)
Register a unique element in string mode. A unique element must follow the GAMS rules when it contain...
Definition: gxfile.cpp:2627
int gdxDataWriteStrStart(const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo)
Start writing a new symbol in string mode. Returns zero if the operation is not possible or failed.
Definition: gxfile.cpp:463
int gdxUELMaxLength() const
Returns the length of the longest unique element (UEL) name.
Definition: gxfile.cpp:3564
int gdxResetSpecialValues()
Reset the internal values for special values. Always non-zero.
Definition: gxfile.cpp:686
int gdxDataErrorRecordX(int RecNr, int *KeyInt, double *Values)
Retrieve an error record. Non-zero if the record number is valid.
Definition: gxfile.cpp:2173
int gdxAcronymName(double V, char *AName)
Find the name of an acronym value. Non-zero if a name for the acronym is defined. An unnamed acronym ...
Definition: gxfile.cpp:3245
int gdxSymbolDim(int SyNr)
Returns dimensionality of a symbol.
Definition: gxfile.cpp:2430
int gdxDataWriteMapStart(const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo)
Start writing a new symbol in mapped mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2725
int gdxFileVersion(char *FileStr, char *ProduceStr) const
Return strings for file version and file producer. Always non-zero.
Definition: gxfile.cpp:1725
int gdxDataReadSliceStart(int SyNr, int *ElemCounts)
Prepare for the reading of a slice of data from a data set. The actual read of the data is done by ca...
Definition: gxfile.cpp:3296
int gdxAcronymNextNr(int NV)
Returns the value of the NextAutoAcronym variable and sets the variable to nv.
Definition: gxfile.cpp:3024
int gdxDataReadStr(char **KeyStr, double *Values, int &DimFrst)
Read the next record using strings for the unique elements. The reading should be initialized by call...
Definition: gxfile.cpp:1747
int gdxDataWriteDone()
Finish a write operation. Returns zero if the operation is not possible.
Definition: gxfile.cpp:509
int gdxDataReadRaw(int *KeyInt, double *Values, int &DimFrst)
Read the next record in raw mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2193
int gdxDataReadMapStart(int SyNr, int &NrRecs)
Initialize the reading of a symbol in mapped mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2791
int gdxDataSliceUELS(const int *SliceKeyInt, char **KeyStr)
Map a slice index in to the corresponding unique elements. After calling DataReadSliceStart,...
Definition: gxfile.cpp:3381
int gdxClose()
Close a GDX file that was previously opened for reading or writing. Before the file is closed,...
Definition: gxfile.cpp:534
int gdxDataReadRawStart(int SyNr, int &NrRecs)
Initialize the reading of a symbol in raw mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2214
int gdxDataWriteRawStartKeyBounds(const char *SyId, const char *ExplTxt, int Dimen, int Typ, int UserInfo, const int *MinUELIndices, const int *MaxUELIndices)
Start writing a new symbol in raw mode with bounds for UEL key indices being known in advance....
Definition: gxfile.cpp:2241
int gdxUMUelGet(int UelNr, char *Uel, int &UelMap)
Get a unique element using an unmapped index. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2648
int gdxAllowBogusDomains() const
Get flag to ignore using 1-dim sets as domain when their elements are not tracked (see gdxStoreDomain...
Definition: gxfile.cpp:3595
int gdxSymbolInfo(int SyNr, char *SyId, int &Dimen, int &Typ)
Returns information (name, dimension count, type) about a symbol from the symbol table....
Definition: gxfile.cpp:1814
int gdxUELRegisterMap(int UMap, const char *Uel)
Register unique element in mapped mode. A unique element must follow the GAMS rules when it contains ...
Definition: gxfile.cpp:2775
int gdxDataWriteMap(const int *KeyInt, const double *Values)
Write a data element in mapped mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2733
int gdxSystemInfo(int &SyCnt, int &UelCnt) const
Returns the number of symbols and unique elements. Always non-zero.
Definition: gxfile.cpp:2588
int gdxDataReadDone()
Finish reading of a symbol in any mode (raw, mapped, string). . Returns zero if the operation is not ...
Definition: gxfile.cpp:1776
int gdxFilterRegister(int UelMap)
Add a unique element to the current filter definition, zero if the index number is out of range or wa...
Definition: gxfile.cpp:3059
int gdxAcronymIndex(double V) const
Get index value of an acronym. Returns zero if V does not represent an acronym.
Definition: gxfile.cpp:3240
int gdxAcronymAdd(const char *AName, const char *Txt, int AIndx)
Add a new acronym entry. This can be used to add entries before data is written. Returns negative val...
Definition: gxfile.cpp:3221
int gdxDataReadSlice(const char **UelFilterStr, int &Dimen, TDataStoreProc_t DP)
Read a slice of data from a data set, by fixing zero or more index positions in the data....
Definition: gxfile.cpp:3337
int gdxSetSpecialValues(const double *AVals)
Set the internal values for special values. Before calling this function, initialize the array of spe...
Definition: gxfile.cpp:2320
int gdxDataErrorCount() const
Query the number of error records.
Definition: gxfile.cpp:2155
int gdxSymbMaxLength() const
Returns the length of the longest symbol name in the GDX file.
Definition: gxfile.cpp:3521
int gdxDataReadMap(int RecNr, int *KeyInt, double *Values, int &DimFrst)
Read the next record in mapped mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2798
int gdxFilterRegisterDone()
Finish registration of unique elements for a filter. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3076
int gdxUMFindUEL(const char *Uel, int &UelNr, int &UelMap)
Search for unique element by its string. Non-zero if the element was found, zero otherwise.
Definition: gxfile.cpp:3569
int gdxFilterExists(int FilterNr)
Check if there is a filter defined based on its number as used in gdxFilterRegisterStart....
Definition: gxfile.cpp:3043
int gdxDataReadRawFastEx(int SyNr, TDataStoreExProc_t DP, int &NrRecs, void *Uptr)
Read a symbol in Raw mode using a callback procedure. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3680
int gdxFindSymbol(const char *SyId, int &SyNr)
Search for a symbol by name in the symbol table; the search is not case-sensitive.
Definition: gxfile.cpp:1732
int gdxSetReadSpecialValues(const double *AVals)
Set the internal values for special values when reading a GDX file. Before calling this function,...
Definition: gxfile.cpp:3462
int gdxAddAlias(const char *Id1, const char *Id2)
Add an alias for a set to the symbol table. One of the two identifiers has to be a known set,...
Definition: gxfile.cpp:2101
int gdxGetSpecialValues(double *AVals)
Retrieve the internal values for special values. Always non-zero.
Definition: gxfile.cpp:2299
void gdxAllowBogusDomainsSet(int flag)
Set flag to ignore using 1-dim sets as domain when their elements are not tracked (see gdxStoreDomain...
Definition: gxfile.cpp:3600
~TGXFileObj()
Dispose GDX file object.
Definition: gxfile.cpp:677
int gdxGetUEL(int UelNr, char *Uel) const
Get the string for a unique element using a mapped index. Returns zero if the operation is not possib...
Definition: gxfile.cpp:2711
int gdxSymbolGetDomain(int SyNr, int *DomainSyNrs)
Retrieve the domain of a symbol. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2374
int gdxAcronymCount() const
Number of entries in the acronym table.
Definition: gxfile.cpp:2967
int gdxGetElemText(int TxtNr, char *Txt, int &Node)
Retrieve the string and node number for an entry in the string table. Returns zero if the operation i...
Definition: gxfile.cpp:2258
int gdxAcronymGetMapping(int N, int &orgIndx, int &newIndx, int &autoIndex)
Get information how acronym values are remapped. When reading GDX data, we need to map indices for ac...
Definition: gxfile.cpp:3031
int gdxCurrentDim() const
Returns the dimension of the currently active symbol When reading or writing data,...
Definition: gxfile.cpp:2679
int gdxSymbolInfoX(int SyNr, int &RecCnt, int &UserInfo, char *ExplTxt)
Returns additional information about a symbol. Returns zero if the symbol number is out of range,...
Definition: gxfile.cpp:2436
int gdxAutoConvert(int NV)
Returns the value of the AutoConvert variable and sets the variable to nv. When we close a new GDX fi...
Definition: gxfile.cpp:3264
int gdxSetHasText(int SyNr)
Test if any of the elements of the set has an associated text. Non-zero if the Set contains at least ...
Definition: gxfile.cpp:3457
int gdxErrorCount() const
Returns the number of errors.
Definition: gxfile.cpp:2253
int gdxOpenWrite(const char *FileName, const char *Producer, int &ErrNr)
Open a new GDX file for output. Non-zero if the file can be opened, zero otherwise.
Definition: gxfile.cpp:393
int gdxUELRegisterDone()
Finish registration of unique elements. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2595
int gdxFileInfo(int &FileVer, int &ComprLev) const
Returns file format number and compression level used. Always non-zero.
Definition: gxfile.cpp:3277
int gdxDataReadStrStart(int SyNr, int &NrRecs)
Initialize the reading of a symbol in string mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:1840
int gdxErrorStr(int ErrNr, char *ErrMsg) const
Returns the text for a given error number. Always non-zero.
Definition: gxfile.cpp:1710
void gdxMapAcronymsToNaNSet(int flag)
Flag to map all acronym values to the GAMS "Not a Number" special value. Disabled by default.
Definition: gxfile.cpp:3610
int gdxUELRegisterRawStart()
Start registering unique elements in raw mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2619
int gdxSymbIndxMaxLength(int SyNr, int *LengthInfo)
Returns the length of the longest UEL used for every index position for a given symbol.
Definition: gxfile.cpp:3486
int gdxAcronymSetInfo(int N, const char *AName, const char *Txt, int AIndx)
Modify acronym information in the acronym table.
Definition: gxfile.cpp:2987
Definition: gxfile.hpp:191
Definition: gxfile.hpp:87
Definition: gxfile.hpp:134