GTXclient C++ API GTXserver-16.0.2

- Main Page
- Related Pages
- Classes
- Files
- Examples

# dump.cpp example

See dump.cpp source code.

This example is the simpliest way to understand the communication between GTXserver and a client. The program scrolls through the Isatis file system to get information/statistics on all files and variables.

As we are connected we can get the list of studies using GTXClient::GetStudyList(). We can either use the GTXStringArray class to access each element with GTXStringArray::GetValue or retrieve the pointer on the complete list with GTXStringArray::GetValues.

We then set the name of the current study using GTXClient::SetStudy() For each study we can obtain the directory list with GTXClient::GetDirectoryList(). And we set the current directory using GTXClient::SetDirectory() for each directory of the list.

After getting the file list of each directory using GTXClient::GetFileList(), we must set as current each file with GTXClient::SetFile().

At this point, we call a utility method from utils.hpp with obtains file information using GTXClient::GetFileInfo(). It then dump the contents of the GTXFileInfo class in a string and returns this string so that we can print it from the main.

After that, we get the variable list with a call to GTXClient::GetVariableList() and define each variable as the current one with GTXClient::SetVariable().

After getting variable information through a utils.hpp method (GTXClient::GetVariableInfo()), we dump the contents of the GTXVariableInfo class returned by this method into a string that is returned to the main and printed.

If the current variable is a macro variable, we get macro indices using GTXClient::GetMacroIndices() and dump them. Note: Macro variables appears in Isatis 3.2 and can have alphanumerical indices since Isatis 5.0.

Just before exiting, we must disconnect from the server using GTXClient::Disconnect(). If the server is mono session, it exits. If the server is multi session, only the current session terminates and GTXserver is still available for a further session.