FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
CTCLChannelCommander.h
1 #ifndef CTCLCHANNELCOMMANDER_H
2 #define CTCLCHANNLECOMMANDER_H
3 /*
4  This software is Copyright by the Board of Trustees of Michigan
5  State University (c) Copyright 2005.
6 
7  You may use this software under the terms of the GNU public license
8  (GPL). The terms of this license are described at:
9 
10  http://www.gnu.org/licenses/gpl.txt
11 
12  Author:
13  Ron Fox
14  NSCL
15  Michigan State University
16  East Lansing, MI 48824-1321
17 */
18 
19 /* Headers we absolutely must have: */
20 
21 #include <string>
22 #include <tcl.h>
23 
24 // Forward class definitions:
25 
26 class CTCLInterpreter;
27 
40 {
41 protected:
42  CTCLInterpreter* m_pInterp;
43  Tcl_Channel m_channel;
44  std::string m_command;
45  bool m_active;
46 
47  // constructors and canonicals.
48 
49 public:
51  Tcl_Channel channel);
52  virtual ~CTCLChannelCommander();
53 
54 private:
56  CTCLChannelCommander& operator=(const CTCLChannelCommander& rhs);
57  int operator==(const CTCLChannelCommander& rhs) const;
58  int operator!=(const CTCLChannelCommander& rhs) const;
59 
60 
61 
62  // Public interface:
63 public:
64  virtual void start(); // Add to Tcl Event loop.
65  virtual void stop(); // Remove from event loop.
66  Tcl_Channel getChannel() const;
67 
68  // static members:
69 
70 public:
71  static void inputRelay(ClientData pData, int mask);
72 
73  // Overridables:
74 
75  virtual void onInput();
76  virtual void onInputException();
77  virtual void onEndFile();
78  virtual void onCommand();
79  virtual void returnResult();
80 
81  virtual void prompt1();
82  virtual void prompt2();
83  virtual void sendPrompt(std::string prompt);
84  bool stopped() const;
85 
86  // utilities.
87 
88 protected:
89 
90  std::string prompt1String();
91  std::string prompt2String();
92  std::string getPromptString(const char* scriptVariable,
93  const char* defaultValue);
94 
95 };
96 
97 #endif
virtual void onEndFile()
Definition: CTCLChannelCommander.cpp:229
Definition: CTCLChannelCommander.h:39
virtual void onInput()
Definition: CTCLChannelCommander.cpp:170
virtual void prompt2()
Definition: CTCLChannelCommander.cpp:291
virtual void onInputException()
Definition: CTCLChannelCommander.cpp:219
Definition: TCLInterpreter.h:59
CTCLChannelCommander(CTCLInterpreter *interp, Tcl_Channel channel)
Definition: CTCLChannelCommander.cpp:43
static void inputRelay(ClientData pData, int mask)
Definition: CTCLChannelCommander.cpp:134
Tcl_Channel getChannel() const
Definition: CTCLChannelCommander.cpp:106
virtual void onCommand()
Definition: CTCLChannelCommander.cpp:244
virtual void sendPrompt(std::string prompt)
Definition: CTCLChannelCommander.cpp:304
virtual void prompt1()
Definition: CTCLChannelCommander.cpp:271
virtual void start()
Definition: CTCLChannelCommander.cpp:76
bool stopped() const
Definition: CTCLChannelCommander.cpp:115
virtual void stop()
Definition: CTCLChannelCommander.cpp:92
virtual void returnResult()
Definition: CTCLChannelCommander.cpp:261
virtual ~CTCLChannelCommander()
Definition: CTCLChannelCommander.cpp:59