GAMS Data eXchange (GDX) API
Low-level "eXPert level" C++ API for reading and writing GAMS Data eXchange files
Loading...
Searching...
No Matches
gdx.h
1/*
2 * GAMS - General Algebraic Modeling System GDX API
3 *
4 * Copyright (c) 2017-2024 GAMS Software GmbH <support@gams.com>
5 * Copyright (c) 2017-2024 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.h"
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 static int gdxErrorStr( int ErrNr, char *ErrMsg );
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;
1749TgxFileMode fmode { f_not_open }, fmode_AftReg { f_not_open };
1750enum : uint8_t
1751{
1752 stat_notopen,
1753 stat_read,
1754 stat_write
1755} fstatus { stat_notopen };
1756int fComprLev {};
1757std::unique_ptr<TUELTable> UELTable;
1758std::unique_ptr<TSetTextList> SetTextList {};
1759std::unique_ptr<int[]> MapSetText {};
1760int FCurrentDim {};
1761std::array<int, GLOBAL_MAX_INDEX_DIM> LastElem {}, PrevElem {}, MinElem {}, MaxElem {};
1762std::array<std::array<char, GLOBAL_UEL_IDENT_SIZE>, GLOBAL_MAX_INDEX_DIM> LastStrElem {};
1763int DataSize {};
1764tvarvaltype LastDataField {};
1765std::unique_ptr<TNameList> NameList;
1766std::unique_ptr<TDomainStrList> DomainStrList;
1767std::unique_ptr<LinkedDataType> SortList;
1768std::optional<LinkedDataIteratorType> ReadPtr;
1769std::unique_ptr<TTblGamsDataImpl<double>> ErrorList;
1770PgdxSymbRecord CurSyPtr {};
1771int ErrCnt {}, ErrCntTotal {};
1772int LastError {}, LastRepError {};
1773std::unique_ptr<TFilterList> FilterList;
1774TDFilter *CurFilter {};
1775TDomainList DomainList {};
1776bool StoreDomainSets { true }, AllowBogusDomain { true }, MapAcrToNaN {};
1777TIntlValueMapDbl intlValueMapDbl {}, readIntlValueMapDbl {};
1778TIntlValueMapI64 intlValueMapI64 {};
1779TraceLevels TraceLevel { TraceLevels::trl_all };
1780std::string TraceStr;
1781int VersionRead {};
1782std::string FProducer, FProducer2, FileSystemID;
1783int64_t MajorIndexPosition {};
1784int64_t NextWritePosition {};
1785int DataCount {}, NrMappedAdded {};
1786std::array<TgdxElemSize, GLOBAL_MAX_INDEX_DIM> ElemType {};
1787std::string MajContext;
1788std::array<TIntegerMapping, GLOBAL_MAX_INDEX_DIM> SliceIndxs {}, SliceRevMap {};
1789int SliceSyNr {};
1790std::array<std::string, GMS_MAX_INDEX_DIM> SliceElems;
1791bool DoUncompress {}, // when reading
1792 CompressOut {};// when writing
1793int DeltaForWrite {}; // delta for last dimension or first changed dimension
1794int DeltaForRead {}; // first position indicating change
1795double Zvalacr {}; // tricky
1796std::unique_ptr<TAcronymList> AcronymList;
1797std::array<TSetBitMap *, GLOBAL_MAX_INDEX_DIM> WrBitMaps {};
1798bool ReadUniverse {};
1799int UniverseNr {}, UelCntOrig {};// original uel count when we open the file
1800int AutoConvert { 1 };
1801int NextAutoAcronym {};
1802bool AppendActive {};
1803
1804#ifndef VERBOSE_TRACE
1805const TraceLevels defaultTraceLevel { TraceLevels::trl_none };
1806const bool verboseTrace {};
1807#else
1808const TraceLevels defaultTraceLevel { TraceLevels::trl_all };
1809const bool verboseTrace { true };
1810#endif
1811
1812//api wrapper magic for Fortran
1813TDataStoreFiltProc_t gdxDataReadRawFastFilt_DP {};
1814TDomainIndexProc_t gdxGetDomainElements_DP {};
1815
1816bool PrepareSymbolWrite( std::string_view Caller, const char *AName, const char *AText, int ADim, int AType, int AUserInfo );
1817int PrepareSymbolRead( std::string_view Caller, int SyNr, const int *ADomainNrs, TgxFileMode newmode );
1818
1819void InitErrors();
1820void SetError( int N );
1821void ReportError( int N );
1822bool ErrorCondition( bool cnd, int N );
1823
1824bool MajorCheckMode( std::string_view Routine, TgxFileMode m );
1825bool MajorCheckMode( std::string_view Routine, const TgxModeSet &MS );
1826
1827bool CheckMode( std::string_view Routine );
1828bool CheckMode( std::string_view Routine, TgxFileMode m );
1829bool CheckMode( std::string_view Routine, const TgxModeSet &MS );
1830
1831void WriteTrace( std::string_view s ) const;
1832void InitDoWrite( int NrRecs );
1833bool DoWrite( const int *AElements, const double *AVals );
1834bool DoRead( double *AVals, int &AFDim );
1835void AddToErrorListDomErrs( const std::array<int, GLOBAL_MAX_INDEX_DIM> &AElements, const double *AVals );
1836void AddToErrorList( const int *AElements, const double *AVals );
1837void GetDefaultRecord( double *Avals ) const;
1838double AcronymRemap( double V );
1839bool IsGoodNewSymbol( const char *s );
1840bool ResultWillBeSorted( const int *ADomainNrs ) const;
1841
1842int gdxOpenReadXX( const char *Afn, int filemode, int ReadMode, int &ErrNr );
1843
1844// This one is a helper function for a callback from a Fortran client
1845void gdxGetDomainElements_DP_FC( int RawIndex, int MappedIndex, void *Uptr );
1846int gdxDataReadRawFastFilt_DP_FC( const int *Indx, const double *Vals, void *Uptr );
1847
1848void mapDefaultRecordValues(double *AVals) const;
1849
1850public:
1851bool gdxGetDomainElements_DP_CallByRef {},
1852 gdxDataReadRawFastFilt_DP_CallByRef {},
1853 gdxDataReadRawFastEx_DP_CallByRef {};
1854};
1855
1856}// namespace gdx
Definition: gdx.h: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:3596
static int gdxErrorStr(int ErrNr, char *ErrMsg)
Returns the text for a given error number. Always non-zero.
Definition: gxfile.cpp:1715
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:3511
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:2955
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:2201
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:2689
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:3084
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:3530
int gdxSetTraceLevel(int N, const char *s)
Set the amount of trace (debug) information generated. Always non-zero.
Definition: gxfile.cpp:3176
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:2121
int gdxUELRegisterStrStart()
Start registering unique elements in string mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2622
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:472
int gdxUMUelInfo(int &UelCnt, int &HighMap) const
Return information about the unique elements (UELs). Always non-zero.
Definition: gxfile.cpp:2647
int gdxMapAcronymsToNaN() const
Flag to map all acronym values to the GAMS "Not a Number" special value. Disabled by default.
Definition: gxfile.cpp:3586
int gdxFilterRegisterStart(int FilterNr)
Define a unique element filter. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3032
int gdxUELRegisterMapStart()
Start registering unique elements in mapped mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2749
static int gdxGetDLLVersion(char *V)
Returns a version descriptor of the library. Always non-zero.
Definition: gxfile.cpp:3254
int64_t gdxGetMemoryUsed()
Return the number of bytes used by the data objects.
Definition: gxfile.cpp:3387
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:2366
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:3090
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:3242
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:3649
int gdxGetLastError()
Returns the last error number or zero if there was no error. Calling this function will clear the las...
Definition: gxfile.cpp:2262
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:2209
int gdxRenameUEL(const char *OldName, const char *NewName)
Rename unique element OldName to NewName.
Definition: gxfile.cpp:2667
int gdxDataErrorRecord(int RecNr, int *KeyInt, double *Values)
Retrieve an error record. Non-zero if the record number is valid.
Definition: gxfile.cpp:2140
int gdxSymbolSetDomain(const char **DomainIDs)
Define the domain of a symbol for which a write data operation just started using DataWriteRawStart,...
Definition: gxfile.cpp:2444
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:2535
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:397
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:2586
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:3400
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:3102
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:1722
int gdxStoreDomainSets() const
Get flag to store one dimensional sets as potential domains, false (0) saves lots of space for large ...
Definition: gxfile.cpp:3566
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:3420
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:3571
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:2610
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:462
int gdxUELMaxLength() const
Returns the length of the longest unique element (UEL) name.
Definition: gxfile.cpp:3545
int gdxResetSpecialValues()
Reset the internal values for special values. Always non-zero.
Definition: gxfile.cpp:691
int gdxDataErrorRecordX(int RecNr, int *KeyInt, double *Values)
Retrieve an error record. Non-zero if the record number is valid.
Definition: gxfile.cpp:2153
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:3228
int gdxSymbolDim(int SyNr)
Returns dimensionality of a symbol.
Definition: gxfile.cpp:2413
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:2708
int gdxFileVersion(char *FileStr, char *ProduceStr) const
Return strings for file version and file producer. Always non-zero.
Definition: gxfile.cpp:1727
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:3279
int gdxAcronymNextNr(int NV)
Returns the value of the NextAutoAcronym variable and sets the variable to nv.
Definition: gxfile.cpp:3007
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:1749
int gdxDataWriteDone()
Finish a write operation. Returns zero if the operation is not possible.
Definition: gxfile.cpp:508
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:2173
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:2774
int gdxDataSliceUELS(const int *SliceKeyInt, char **KeyStr)
Map a slice index in to the corresponding unique elements. After calling DataReadSliceStart,...
Definition: gxfile.cpp:3364
int gdxClose()
Close a GDX file that was previously opened for reading or writing. Before the file is closed,...
Definition: gxfile.cpp:533
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:2194
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:2221
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:2631
int gdxAllowBogusDomains() const
Get flag to ignore using 1-dim sets as domain when their elements are not tracked (see gdxStoreDomain...
Definition: gxfile.cpp:3576
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:1816
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:2758
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:2716
int gdxSystemInfo(int &SyCnt, int &UelCnt) const
Returns the number of symbols and unique elements. Always non-zero.
Definition: gxfile.cpp:2571
int gdxDataReadDone()
Finish reading of a symbol in any mode (raw, mapped, string). . Returns zero if the operation is not ...
Definition: gxfile.cpp:1778
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:3042
int gdxAcronymIndex(double V) const
Get index value of an acronym. Returns zero if V does not represent an acronym.
Definition: gxfile.cpp:3223
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:3204
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:3320
int gdxSetSpecialValues(const double *AVals)
Set the internal values for special values. Before calling this function, initialize the array of spe...
Definition: gxfile.cpp:2303
int gdxDataErrorCount() const
Query the number of error records.
Definition: gxfile.cpp:2135
int gdxSymbMaxLength() const
Returns the length of the longest symbol name in the GDX file.
Definition: gxfile.cpp:3503
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:2781
int gdxFilterRegisterDone()
Finish registration of unique elements for a filter. Returns zero if the operation is not possible.
Definition: gxfile.cpp:3059
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:3550
int gdxFilterExists(int FilterNr)
Check if there is a filter defined based on its number as used in gdxFilterRegisterStart....
Definition: gxfile.cpp:3026
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:3661
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:1734
int gdxSetReadSpecialValues(const double *AVals)
Set the internal values for special values when reading a GDX file. Before calling this function,...
Definition: gxfile.cpp:3444
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:2081
int gdxGetSpecialValues(double *AVals)
Retrieve the internal values for special values. Always non-zero.
Definition: gxfile.cpp:2282
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:3581
~TGXFileObj()
Dispose GDX file object.
Definition: gxfile.cpp:682
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:2694
int gdxSymbolGetDomain(int SyNr, int *DomainSyNrs)
Retrieve the domain of a symbol. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2357
int gdxAcronymCount() const
Number of entries in the acronym table.
Definition: gxfile.cpp:2950
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:2238
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:3014
int gdxCurrentDim() const
Returns the dimension of the currently active symbol When reading or writing data,...
Definition: gxfile.cpp:2662
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:2419
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:3247
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:3439
int gdxErrorCount() const
Returns the number of errors.
Definition: gxfile.cpp:2233
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:392
int gdxUELRegisterDone()
Finish registration of unique elements. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2578
int gdxFileInfo(int &FileVer, int &ComprLev) const
Returns file format number and compression level used. Always non-zero.
Definition: gxfile.cpp:3260
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:1842
void gdxMapAcronymsToNaNSet(int flag)
Flag to map all acronym values to the GAMS "Not a Number" special value. Disabled by default.
Definition: gxfile.cpp:3591
int gdxUELRegisterRawStart()
Start registering unique elements in raw mode. Returns zero if the operation is not possible.
Definition: gxfile.cpp:2602
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:3468
int gdxAcronymSetInfo(int N, const char *AName, const char *Txt, int AIndx)
Modify acronym information in the acronym table.
Definition: gxfile.cpp:2970
Definition: gxfile.h:183
Definition: gxfile.h:79
Definition: gxfile.h:126