00001 //############################################################################################################################################### 00002 // 00003 // Meta and Builder Object Network V2.0 for GME 00004 // BON2Component.cpp 00005 // 00006 //############################################################################################################################################### 00007 00008 /* 00009 Copyright (c) Vanderbilt University, 2000-2004 00010 ALL RIGHTS RESERVED 00011 00012 Vanderbilt University disclaims all warranties with regard to this 00013 software, including all implied warranties of merchantability 00014 and fitness. In no event shall Vanderbilt University be liable for 00015 any special, indirect or consequential damages or any damages 00016 whatsoever resulting from loss of use, data or profits, whether 00017 in an action of contract, negligence or other tortious action, 00018 arising out of or in connection with the use or performance of 00019 this software. 00020 */ 00021 00022 #include "stdafx.h" 00023 #include <Console.h> 00024 #include "BON2Component.h" 00025 00026 namespace BON 00027 { 00028 00029 //############################################################################################################################################### 00030 // 00031 // C L A S S : BON::Component 00032 // 00033 //############################################################################################################################################### 00034 00035 Component::Component() 00036 : m_bIsInteractive( false ) 00037 { 00038 } 00039 00040 Component::~Component() 00041 { 00042 if ( m_project ) { 00043 m_project->finalizeObjects(); 00044 finalize( m_project ); 00045 m_project = NULL; 00046 } 00047 } 00048 00049 // ==================================================== 00050 // This method is called after all the generic initialization is done 00051 // This should be empty unless application-specific initialization is needed 00052 00053 void Component::initialize( Project& project ) 00054 { 00055 // ====================== 00056 // Insert application specific code here 00057 #ifdef GME_ADDON 00058 project->setAutoCommit( false); 00059 #endif 00060 } 00061 00062 // ==================================================== 00063 // This method is called before the whole BON2 project released and disposed 00064 // This should be empty unless application-specific finalization is needed 00065 00066 void Component::finalize( Project& project ) 00067 { 00068 // ====================== 00069 // Insert application specific code here 00070 } 00071 00072 // ==================================================== 00073 // This is the obsolete component interface 00074 // This present implementation either tries to call InvokeEx, or does nothing except of a notification 00075 00076 void Component::invoke( Project& project, const std::set<FCO>& setModels, long lParam ) 00077 { 00078 #ifdef SUPPORT_OLD_INVOKE 00079 Object focus; 00080 invokeEx( project, focus, setModels, lParam ); 00081 #else 00082 if ( m_bIsInteractive ) 00083 AfxMessageBox(_T("This BON2 Component does not support the obsolete invoke mechanism!")); 00084 #endif 00085 } 00086 00087 // ==================================================== 00088 // This is the main component method for Interpereters and Plugins. 00089 // May also be used in case of invokeable Add-Ons 00090 00091 void Component::invokeEx( Project& project, FCO& currentFCO, const std::set<FCO>& setSelectedFCOs, long lParam ) 00092 { 00093 #ifdef GME_ADDON 00094 project->setAutoCommit( false); 00095 #endif 00096 using namespace GMEConsole; 00097 Console::Out::WriteLine("Interpreter started..."); 00098 // ====================== 00099 // TODO: Insert application specific code here 00100 00101 Console::Out::WriteLine("Interpreter completed..."); 00102 } 00103 00104 // ==================================================== 00105 // GME currently does not use this function 00106 // You only need to implement it if other invokation mechanisms are used 00107 00108 void Component::objectInvokeEx( Project& project, Object& currentObject, const std::set<Object>& setSelectedObjects, long lParam ) 00109 { 00110 if ( m_bIsInteractive ) 00111 AfxMessageBox(_T("This BON2 Component does not support objectInvokeEx method!")); 00112 } 00113 00114 // ==================================================== 00115 // Implement application specific parameter-mechanism in these functions 00116 00117 Util::Variant Component::getParameter( const std::string& strName ) 00118 { 00119 // ====================== 00120 // Insert application specific code here 00121 00122 return Util::Variant(); 00123 } 00124 00125 void Component::setParameter( const std::string& strName, const Util::Variant& varValue ) 00126 { 00127 // ====================== 00128 // Insert application specific code here 00129 } 00130 00131 #ifdef GME_ADDON 00132 00133 // ==================================================== 00134 // If the component is an Add-On, then this method is called for every Global Event 00135 00136 void Component::globalEventPerformed( globalevent_enum event ) 00137 { 00138 // ====================== 00139 // Insert application specific code here 00140 } 00141 00142 // ==================================================== 00143 // If the component is an Add-On, then this method is called for every Object Event 00144 00145 void Component::objectEventPerformed( Object& object, unsigned long event, VARIANT v ) 00146 { 00147 // ====================== 00148 // Insert application specific code here 00149 } 00150 00151 #endif // GME_ADDON 00152 00153 }; // namespace BON 00154