GTXclient C++ API  GTXserver-15.0.3
GTXClient.hpp
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Copyright (c)2009 Geovariances, Avon, France.
4 
5  In consideration of payment of the license fee, which is a part of
6  the price you paid for this product, Geovariances (GV) as licensor,
7  grants you, the licensee, a non-exclusive right to use this copy of a
8  GV software product.
9  GV reserves all rights not expressly granted to licensee. GV retains
10  titleship and ownership of software. This license is not a sale of
11  the original software or any copy. GV also retains titleship and
12  ownership of any modifications or derivations of this software. Any
13  modifications of this software must be clearly marked as such. This
14  copyright message must appear in its entirety in this software, or
15  any modifications or derivations thereof.
16 
17  Geovariances welcomes any comments, suggestions, bug reports, etc. At
18  the discretion of Geovariances, any customer supplied bug fixes,
19  enhancements, or utility codes will be distributed in future software
20  releases (the contributor will of course be credited).
21 
22  Geovariances
23  49bis, Avenue Franklin Roosevelt
24  77210 Avon, FRANCE
25 
26  Phone: +33-(0)-160.749.100
27  Fax: +33-(0)-164.228.728
28  e-mail: support@geovariances.fr
29 
30  All Rights Reserved
31 
32 *****************************************************************************/
33 
34 #ifndef __GTXClient_hpp__
35 #define __GTXClient_hpp__
36 
42 #define __USING_GTXSERVER_CPP_API__
43 
44 #ifdef DOXYGEN
45 #define SWIG_OR_DOXYGEN
46 #endif //DOXYGEN
47 
48 #ifdef SWIG
49 #define GLOBAL_CLASS
50 #define SWIG_OR_DOXYGEN
51 #else //SWIG
52 
53 #include <GTXStringArray.hpp>
54 #include <GTXByteArray.hpp>
55 #include <GTXFileInfo.hpp>
56 #include <GTXVariableInfo.hpp>
57 #include <GTXVendorData.hpp>
58 #include <GTXFaultSystem.hpp>
59 #include <GTXPolygonSystem.hpp>
60 #include <GTXWireframeSystem.hpp>
61 
62 class GTXStringArray;
63 class GTXIntArray;
64 class GTXDoubleData;
65 class GTXCharData;
66 class GTXVariableFormat;
67 #endif //SWIG
68 
240 class GLOBAL_CLASS GTXClient
241 {
242 public:
243  GTXClient();
244 
245  /* Debug methods */
246  void SetDebugMode(bool debug);
247 
248  /* Connection methods */
249  unsigned short GetDefaultPort(void);
250  const char *LocateGTXserver();
251  void SetGTXserverPath(const char *path);
252  unsigned short RunGTXserver(unsigned short port);
253  void Connect(const char *host, unsigned short port, const char *path);
254  bool IsConnected();
255  void Disconnect();
256  int GetServerVersion();
257 
258  /* Study methods */
259  GTXStringArray GetStudyList();
260  void SetStudy(const char *study);
261  void NewStudy(const char *study, const char *path);
262  void DeleteStudy();
263 
264  /* Directory methods */
265  GTXStringArray GetDirectoryList();
266  bool DirectoryExists(const char *directory);
267  void SetDirectory(const char *directory);
268  void NewDirectory(const char *directory);
269  void DeleteDirectory();
270 
271  /* File methods */
272  GTXStringArray GetFileList();
273  GTXStringArray GetFileList(GTXFileInfo::FileType file_type, int file_dim);
274  bool FileExists(const char *file);
275  void SetFile(const char *file);
276  void DeleteFile();
277  GTXFileInfo GetFileInfo();
278  const char *GetFileComment();
279  void SetFileComment(bool append, const char *comment);
280  void NewPointsFile2D(const char *name, gtx_long nsample, const double x[], const double y[]);
281  void NewPointsFile3D(const char *name, gtx_long nsample, const double x[], const double y[], const double z[]);
282  void NewGridFile2D(const char *name, double X0, double Y0, double DX, double DY, int NX, int NY);
283  void NewGridFile3D(const char *name, double X0, double Y0, double Z0, double DX, double DY, double DZ, int NX, int NY, int NZ);
284  void NewLinesFile(const char *name, int dimension);
285  void PointsFileAppend2D(gtx_long nsample, const double x[], const double y[]);
286  void PointsFileAppend3D(gtx_long nsample, const double x[], const double y[], const double z[]);
287  void LinesFileAddLineCores2DOld(int nsample, double xbegin, double ybegin, const double xend[], const double yend[]);
288  void LinesFileAddLineCores3DOld(int nsample, double xbegin, double ybegin, double zbegin, const double xend[], const double yend[], const double zend[]);
289  void LinesFileAddCoreLine2D(int nsample, double xbegin, double ybegin, const double xend[], const double yend[]);
290  void LinesFileAddCoreLine3D(int nsample, double xbegin, double ybegin, double zbegin, const double xend[], const double yend[], const double zend[]);
291  void LinesFileAddGravityLine2D(int nsample, const double xg[], const double yg[]);
292  void LinesFileAddGravityLine3D(int nsample, const double xg[], const double yg[], const double zg[]);
293  void LinesFileCreateLink(const char *points_file);
294  void GridModifyOrigin(double x0, double y0, double z0);
295  void GridModifyMesh(double dx, double dy, double dz);
296  void GridModifyRotation(double az, double ay, double ax);
297 
298  /* Variable methods */
299  GTXStringArray GetVariableList();
300  GTXStringArray GetVariableList(GTXVariableInfo::VariableType var_type);
301  bool VariableExists(const char *variable);
302  void SetVariable(const char *variable);
303  void DeleteVariable();
304  void SetIndice(const int indice);
305  void SetAlphaIndice(const char *alphaindice);
306  GTXVariableInfo GetVariableInfo();
307  GTXIntArray GetMacroIndices();
308  GTXStringArray GetMacroAlphaIndices();
309  void AddMacroIndicesWithAlpha( const GTXIntArray indices, const GTXStringArray alpha_indices);
310  void AddMacroIndices( const GTXIntArray indices);
311 
312  GTXCharData ReadCharVariable(bool compress);
313  GTXCharData ReadCharVariableSub(gtx_long first, gtx_long last, bool compress);
314  GTXDoubleData ReadLineDoubleVariable(int line_index);
315  GTXDoubleData ReadDoubleVariable(bool compress);
316  GTXDoubleData ReadDoubleVariableSub(gtx_long first, gtx_long last, bool compress);
317  GTXByteArray ReadSelectionVariable();
318  GTXByteArray ReadSelectionVariableSub(gtx_long first, gtx_long last);
319  void NewDoubleVariable(const char *name, int bit_length, const GTXVariableFormat &format);
320  void NewCharVariable(const char *name, int max_length);
321  void SetVariableAsLineName(void);
322  void WriteLineDoubleVariable(int line_index, const GTXDoubleData &ddata);
323  void WriteDoubleVariable(bool compress, const GTXDoubleData &ddata);
324  void WriteDoubleVariableSub(gtx_long first, gtx_long last, bool compress, const GTXDoubleData &ddata);
325  void WriteCharVariable(bool compress, const GTXCharData &cdata);
326  void WriteCharVariableSub(gtx_long first, gtx_long last, bool compress, const GTXCharData &cdata);
327  void WriteSelectionVariableSub(const gtx_long first, const gtx_long last, const GTXByteArray data);
328  void WriteSelectionVariable(const GTXByteArray data);
329  const char *GetVariableComment();
330  void SetVariableComment(bool append, const char *comment);
331  void SetSelection(const char *sel);
332  void SetVariableUnit(const char *factor, const char *symbol);
333 
334  /* Unit Methods */
335  void SetUnit(const char *unit);
336  double UnitFactorFromSymbol(const char *symbol);
337  const char *UnitSymbolFromFactor(double factor);
338  void SetUnitMode(int mode);
339  void SetCreationUnits(const char *x_unit, const char *y_unit, const char *z_unit);
340 
341  /*Vendor Data Method*/
342  void VendorDataWrite(int level, const GTXVendorData &vdata);
343  GTXVendorData VendorDataRead(const char *identifier, int level);
344  bool VendorDataExists(const char *identifier, int level);
345  int VendorDataGetVersion(const char *identifier, int level);
346 
347  /*Fault System Method*/
348  GTXFaultSystem ReadFaults(int priority);
349  void WriteFaults(GTXFaultSystem fs);
350 
351  /*Polygon functions*/
352  void NewPolygonsFile(const char *name, const GTXPolygonSystem *psystem);
353  GTXPolygonSystem ReadPolygons();
354 
355  /*Wireframes functions*/
356  void NewWireframesFile(const char *name, const GTXWireframeSystem &wsys);
357  GTXWireframeSystem ReadWireframes();
358 
359 private:
360  static void _errorMessage(const char *msg);
361  static void _cleanupErrors();
362  static void _throwErrors();
363  static char *_errors;
364 
365  friend class GTXVendorData;
366 
367 };
368 
369 #endif // __GTXClient_hpp__