Chombo + EB  3.0
VisItPythonConnection.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _VISITPYTHONCONNECTION_H_
12 #define _VISITPYTHONCONNECTION_H_
13 
14 #include <string>
15 #include <vector>
16 #include <sys/types.h>
17 
18 #include "NamespaceHeader.H"
19 
20 // ****************************************************************************
21 // Class: VisItPythonConnection
22 //
23 // Purpose:
24 // Raw connection to VisIt's Python command line interface.
25 // Allows opening, closing and sending raw strings.
26 //
27 // Programmer: Jeremy Meredith
28 // Creation: June 12, 2007
29 //
30 // Modifications:
31 // Jeremy Meredith, Wed Jul 18 15:38:44 EDT 2007
32 // Allow extra launch arguments.
33 //
34 // ****************************************************************************
36 {
37  public:
40 
41  // Open the connection; uses VISITHOME or PATH to find visit.
42  bool Open(
43  std::vector<std::string> extraargs=std::vector<std::string>());
44  // Close the connection. Sends EOF to the Python CLI as well.
45  bool Close();
46  // Send a raw command. This method appends the newline for you.
47  bool SendCommand(const char *buff);
48  // Return true if we have a valid open connection.
49  bool IsOpen();
50  // When a function returns an error (false), get the error string.
51  std::string GetLastError();
52 
53  protected:
54  bool WriteString(const char *buff);
55  bool WaitForPrompt();
56  private:
57  int to_cli;
58  int from_cli;
59 
61  char *readbuffer;
62 
63  pid_t visitpid;
64  std::string error;
65 };
66 
67 #include "NamespaceFooter.H"
68 
69 #endif
int to_cli
Definition: VisItPythonConnection.H:57
std::string error
Definition: VisItPythonConnection.H:64
int from_cli
Definition: VisItPythonConnection.H:58
pid_t visitpid
Definition: VisItPythonConnection.H:63
bool SendCommand(const char *buff)
char * readbuffer
Definition: VisItPythonConnection.H:61
int readbufferlen
Definition: VisItPythonConnection.H:60
bool Open(std::vector< std::string > extraargs=std::vector< std::string >())
std::string GetLastError()
Definition: VisItPythonConnection.H:35
bool WriteString(const char *buff)