![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /Framework/src/APPBasicCommand.cc
Go to the documentation of this file.00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: APPBasicCommand.cc,v 1.18 2002/03/28 22:04:46 desilva Exp $ 00004 // 00005 // Description: 00006 // Class APPBasicCommand. This is an abstract class that acts as the 00007 // parent for the "module", "sequence" and "path" commands. In particular 00008 // it provides default handlers for the common sub-commands. 00009 // 00010 // Environment: 00011 // Software developed for the BaBar Detector at the SLAC B-Factory. 00012 // 00013 // Author List: 00014 // David R. Quarrie Original Author 00015 // Marc Turcotte Introduced Actions '97 00016 // Marc Turcotte Added R. Kapur's TK interface 5/98 00017 // 00018 // Copyright Information: 00019 // Copyright (C) 1994, 1995 Lawrence Berkeley Laboratory 00020 // Copyright (C) 1997, 1998 University of Texas at Dallas 00021 // 00022 //------------------------------------------------------------------------ 00023 #include "Experiment/Experiment.hh" 00024 00025 //----------------------- 00026 // This Class's Header -- 00027 //----------------------- 00028 #include "Framework/APPBasicCommand.hh" 00029 00030 //------------- 00031 // C Headers -- 00032 //------------- 00033 #include <assert.h> 00034 #include <string.h> 00035 00036 //------------------------------- 00037 // Collaborating Class Headers -- 00038 //------------------------------- 00039 #include "Framework/APPFramework.hh" 00040 #include "Framework/APPNameNode.hh" 00041 #include "FrameUtil/AbsInterp.hh" 00042 #include "FrameUtil/FwkString.hh" 00043 00044 // ---------------------------------------- 00045 // -- Public Function Member Definitions -- 00046 // ---------------------------------------- 00047 00048 //---------------- 00049 // Constructors -- 00050 //---------------- 00051 00052 APPBasicCommand::APPBasicCommand( 00053 const char* const theCommand, 00054 AppModule* theTarget ) 00055 : APPCommand( theCommand, theTarget ) 00056 { 00057 } 00058 00059 //-------------- 00060 // Destructor -- 00061 //-------------- 00062 00063 APPBasicCommand::~APPBasicCommand() 00064 { 00065 } 00066 00067 //----------- 00068 // Handler -- 00069 //----------- 00070 00071 int 00072 APPBasicCommand::handle( int argc, char* argv[] ) 00073 { 00074 AppFramework* theFrame = (AppFramework*)target(); 00075 int result = AbsInterp::OK; 00076 00077 setArgs( argc, argv ); 00078 00079 if ( 2 <= argc ) 00080 { 00081 if ( 0 == strcmp( argv[1], "append" ) ) 00082 result = appendHandler(); 00083 else if ( 0 == strcmp( argv[1], "clone" ) ) 00084 result = cloneHandler(); 00085 else if ( 0 == strcmp( argv[1], "create" ) ) 00086 result = createHandler(); 00087 else if ( 0 == strcmp( argv[1], "delete" ) ) 00088 result = deleteHandler(); 00089 else if ( 0 == strcmp( argv[1], "disable" ) ) 00090 result = disableHandler(); 00091 else if ( 0 == strcmp( argv[1], "enable" ) ) 00092 result = enableHandler(); 00093 else if ( 0 == strcmp( argv[1], "help" ) ) 00094 result = helpHandler(); 00095 else if ( 0 == strcmp( argv[1], "insert" ) ) 00096 result = insertHandler(); 00097 else if ( 0 == strcmp( argv[1], "list" ) ) 00098 result = listHandler(); 00099 else if ( 0 == strcmp( argv[1], "remove" ) ) 00100 result = removeHandler(); 00101 else if ( (0 == strcmp( argv[1], "talk")) || 00102 (0 == strcmp( argv[1], "talkTo" )) ) 00103 result = talkToHandler(); 00104 else if ( (0 == strcmp( argv[1], "input")) || 00105 (0 == strcmp( argv[1], "in" )) ) 00106 result = inputHandler(); 00107 else if ( (0 == strcmp( argv[1], "output")) || 00108 (0 == strcmp( argv[1], "out" )) ) 00109 result = outputHandler(); 00110 else if (0 == strcmp( argv[1], "update")) // temporary 00111 result = updateHandler(); 00112 else if ( 0 == strcmp( argv[1], "account") ) 00113 result = accountHandler(); 00114 else { 00115 FwkString txtmsg("invalid command name:"); 00116 for (int index=0; index < argc; index++ ) { 00117 txtmsg += " "; 00118 txtmsg += argv[index]; 00119 } 00120 theFrame->setError( txtmsg ); 00121 result = AbsInterp::ERROR; 00122 } 00123 } 00124 else { 00125 theFrame->setError( "not enough arguments" ); 00126 result = AbsInterp::ERROR; 00127 } 00128 return result; 00129 } 00130 00131 // ------------------------------------------- 00132 // -- Protected Function Member Definitions -- 00133 // ------------------------------------------- 00134 00135 // temporary 00136 int APPBasicCommand::updateHandler(){ 00137 return AbsInterp::OK; 00138 } 00139 00140 int 00141 APPBasicCommand::appendHandler() { 00142 AppFramework* theFrame = (AppFramework*)target(); 00143 theFrame->setError( "invalid command name: append" ); 00144 return AbsInterp::ERROR; } 00145 00146 00147 int 00148 APPBasicCommand::cloneHandler() { 00149 AppFramework* theFrame = (AppFramework*)target(); 00150 theFrame->setError( "invalid command name: clone" ); 00151 return AbsInterp::ERROR; } 00152 00153 int 00154 APPBasicCommand::createHandler() { 00155 AppFramework* theFrame = (AppFramework*)target(); 00156 theFrame->setError( "invalid command name: create" ); 00157 return AbsInterp::ERROR; } 00158 00159 int 00160 APPBasicCommand::deleteHandler() { 00161 AppFramework* theFrame = (AppFramework*)target(); 00162 theFrame->setError( "invalid command name: delete" ); 00163 return AbsInterp::ERROR; } 00164 00165 int 00166 APPBasicCommand::disableHandler() { 00167 AppFramework* theFrame = (AppFramework*)target(); 00168 theFrame->setError( "invalid command name: disable" ); 00169 return AbsInterp::ERROR; } 00170 00171 int 00172 APPBasicCommand::enableHandler() { 00173 AppFramework* theFrame = (AppFramework*)target(); 00174 theFrame->setError( "invalid command name: enable" ); 00175 return AbsInterp::ERROR; } 00176 00177 int 00178 APPBasicCommand::helpHandler() { 00179 AppFramework* theFrame = (AppFramework*)target(); 00180 theFrame->fullReport( "The following commands are available:" ); 00181 return AbsInterp::ERROR; } 00182 00183 int 00184 APPBasicCommand::insertHandler() { 00185 AppFramework* theFrame = (AppFramework*)target(); 00186 theFrame->setError( "invalid command name: insert" ); 00187 return AbsInterp::ERROR; } 00188 00189 int 00190 APPBasicCommand::listHandler() { 00191 AppFramework* theFrame = (AppFramework*)target(); 00192 theFrame->setError( "invalid command name: list" ); 00193 return AbsInterp::ERROR; } 00194 00195 int 00196 APPBasicCommand::removeHandler() { 00197 AppFramework* theFrame = (AppFramework*)target(); 00198 theFrame->setError( "invalid command name: remove" ); 00199 return AbsInterp::ERROR; } 00200 00201 int 00202 APPBasicCommand::talkToHandler() { 00203 AppFramework* theFrame = (AppFramework*)target(); 00204 theFrame->setError( "invalid command name: talk(To)" ); 00205 return AbsInterp::ERROR; } 00206 00207 int 00208 APPBasicCommand::inputHandler() { 00209 AppFramework* theFrame = (AppFramework*)target(); 00210 theFrame->setError( "invalid command name: in(put)" ); 00211 return AbsInterp::ERROR; } 00212 00213 int 00214 APPBasicCommand::outputHandler() { 00215 AppFramework* theFrame = (AppFramework*)target(); 00216 theFrame->setError( "invalid command name: out(put)" ); 00217 return AbsInterp::ERROR; } 00218 00219 int 00220 APPBasicCommand::accountHandler() { 00221 AppFramework* theFrame = (AppFramework*)target(); 00222 theFrame->setError( "invalid command name: account" ); 00223 return AbsInterp::ERROR; } 00224
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002