1 #ifndef __JSYSTEM__JSHELL__ 
    2 #define __JSYSTEM__JSHELL__ 
   20 namespace JPP { 
using namespace JSYSTEM; }
 
   40     using JAbstractObjectStatus::operator bool;
 
   47     JShell(
const std::size_t  size = 65536) :
 
   55       static_cast<ostream&
>(*this) << 
"set prompt=" << 
prompt << endl;
 
   56       static_cast<ostream&
>(*this) << 
"echo hello"            << endl;
 
  106     inline bool get(
T& value)
 
  110       if (*
this >> value) {
 
  118         static_cast<istream&
>(*this).clear();
 
  145         const int c = this->
get();
 
  147         if        (c == streambuf::traits_type::eof()) {
 
  149           return !buffer.empty();
 
  151         } 
else if (c == eol) {
 
  159           if (buffer.size() >= 
prompt.size()) {
 
  161             const size_t pos = buffer.size() - this->
prompt.size();
 
  163             if (buffer.substr(pos) == this->
prompt) {
 
  167               return !buffer.empty();
 
  188       for (
string buffer; this->
getline(buffer); ) {
 
  189         out << buffer << endl;
 
  203       return ((
bool) static_cast<const std::ostream&>(*
this) && 
 
  204               (
bool) static_cast<const std::istream&>(*
this));
 
  215       static_cast<ostream&
>(*this) << 
"exit" << endl;
 
The JShell clas can be used to interact with the shell via I/O streams. 
 
virtual bool getStatus() const override
Get status of this shell. 
 
T get(const JHead &header)
Get object from header. 
 
const std::string & getPrompt() const 
Get prompt. 
 
JShell(const std::size_t size=65536)
Constructor. 
 
int flush()
Flush internal buffer. 
 
void exit()
Exit this shell. 
 
Streaming of input and output. 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
JShell & flush(std::ostream &out=null)
Extracts characters from this shell and flush them to the given output stream until the prompt is rea...
 
Streaming of input and output from Linux command. 
 
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
 
bool getline(std::string &buffer, const char eol= '\n')
Get line of text. 
 
static JShell & getInstance()
Get reference to unique instance of this class object. 
 
Interface for status of object. 
 
static JNullStream null
Null I/O stream. 
 
JShell & operator=(const JShell &)