GXSBF class

class GXSBF(handle=0)

GXSBF class.

The GXSBF class provides a means of storing data in a file-type directory structure within a workspace, database or map. Each of these three objects contains its own GXSBF object, which may be accessed using the h_get_sys, h_get_db and h_get_map functions. To access data in a file, or create a new file in the GXSBF object, call the CreatSBF_BF function (see GXBF), which will return a GXBF object to use.

create(file, status)

Create a child GXSBF object inside an GXSBF.

Parameters:
Returns:

GXSBF object, terminates if fails.

Return type:

GXSBF

New in version 5.0.

License: Geosoft Open License

create_obj_list(lst, type)

Fills an GXLST with embedded storage names of an GXSBF.

Parameters:

New in version 5.0.7.

License: Geosoft Open License

Note: Function will populate an GXLST object with embedded files (SBF_TYPE_FILES), directories (SBF_TYPE_DIRS), or both (pass SBF_TYPE_BOTH) in an GXSBF. Along with the Name of the file or directory, a constant “dir” or “file” string is written to the GXLST also.

del_dir(dir)

Delete a directory (storage) from this storage.

Parameters:dir (str) – Dir/Storage Name

New in version 5.0.

License: Geosoft Open License

del_file(file)

Delete a file from this storage.

Parameters:file (str) – File Name

New in version 5.0.

License: Geosoft Open License

exist_dir(dir)

Check to see if a directory (storage) exists inside this storage.

Parameters:dir (str) – Dir/Storage Name
Returns:0 - Does not exist 1 - Exists
Return type:int

New in version 5.0.

License: Geosoft Open License

exist_file(file)

Check to see if a file exists inside this storage.

Parameters:file (str) – File Name
Returns:0 - Does not exist 1 - Exists
Return type:int

New in version 5.0.

License: Geosoft Open License

classmethod h_get_db(db)

Get the embedded file storage from a database.

Parameters:db (GXDB) – Database
Returns:GXSBF Object
Return type:GXSBF

New in version 5.0.

License: Geosoft Open License

classmethod h_get_map(map)

Get the embedded file storage from a map.

Parameters:map (GXMAP) – GXMAP object
Returns:GXSBF Object
Return type:GXSBF

New in version 5.0.

License: Geosoft Open License

classmethod h_get_sys()

Get the main embedded file storage (in workspace).

Returns:GXSBF Object
Return type:GXSBF

New in version 5.0.

License: Geosoft Open License

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod null()

A null (undefined) instance of GXSBF

Returns:A null GXSBF
Return type:GXSBF
save_log(dir, file, file_save, p5)

Save an embedded file to an ASCII file.

Parameters:
  • dir (str) – Directory name in the Parent GXSBF
  • file (str) – File name in the directory
  • file_save (str) – File to save as (as an ASCII file)
  • p5 (int) – Append Mode: 0 - New file, 1 - Append file

New in version 5.0.

License: Geosoft Open License

SBF_OPEN constants

GXSBF Open defines

SBF_READ

Read only

gxapi.SBF_READ = 0
SBF_READWRITE_NEW

Read/write - erases structured file

gxapi.SBF_READWRITE_NEW = 1
SBF_READWRITE_OLD

Read/write - open and append onto pre-existing structured file

gxapi.SBF_READWRITE_OLD = 2

SBF_TYPE constants

GXSBF Object type defines

SBF_TYPE_DIRS

Embedded directory names

gxapi.SBF_TYPE_DIRS = 1
SBF_TYPE_FILES

Embedded file names

gxapi.SBF_TYPE_FILES = 2
SBF_TYPE_BOTH

Embedded file and directory names

gxapi.SBF_TYPE_BOTH = 3