ESLA
Embeddable Scriting LAnguage
Stanford University, Rock Fracture Project research group
© 2003
00001 /************************************************************************* 00002 * ESLA: Embeddable Scripting LAnguage 00003 * Copyright (C) 2003 Frantz Maerten 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License as 00007 * published by the Free Software Foundation; either version 2 of the 00008 * License, or (at your option) any later version. 00009 * 00010 * If you modify this software, you should contact the author, include 00011 * a notice giving the name of the person performing the modification, 00012 * the date of modification, and the reason for such modification. 00013 * 00014 * Note that the GNU General Public License does not permit 00015 * incorporating the Software into proprietary programs. 00016 * 00017 * Contact: Frantz Maerten 00018 * frantz@pangea.stanford.edu 00019 * 00020 * Dept. of Geological & Environmental Sciences 00021 * Stanford University 00022 * Stanford, CA 94305-2115 00023 * USA 00024 *************************************************************************/ 00025 00026 00027 #ifndef BASIC_ACTIONS1 00028 #define BASIC_ACTIONS1 00029 00030 #include "../esla_namespace.h" 00031 #include "gen_action.h" 00032 #include "../utils/gen_static_repository.h" 00033 00034 BEGIN_LIB_NAMESPACE 00035 00036 // Need to create a Repository 00037 class OutFileRepository: public GenStaticRepository<std::ofstream> { 00038 public: 00039 static std::ofstream* resolve(const std::string& name) ; 00040 } ; 00041 00042 class TimerStartAction: public GenAction { 00043 public: 00044 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00045 virtual RET_TYPE execute() ; 00046 virtual std::string args() const ; 00047 virtual std::string command_name() const ; 00048 } ; 00049 //---------------------------------- 00050 DECLARE_SMART_OBJECT(TimerStartAction) ; 00051 //---------------------------------- 00052 00053 class TimerStopAction: public GenAction { 00054 public: 00055 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00056 virtual RET_TYPE execute() ; 00057 virtual std::string args() const ; 00058 virtual std::string command_name() const ; 00059 } ; 00060 //---------------------------------- 00061 DECLARE_SMART_OBJECT(TimerStopAction) ; 00062 //---------------------------------- 00063 00064 class TimerDisplayAction: public GenAction { 00065 public: 00066 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00067 virtual RET_TYPE execute() ; 00068 virtual std::string args() const ; 00069 virtual std::string command_name() const ; 00070 } ; 00071 //---------------------------------- 00072 DECLARE_SMART_OBJECT(TimerDisplayAction) ; 00073 //---------------------------------- 00074 00075 class TimerSetAction: public GenAction { 00076 public: 00077 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00078 virtual RET_TYPE execute() ; 00079 virtual std::string args() const ; 00080 virtual std::string command_name() const ; 00081 private: 00082 std::string var_ ; 00083 } ; 00084 //---------------------------------- 00085 DECLARE_SMART_OBJECT(TimerSetAction) ; 00086 //---------------------------------- 00087 00088 00089 class PrintAllActionsAction: public GenAction { 00090 public: 00091 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00092 virtual RET_TYPE execute() ; 00093 virtual std::string args() const ; 00094 virtual std::string command_name() const ; 00095 } ; 00096 //---------------------------------- 00097 DECLARE_SMART_OBJECT(PrintAllActionsAction) ; 00098 //---------------------------------- 00099 00100 00101 class OpenFileAction: public GenAction { 00102 public: 00103 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00104 virtual RET_TYPE execute() ; 00105 virtual std::string args() const ; 00106 virtual std::string command_name() const ; 00107 00108 private: 00109 std::string line_ ; 00110 } ; 00111 //---------------------------------- 00112 DECLARE_SMART_OBJECT(OpenFileAction) ; 00113 //---------------------------------- 00114 00115 00116 class CloseFileAction: public GenAction { 00117 public: 00118 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00119 virtual RET_TYPE execute() ; 00120 virtual std::string args() const ; 00121 virtual std::string command_name() const ; 00122 00123 private: 00124 std::string line_ ; 00125 } ; 00126 //---------------------------------- 00127 DECLARE_SMART_OBJECT(CloseFileAction) ; 00128 //---------------------------------- 00129 00130 00131 class WriteFileAction: public GenAction { 00132 public: 00133 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00134 virtual RET_TYPE execute() ; 00135 virtual std::string args() const ; 00136 virtual std::string command_name() const ; 00137 00138 private: 00139 RET_TYPE proceed(std::string& s) ; 00140 std::string line_ ; 00141 } ; 00142 //---------------------------------- 00143 DECLARE_SMART_OBJECT(WriteFileAction) ; 00144 //---------------------------------- 00145 00146 END_LIB_NAMESPACE 00147 00148 00149 00150 #endif