![]() |
|
|
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/AppSourceFileCommand.cc
Go to the documentation of this file.00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // 00004 // Description: 00005 // Class AppSourceFileCommand. 00006 // Command handler for the "sourceFileFound" command. 00007 // 00008 // Environment: 00009 // Software developed for the BaBar Detector at the SLAC B-Factory. 00010 // 00011 // Author List: 00012 // Asoka De Silva Original Author 00013 // 00014 // Copyright Information: 00015 // 00016 // 00017 //------------------------------------------------------------------------ 00018 #include "Experiment/Experiment.hh" 00019 00020 //----------------------- 00021 // This Class's Header -- 00022 //----------------------- 00023 #include "Framework/AppSourceFileCommand.hh" 00024 00025 //------------- 00026 // C Headers -- 00027 //------------- 00028 #include <assert.h> 00029 00030 //------------------------------- 00031 // Collaborating Class Headers -- 00032 //------------------------------- 00033 #include "Framework/APPModule.hh" 00034 #include "Framework/APPFramework.hh" 00035 #include "FrameUtil/AbsInterp.hh" 00036 #include "FrameUtil/FwkString.hh" 00037 00038 #ifndef CDF 00039 #include "CommonUtils/ComPathNameSearch.hh" 00040 #endif 00041 00042 //----------------------------------------------------------------------- 00043 // Local Macros, Typedefs, Structures, Unions and Forward Declarations -- 00044 //----------------------------------------------------------------------- 00045 00046 // ---------------------------------------- 00047 // -- Public Function Member Definitions -- 00048 // ---------------------------------------- 00049 00050 //---------------- 00051 // Constructors -- 00052 //---------------- 00053 00054 AppSourceFileCommand::AppSourceFileCommand( 00055 const char* const theCommand, AppModule* theTarget ) 00056 : APPCommand( theCommand, theTarget ) 00057 { 00058 } 00059 00060 //-------------- 00061 // Destructor -- 00062 //-------------- 00063 00064 AppSourceFileCommand::~AppSourceFileCommand( ) 00065 { 00066 } 00067 00068 //----------- 00069 // Handler -- 00070 //----------- 00071 00072 int 00073 AppSourceFileCommand::handle( int argc, char* argv[] ) 00074 { 00075 AppFramework* theFrame = (AppFramework*)target( ); 00076 AbsInterp* theInterp = AbsInterp::theInterpreter(); 00077 int result = AbsInterp::ERROR; 00078 00079 if ( 2 <= argc ) { 00080 #ifdef CDF 00081 FwkString fileName = ""; 00082 theFrame->setError("This command has not yet been implemented."); 00083 #else 00084 FwkString fileName( (const char*) ComPathNameSearch(argv[1]) ); 00085 #endif 00086 if (fileName.length() != 0) { 00087 const char* foundFile = (const char*) fileName; 00088 result = theInterp->runCommandFile( (const char*) foundFile); 00089 if (result != AbsInterp::OK) { 00090 FwkString errmsg = "sourceFoundFile failed when running "; 00091 errmsg+=fileName; 00092 theFrame->setError(errmsg); 00093 } 00094 } 00095 } else { 00096 theFrame->setError("wrong # args"); 00097 theFrame->setError("The syntax is: sourceFoundFile <filename>"); 00098 } 00099 00100 return result; 00101 } 00102 00103 void 00104 AppSourceFileCommand::show( ) const 00105 { 00106 } 00107 00108 bool 00109 AppSourceFileCommand::isShowable( ) const 00110 { 00111 return false; 00112 } 00113 00114 FwkString 00115 AppSourceFileCommand::description( ) const 00116 { 00117 return "Source file in $BFDEFAULTSEARCHPATH or $BFSEARCHPATH."; 00118 } 00119 00120 00121 00122 00123 00124 00125 00126
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002