GTXclient C++ API
GTXserver-17.0.3
|
Once compiled and linked, these examples can be run at the shell prompt. All of them are clients for the GTXserver. Each client will either run a new server or connect to an existing one depending on command line arguments and or choices in the interface when possible (browser.cpp example).
Here is a list of the options available when running those programs:
-help | Prints help on command usage | |
-debug | Prints client/server messages. Interesting to follow the dialog between the server and its client. | |
-host hostname | Server's hostname. If not specified, the default host is "localhost".. | |
-port port_number | Port used to communicate with the client. The default is the same for the server and the client. If for any reason the default port number is not correct on your machine, you can change it (you must use the same port number in the server and the client). | |
-path data_path | Asks the server to use this data path to access to the Isatis file system. The default is set to the $GTX_DATA environment variable if defined. | |
The default is to run a new server on a random port. If -host or -port is specified, a server must have been started first on the given host/port |
You can try to run the client to see what happens. If you examine the source code, you will find the main calls used to write a client application. This source code is only composed of the main and some utility functions can be found in utils.hpp (argument parsing and statistics methods).
The first thing is to create an instance of the GTXClient class to be able to call its methods. Creating the instance initializes the library properly.
With the option -debug, the program calls GTXClient::SetDebugMode() with true. Then all the functions will print extra messages about the dialog between server and client. This can be useful in a debug phase.
The default is then to run a new GTXserver on a random port. The function will look for the server executable in the following places:
To connect to the server, the client calls GTXClient::Connect(). The server must already be running and waiting for connection. If no -port or -host option has been used, it has been started just above, so it should be OK. Otherwise, the server must already be running on the given host/port. If not, the function will throw an exception.
If the server has been started with the -multisession parameter, the server will still be available for other sessions during this session lifetime. Moreover, when GTXClient::Disconnect will be called, the server will still be there...
dump.cpp example dumps all Isatis studies, directories, files and variables. This is a simple C++ program with no user interactions.
browser.cpp example Qt program allowing to browse the data tree and get information on the nodes. Interactive Qt program to browse the Isatis file hierarchy.
fault.cpp attaches faults to a file and retrieves information on faults
polygon.cpp creates a polygons file and retrieves information on polygons
wireframes.cpp creates a wireframes file and retrieves information on wireframes
vendor.cpp attaches some vendor data to a file and read it back
write_files.cpp creates 2D & 3D Points, Lines and Grid files in a new study.