00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00036 #include "bbtkTranscriptor.h"
00037 #include "bbtkMessageManager.h"
00038 #include "bbtkFactory.h"
00039 #include "bbtkUtilities.h"
00040 #include <fstream>
00041
00042
00043
00044
00045
00046
00047
00048 #include "bbtkConfigurationFile.h"
00049
00050 namespace bbtk
00051 {
00052 Transcriptor::Pointer Transcriptor::New(const std::string& filename)
00053 {
00054 return MakePointer(new Transcriptor(filename));
00055 }
00056
00060 Transcriptor::Transcriptor(const std::string& filename)
00061 :
00062 mDialogMode(NoDialog)
00063 {
00064
00065 bbtkDebugMessageInc("kernel",9,"Transcriptor()" <<std::endl);
00066
00067
00068 m_Fp.open (filename.c_str(), std::ios::out );
00069
00070 std::string file,path;
00071 file = bbtk::Utilities::ExtractScriptName(filename,path);
00072
00073 m_Fp << "#include \"bbtkExecuter.h\"" << std::endl;
00074 m_Fp << "void " << file << "(bbtk::Executer::Pointer e)"<<std::endl;
00075 m_Fp << "{"<<std::endl;
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 bbtkDebugDecTab("kernel",9);
00106 }
00107
00111 Transcriptor::~Transcriptor()
00112 {
00113
00114 bbtkDebugMessageInc("kernel",9,"~Transcriptor()" <<std::endl);
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 m_Fp << "}" << std::endl;
00130 m_Fp.close();
00131
00132 bbtkDebugDecTab("kernel",9);
00133 }
00134
00135
00136 void Transcriptor::Reset()
00137 {
00138 m_Fp << " e->Reset( );" << std::endl;
00139 }
00140
00141 void Transcriptor::Clear()
00142 {
00143 m_Fp << " e->Clear( );" << std::endl;
00144 }
00145
00146 void Transcriptor::SetWorkspaceName( const std::string& name )
00147 {
00148
00149 m_Fp << " e->SetWorkspaceName( \"" << name << "\" );" << std::endl;
00150 }
00151
00152 void Transcriptor::BeginPackage (const std::string &name)
00153 {
00154 m_Fp << " e->BeginPackage( \"" << name << "\" );" << std::endl;
00155 }
00156
00157 void Transcriptor::EndPackage()
00158 {
00159 m_Fp << " e->EndPackage( );" << std::endl;
00160 }
00161
00162 void Transcriptor::Define (const std::string &name,
00163 const std::string &pack,
00164 const std::string &scriptfilename)
00165 {
00166 m_Fp << " e->Define(\"" << name << "\", \"" << pack << "\", \""
00167 << scriptfilename << "\" );" << std::endl;
00168 }
00169
00170 void Transcriptor::SetCurrentFileName (const std::string &name )
00171 {
00172 m_Fp << " e->SetCurrentFileName( \"" << name << "\" );" << std::endl;
00173 }
00174
00175 void Transcriptor::EndDefine ()
00176 {
00177 m_Fp << " e->EndDefine( );" << std::endl;
00178 }
00179
00180 void Transcriptor::Kind(const std::string& kind)
00181 {
00182 m_Fp << " e->Kind( \""<<kind<<"\" );" << std::endl;
00183 }
00184
00185
00186 void Transcriptor::Create ( const std::string& nodeType,
00187 const std::string& nodeName)
00188 {
00189 m_Fp << " e->Create(\"" << nodeType << "\", \""
00190 << nodeName << "\");" << std::endl;
00191 }
00192
00193
00194 void Transcriptor::Destroy (const std::string &nodeName)
00195 {
00196 m_Fp << " e->Destroy(" << nodeName << ");" << std::endl;
00197 }
00198
00199 void Transcriptor::Connect (const std::string &nodeFrom,
00200 const std::string &outputLabel,
00201 const std::string &nodeTo,
00202 const std::string &inputLabel)
00203 {
00204 m_Fp << " e->Connect(\""<< nodeFrom << "\", \""
00205 << outputLabel << "\", \""
00206 << nodeTo << "\", \"" << inputLabel<< "\");" << std::endl;
00207 }
00208
00209
00210 void Transcriptor::Execute (const std::string &nodeName)
00211 {
00212 m_Fp << " e->Execute(\"" << nodeName << "\");" << std::endl;
00213 }
00214
00215 void Transcriptor::DefineInput ( const std::string &name,
00216 const std::string &box,
00217 const std::string &input,
00218 const std::string& help)
00219 {
00220
00221 m_Fp << " e->DefineInput(\""<< name << "\", \"" << box << "\", \""
00222 << input << "\", \"" << help << "\");" << std::endl;
00223 }
00224
00225
00226 void Transcriptor::DefineOutput ( const std::string &name,
00227 const std::string &box,
00228 const std::string &output,
00229 const std::string& help)
00230 {
00231 m_Fp << " e->DefineOutput(\""<< name << "\", \"" << box << "\", \""
00232 << output << "\", \"" << help << "\");" << std::endl;
00233 }
00234
00235
00236 void Transcriptor::Set (const std::string &box,
00237 const std::string &input,
00238 const std::string &value)
00239 {
00240 m_Fp << " e->Set(\""<< box << "\", \"" << input
00241 << "\", \"" << value << "\");"
00242 << std::endl;
00243 }
00244
00245 std::string Transcriptor::Get(const std::string &box,
00246 const std::string &output)
00247 {
00248
00249 m_Fp << " e->Get(\""<< box << "\", \"" << output << "\");"
00250 << std::endl;
00251 return "";
00252 }
00253
00254
00255 void Transcriptor::Author(const std::string &authorName)
00256 {
00257
00258 m_Fp << " e->Author(\"" << authorName << "\");" << std::endl;
00259 }
00260
00261 void Transcriptor::Category(const std::string &category)
00262 {
00263 m_Fp << " e->Category(\"" << category << "\");" << std::endl;
00264 }
00265
00266 void Transcriptor::Description(const std::string &d)
00267 {
00268 m_Fp << " e->Description(\"" << d << "\");" << std::endl;
00269 }
00270
00272 void Transcriptor::PrintHelpListBoxes()
00273 {
00274 m_Fp << " e->PrintBoxes( );" << std::endl;
00275 }
00276
00277 std::string Transcriptor::ShowGraph(const std::string &nameblackbox,
00278 const std::string &detailStr,
00279 const std::string &levelStr,
00280 const std::string &output_html,
00281 const std::string &custom_header,
00282 const std::string &custom_title,
00283 bool system_display )
00284 {
00285
00286 m_Fp << " e->ShowGraph(\"" << nameblackbox << "\", \""
00287 << detailStr << "\", \""
00288 << levelStr << "\", \""
00289 << output_html << "\", \""
00290 << custom_header << "\", \""
00291 << custom_title << "\");"
00292 << std::endl;
00293
00294 return "";
00295 }
00296
00297 std::string Transcriptor::ShowGraphInstances(const std::string &nameblackbox, int detail, int level,
00298 bool system_display)
00299 {
00300 return "";
00301
00302 }
00303
00304 void Transcriptor::PrintHelpBlackBox(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)
00305 {
00306
00307 }
00308
00309 void Transcriptor::Print(const std::string & message)
00310 {
00311 m_Fp << " e->Print(\"" <<message<<"\");"<<std::endl;
00312 }
00313
00314
00315
00316 void Transcriptor::SetMessageLevel(const std::string &kind,
00317 int level)
00318 {
00319 m_Fp << " e->SetMessageLevel(\"" <<kind<<"\","<<level<<");"<<std::endl;
00320 }
00321
00322
00323 void Transcriptor::HelpMessages()
00324 {
00325 m_Fp << " e->HelpMessages();"<<std::endl;
00326 }
00327
00328 void Transcriptor::LoadPackage(const std::string &name )
00329 {
00330 m_Fp << " e->LoadPackage(\"" <<name<<"\");"<<std::endl;
00331 }
00332
00333
00334 void Transcriptor::UnLoadPackage(const std::string &name )
00335 {
00336 m_Fp << " e->UnLoadPackage(\"" <<name<<"\");"<<std::endl;
00337 }
00338
00339
00340 std::string Transcriptor::GetObjectName() const
00341 {
00342 return std::string("Transcriptor");
00343 }
00344
00345
00346
00347 std::string Transcriptor::GetObjectInfo() const
00348 {
00349 std::stringstream i;
00350 return i.str();
00351 }
00352
00353
00354
00355 size_t Transcriptor::GetObjectSize() const
00356 {
00357 size_t s = Superclass::GetObjectSize();
00358 s += Transcriptor::GetObjectInternalSize();
00359 return s;
00360 }
00361
00362
00363 size_t Transcriptor::GetObjectInternalSize() const
00364 {
00365 size_t s = sizeof(Transcriptor);
00366 return s;
00367 }
00368
00369
00370 size_t Transcriptor::GetObjectRecursiveSize() const
00371 {
00372 size_t s = Superclass::GetObjectRecursiveSize();
00373 s += Transcriptor::GetObjectInternalSize();
00374 return s;
00375 }
00376
00377
00378
00379 }