TsmConnection tsmConnect ( char const *dataset, char const *access_mode, TsmConnectionParams param )

Open a connection to a dataset

Documentation

Open a connection to a dataset.

In order to do anything to a dataset, you need to use this function to open a connection to that particular dataset. Note that you use one connection for one dataset, so if you wish to open two datasets then you will need to do to tsmConnect's.

In order to open a connection you need to specify two pieces of information (with an optional third). These are:

  1. The name and location of the dataset. This can be a local filesystem filename, or a URL. Examples of valid dataset names include:

    1. ~magic/TileSets/Pyramids/ntc-1-utm-2scene.128.oi
    2. file://localhost/homedir/magic/TileSets/Pyramids/yosemite.oi
    3. x-dpss://iss-1.sri.magic.net/Pyramids/ntc-1-utm-2scene.33.dem

  2. The access mode that you wish for the connection. Currently you can request a read-only connection ("r"), a write-only connection ("w"), or a read-write connection ("rw"). For example, if you request a read-only connection then you will not be able to use the tsmWriteTile() function.

  3. (Optional) You can also provide a TsmConnectionParams structure which lets you specify further details about the dataset and override any default settings (such as the image format of tiles to use). If you don't want to specify this, then you can pass a NULL pointer for this parameter. To find out what details you can specify with the TsmConnectionParams structure and how to use it, please refer to the triumvirate: tsmInitParams, tsmSetParams, and tsmFreeParams.

Once you have opened a connection to a dataset, then you can do any processing that you wish, e.g. read tiles from the dataset (if you have requested a readable connection), or write new tiles to the dataset (if you have asked for a write connection). When you have finished manipulating the dataset, you call the tsmDisconnect function to close the connection and free up any held resources.

The following list provides details to help you understand how the use of the TsmConnectionParams structure affects the dataset that is actually connected to:

Reading a Local Disk Dataset (file:// URL)

Reading a DPSS Dataset (x-dpss:// URL):

Reading HTTP Datasets (http:// URL):

Returns:
An allocated connection structure, or NULL if failed.
Parameters:
dataset - a filename or URL for the pyramid dataset to connect to
access_mode - either "r" (read), "w" (write), or "rw" (read/write)
param - a number of hints to specify more information about the dataset, or NULL
Author:
Martin Reddy
Version:
9 January 1997
See Also:
tsmDisconnect, tsmInitParams, tsmSetParams, tsmReadTile, tsmWriteTile, tsmGet, tsmSet


TSMAPI_RELEASE 2.1 - Release Date: 2001/01/10 19:01:12

Back to tsmApi Home Page