Persistent Parameter Storage

One of the important features of the Oasis processing environment is the strategy employed for storing and retrieving past settings, such as channel names and processing parameters, and object-specific metadata.

There are three sets of parameters you should be aware of:

ParametersDescriptionAPI Functions
GlobalGlobal parameter settings that are shared among all projects. These are mainly used to establish user preferences, such a default grid type, default colour table, etc. Global parameters are stored in a Geosoft META object, and you can use META methods to work with global parameters.GetSettingsMETA_SYS
SetSettingsMETA_SYS
GlobalSet_SYS
iGlobal_SYS
etc. 
ProjectParameter settings specific to a project, which are stored in the Project Parameter Block and managed with a set of SYS functions. See Project Parameter Block below.GetREG_SYS
SetREG_SYS
GetString_SYS
SetString_SYS
etc. 
Line
Channel
Map
View
All basic Geosoft data objects will have an associated REG or META object that can be used to store information in the context of that instance of the object. See Parameter storage in other Oasis montaj objects below.Refer to the APIs specific to each object type.

API function names and examples in this section will use GX syntax. For other languages refer to the specific API reference for the relevant syntax usage.

Sections on this page

Project Parameter Block

Each Oasis montaj project maintains a Project Parameter Block (a table of name-value pairs) that persists over the life of the project.  Geosoft applications use the project Parameter Block to maintain the current or last-used state for values in various GX dialogs and processes.  Parameter names have two parts, a Group and a Name, and when expressed as a string we use the format "Group.Name".  For example, a user can save the current state of the Project Parameter Block using "Settings / Parametes / Save Settings...", and a file that looks like this partial example will be created:

BANDPASS.FILTLEN="5"
BANDPASS.IN="bb"
BANDPASS.LONGW="0"
BANDPASS.OUT="bbb"
BANDPASS.SHORTW="0"
CHANTOARRAY.ARRAYNAME="b"
CHANTOARRAY.GDB_NAME_STR="e:\NRG\NRG_example.gdb"
CHANTOARRAY.SELECTEDCHANNELS="a4nlf;a5nlf"
COPY.DECIMATE="1"
COPY.FIDINCR=""
COPY.FIDSTART=""
COPY.FROM="a"
COPY.TO="b"

Geosoft GXs protect the name space of each GX by relying on a unique Group name for each GX.  Your custom extensions may also use the registry to either read parameter settings from other GX processes, or to make your own parameters persistent within a project. When adding a Group name, it is your responsibility to ensure the value is unique and not already in use by a different GX or process.

Project parameters are accessed and managed using SYS functions.  SYS ensures that parameter settings are also recorded as "SETINI" commands in the log and script files upon normal termination of an extension.  Note that GXs or extensions that exit with Cancel_SYS() will not log parameter settings.  See Scripting for more information on preparing extensions to support scripting.

Here are some common SYS functions that work with the Project Parameter Block (refer to the SYS API for more):

FunctionPurpose
GetString_SYS
SetStringSYS 
get and set a string parameter
SetInt_SYS
iGetInt_SYS 
set and get a integer parameter
Cancel_SYScancels and exits an extension and returns the Program Parameter Block to a state before the GX or extension was called.

Dialogs and Parameters

In GX programs, Dialogs can make use of the project parameter block to exchange dialog entries with the main GX code. This provides a mechanism that naturally ensures user settings are stored in the project parameter block.  See Dialogs and the Project Parameter Block for more information.

Parameter storage in other Oasis montaj objects

A special object, call the “REG” is used to store data within an individual database line, database channel, map or map view. An example is measurement units (such as “m” for meters), which are unique to a particular channel and which are stored within the channel REG. The following example illustrates how the channel REG is obtained and how parameter information is exchanged with it:

// --- Create (an empty) REG object ---
ChReg = Create_REG(128);

// --- Get the channel symbol, and the channel parameter data ---
Ch = FindSymb_DB(Data,sCh,DB_SYMB_CHAN);
GetRegSymb_DB(Data, Ch, ChReg);

// --- Get values from the REG ---                
GetInt_REG(ChReg,"INTPARAM", iVal);
GetReal_REG(ChReg,"REALPARAM", rVal);
Get_REG(ChReg, "STRINGPARAM", sVal, sizeof(sVal));

// --- Use values...
.
.
.

// --- Set values back into the REG ---
SetInt_REG(ChReg,"INTPARAM", iVal);
SetReal_REG(ChReg,"REALPARAM", rVal);
Set_REG(ChReg, "STRINGPARAM", sVal);

// --- Set the REG data back into the channel ---
SetRegSymb_DB(Data, Ch, ChReg);

// --- Destroy the REG object ---
Destroy_REG(ChReg);

Note that the REG object is created, then filled with values from the channel using the GetRegSymb_DB function. If the REG object is altered, the new settings must be loaded back into the channel using SetRegSymb_DB for the changes to take effect in the channel itself. Finally, the REG must be destroyed.

The line REG is accessed in the same way as the channel REG. A new REG object is created, then filled, and must be destroyed in the end. It is accessed by using a line symbol:

GetRegSymb_DB(Data, Line, LineReg); // Get REG from a line symbol
SetRegSymb_DB(Data, Line, LineReg); // Set REG to a line symbol

Access to other objects’ REGs is handled differently. For a MAP or MVIEW object, a handle to the object’s own REG is returned to the user, and the user works directly with the object’s REG. No Create or Destroy is performed, and no “SetREG_MAP” (for example) function is required:

// --- Get the handle to the map REG ---
MapReg = GetREG_MAP(Map);

// --- Set a value in the map REG ---
Set_REG(MapReg, "MAP.MAPPARAM", sVal);

The REG in a map’s view is accessed using the GetREG_MVIEW function.

Data string values obtained from a REG may be loaded to, and retrieved from a dialog using the SetInfo_DGW and GetInfo_DGW commands. (When using REG-derived data in dialogs, it is most practical to work with all data, including real and integer variables, as strings using the Get_REG and Set_REG functions.) Alternatively, the REG settings can be added to the workspace parameter block using the SetREG_SYS function, so that the SetInfoSYS_DGW function can be used, as in the following example:

GetRegSymb_DB(Data, Ch, ChReg);
SetREG_SYS(ChReg);

// --- REG parameters are now available as SYS parameters ---
SetInfoSYS_DGW(Diag, _MYFORM_0, DGW_TEXT, "œMAP", "œMAPPARAM");
.
.
.

Note that the REG parameters should be stored in the form “GROUP.PARAM” so that both the group and parameter values are defined in the system parameter block when SetREG_SYS is called.