InstructionExec Class Reference

Executes shell commands. More...

#include <Instruction.hpp>

Inheritance diagram for InstructionExec:

Inheritance graph
[legend]
Collaboration diagram for InstructionExec:

Collaboration graph
[legend]

List of all members.

Public Types

enum  Type {
  list, ifStatement, doWhileStatement, whileStatement,
  forStatement, exitStatement, coarseMesh, declaration,
  affectation, increment, input, decrement,
  evaluation, blockBegin, blockEnd, output,
  Using, exec, cat, plot,
  save, none
}

Public Member Functions

void execute ()
 InstructionExec (ReferenceCounting< StringExpression > command)
 InstructionExec (const InstructionExec &I)
 ~InstructionExec ()
const Instruction::Typetype () const

Protected Attributes

ReferenceCounting
< StringExpression
__command
const Instruction::Type __type


Detailed Description

Executes shell commands.

Author:
Stephane Del Pino
Date:
Mon Jan 26 17:40:26 2004

Definition at line 431 of file Instruction.hpp.


Member Enumeration Documentation

enum Instruction::Type [inherited]

Enumerator:
list 
ifStatement 
doWhileStatement 
whileStatement 
forStatement 
exitStatement 
coarseMesh 
declaration 
affectation 
increment 
input 
decrement 
evaluation 
blockBegin 
blockEnd 
output 
Using 
exec 
cat 
plot 
save 
none 

Definition at line 49 of file Instruction.hpp.

00049             {
00050     list,
00051     ifStatement,
00052     doWhileStatement,
00053     whileStatement,
00054     forStatement,
00055     exitStatement,
00056     coarseMesh,
00057 
00058     declaration,
00059     affectation,
00060     increment,
00061     input,
00062     decrement,
00063     evaluation,
00064 
00065     blockBegin,
00066     blockEnd,
00067 
00068     output,
00069     Using,
00070     exec,
00071     cat,
00072     plot,
00073     save,
00074     none
00075   };


Constructor & Destructor Documentation

InstructionExec::InstructionExec ( ReferenceCounting< StringExpression command  ) 

Definition at line 74 of file Instruction.cpp.

00075   : Instruction(Instruction::exec),
00076     __command(command)
00077 {
00078   ;
00079 }

InstructionExec::InstructionExec ( const InstructionExec I  ) 

Definition at line 81 of file Instruction.cpp.

00082   : Instruction(I),
00083     __command(I.__command)
00084 {
00085   ;
00086 }

InstructionExec::~InstructionExec (  ) 

Definition at line 88 of file Instruction.cpp.

00089 {
00090   ;
00091 }


Member Function Documentation

void InstructionExec::execute (  )  [virtual]

Implements Instruction.

Definition at line 57 of file Instruction.cpp.

References __command, fferr(), ffout(), and ErrorHandler::normal.

00058 {
00059   __command->execute();
00060   std::string command = __command->value();
00061   ffout(2) << "executing: " << command << '\n';
00062 #ifdef ALLOW_EXEC
00063   int result = system(command.c_str());
00064   if (result == -1) {
00065     throw ErrorHandler(__FILE__,__LINE__,
00066                        "could not execute: "+command,
00067                        ErrorHandler::normal);
00068   }
00069 #else // ALLOW_EXEC
00070   fferr(2) << "warning: this version was not compiled with 'exec' support.\n";
00071 #endif // ALLOW_EXEC
00072 }

Here is the call graph for this function:

const Instruction::Type& Instruction::type (  )  const [inline, inherited]

Definition at line 81 of file Instruction.hpp.

References Instruction::__type.

00082   {
00083     return __type;
00084   }


Member Data Documentation

Definition at line 435 of file Instruction.hpp.

Referenced by execute().

const Instruction::Type Instruction::__type [protected, inherited]

Definition at line 78 of file Instruction.hpp.

Referenced by Instruction::type().


The documentation for this class was generated from the following files:

Generated on Wed Nov 19 00:08:01 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6