Graphisoft®

GDL DevKitVersion: 19

GdlValueRecord

    class GdlValueRecord {
    private:
	union {
          struct {
             Int32    lng;
             Int32    filler1;
          } lng;
          double     dbl;
	} value;
	GdlValueType     type;
	NumSubType       subtype;
	GS::Int8         variableflags; 

    public:
      inline   GdlValueRecord (void);
      inline   ~GdlValueRecord ();
      inline   GdlValueRecord (const GdlValueRecord& source);
      inline   GdlValueRecord& operator= (const GdlValueRecord& source);


      inline   bool operator== (const GdlValueRecord& b);
      inline   bool operator!= (const GdlValueRecord& b);
      
      inline   GdlValueType GetType (void) const;
      inline   NumSubType   GetSubType (void) const;
      inline   void         SetType (GdlValueType type, NumSubType subtype);
      inline   double       GetDouble (void) const;
      inline   void         SetDouble (double dbl);
      inline   Int32        GetLong (void) const;
      inline   void         SetLong (Int32 lng);
      inline   Int32        GetString (void)const;
      inline   void         SetString (Int32 lng);
      inline   Int32        GetId (void) const;
      inline   void         SetId (Int32 lng);
      inline   Int32        GetGroup (void) const;
      inline   void         SetGroup (Int32 lng);
      inline   void         SetVariableflags (GS::Int8 flag);
      inline   GS::Int8     GetVariableflags (void) const;
      inline   void         ClearVariableflags (); 
    };

Remarks

This structure is defined to represent GDL script values (numbers, strings and groups) in the GDL Engine and on the interface between generator funtions and GDL Engine. All member functions are inline and defined in the GDLDefs.h header file.

Numerical values are stored in the Int32 or the double data member depending on their subtype. A Get... member function always checks the stored type and subtype of a value and reads the data according to this (without error). As a consequence, doubles are rounded to Int32s which may result in data loss or accuracy problems.

Strings and groups are considered to be Int32 values. To store strings an additional handle is needed, the stored Int32 value is the index (offset) of the actual string value in the handle.

It is suggested to identify the type of a value using the GetType and GetSubType functions and read the value according to this.

Now, the variableflags member is used to follow up whether is this gdl variable is initialized, or is it used without initialisation. When a STOR (STORS, ...) is exectuted on a variable, then it becomes initialized. When a LOAD (LOADS,...) comes, what means, the variable's value is getting used, a check happens to this variable, whether is it inited or not, and if not, a GDL warning comes.

Requirements

Version:
GDL DevKit 13 or later
Header:
GDLDefs.h
Import Library:
GDLImp.lib
Module:
GDL.DLL [WIN], GDLlib [MAC]

See Also

InputFromFileProc, OutputToFileProc