A SansGUI Data Object is an instance of the SG_OBJ Data Structure that holds the data of an object, a part, or a link to be sent to other program modules for processing. In order to ease data handling processes with SansGUI Data Objects, we implement a mechanism that funnels the GUI control types of data into a smaller set of object data types. Furthermore, SansGUI turns the object data types into six data types in the SansGUI value structure (SG_VALU Data Structure) to simplify programming in various languages.
Before starting to examine the data type funneling mechanism, we need to refresh the definitions of cell and array attributes.
Cell Attribute: A cell attribute occupies a cell in the data entry grid. It can be a vector or a matrix contained within a cell.
Array Attribute: An array attribute occupies multiple cells in the data entry grid(s). An array attribute contains homogeneous (of the same type) data in the entire array.
The following table explains the data type funneling mechanism, from the GUI control types for data entry and display to the data types in the value structure for program access.
GUI Control Type |
Object Data Type |
Programming Data Type |
Number - Integer |
SG_TYPE_INT |
int[] (C) or INTEGER*4 (*) (Fortran) |
Number - Single Precision |
SG_TYPE_FLT |
float[] or REAL*4 (*) |
Number - Double Precision |
SG_TYPE_DBL |
double[] or REAL*8 (*) |
String - Regular (cell) |
SG_TYPE_CHAR |
char[] or CHARACTER (*) |
String - Regular (array) |
SG_TYPE_STR |
char*[] with jagged char arrays |
String - Masked |
SG_TYPE_STR |
char*[] with jagged char arrays |
String - Encrypted |
SG_TYPE_STR |
char*[] with jagged char arrays |
URL/File |
SG_TYPE_URL |
char*[] with jagged char arrays |
Date |
SG_TYPE_DATE |
5 integers in each array element |
Time |
SG_TYPE_TIME |
3 integers in each array element |
On-Off Switch |
SG_TYPE_INT |
int[] or INTEGER*4 (*) |
Tri-State Switch |
SG_TYPE_INT |
int[] or INTEGER*4 (*) |
Enumerated Items |
SG_TYPE_INT |
int[] or INTEGER*4 (*) |
Object Reference |
SG_TYPE_REF |
char*[] with jagged char arrays |
Quality |
SG_TYPE_QUAL |
int[] or INTEGER*4 (*) |
Symbolic Parameters |
SG_TYPE_NULL |
or resolved to a fixed type above |
With this mechanism, all the GUI control types are converted into one of the int, float, double, or char types for C programming and INTEGER*4, REAL*4, REAL*8, and CHARACTER for Fortran programming. A few notes follow:
All data are stored as arrays, even if there is only one element.
All multi-dimensional arrays are collapsed into one dimension, although you can still access them as multi-dimensional with proper declaration. SansGUI stores data in row or column major order data storage according to the class specifications from the simulation developer.
A regular string entered in a cell attribute is stored as SG_TYPE_CHAR with a NULL terminated character array. This is the only string type that the length of the string can be modified programmatically (via the resize functions). Other strings stored as SG_TYPE_STR are pointer arrays to jagged (not the same length) character arrays with fixed string lengths for each. The lengths of SG_TYPE_STR strings are decided when the user enters them.
Masked strings are stored without the literals in the input masks. For example, the phone number with a format "(123)456-7890" will be stored as a string "1234567890". The input masks, such as "(###)###-####", are for data entry and display purposes.
Encrypted strings are decrypted in the data storage in the memory and in the textual model file generated. They are encrypted and then saved in Project Models and Object Libraries.
Dates are stored as an array of date elements with each date element being 5 consecutive integers. Therefore, the total number of integers is 5 times the number of dates.
Times are stored as an array of time elements with each time element being 3 consecutive integers. Therefore, the total number of integers is 3 times the number of times.
The types SG_TYPE_URL and SG_TYPE_REF use the same storage mechanism as SG_TYPE_STR. The different types are for programming convenience. All strings are stored without the enclosing characters, such as quotes, brackets, etc.
Symbolic parameters are resolved before a simulation run starts. The values may be unbounded, with SG_TYPE_NULL, during the model configuration time.
SansGUI Modeling and Simulation Environment Version 1.2
Copyright © 2000-2003 ProtoDesign, Inc. All rights reserved.