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::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::~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::SetWorkspaceName( const std::string& name )
00142 {
00143
00144 m_Fp << " e->SetWorkspaceName( \"" << name << "\" );" << std::endl;
00145 }
00146
00147 void Transcriptor::BeginPackage (const std::string &name)
00148 {
00149 m_Fp << " e->BeginPackage( \"" << name << "\" );" << std::endl;
00150 }
00151
00152 void Transcriptor::EndPackage()
00153 {
00154 m_Fp << " e->EndPackage( );" << std::endl;
00155 }
00156
00157 void Transcriptor::Define (const std::string &name,
00158 const std::string &pack,
00159 const std::string &scriptfilename)
00160 {
00161 m_Fp << " e->Define(\"" << name << "\", \"" << pack << "\", \""
00162 << scriptfilename << "\" );" << std::endl;
00163 }
00164
00165 void Transcriptor::SetCurrentFileName (const std::string &name )
00166 {
00167 m_Fp << " e->SetCurrentFileName( \"" << name << "\" );" << std::endl;
00168 }
00169
00170 void Transcriptor::EndDefine ()
00171 {
00172 m_Fp << " e->EndDefine( );" << std::endl;
00173 }
00174
00175 void Transcriptor::Kind(const std::string& kind)
00176 {
00177 m_Fp << " e->Kind( \""<<kind<<"\" );" << std::endl;
00178 }
00179
00180
00181 void Transcriptor::Create ( const std::string& nodeType,
00182 const std::string& nodeName)
00183 {
00184 m_Fp << " e->Create(\"" << nodeType << "\", \""
00185 << nodeName << "\");" << std::endl;
00186 }
00187
00188
00189 void Transcriptor::Destroy (const std::string &nodeName)
00190 {
00191 m_Fp << " e->Destroy(" << nodeName << ");" << std::endl;
00192 }
00193
00194 void Transcriptor::Connect (const std::string &nodeFrom,
00195 const std::string &outputLabel,
00196 const std::string &nodeTo,
00197 const std::string &inputLabel)
00198 {
00199 m_Fp << " e->Connect(\""<< nodeFrom << "\", \""
00200 << outputLabel << "\", \""
00201 << nodeTo << "\", \"" << inputLabel<< "\");" << std::endl;
00202 }
00203
00204
00205 void Transcriptor::Execute (const std::string &nodeName)
00206 {
00207 m_Fp << " e->Execute(\"" << nodeName << "\");" << std::endl;
00208 }
00209
00210 void Transcriptor::DefineInput ( const std::string &name,
00211 const std::string &box,
00212 const std::string &input,
00213 const std::string& help)
00214 {
00215
00216 m_Fp << " e->DefineInput(\""<< name << "\", \"" << box << "\", \""
00217 << input << "\", \"" << help << "\");" << std::endl;
00218 }
00219
00220
00221 void Transcriptor::DefineOutput ( const std::string &name,
00222 const std::string &box,
00223 const std::string &output,
00224 const std::string& help)
00225 {
00226 m_Fp << " e->DefineOutput(\""<< name << "\", \"" << box << "\", \""
00227 << output << "\", \"" << help << "\");" << std::endl;
00228 }
00229
00230
00231 void Transcriptor::Set (const std::string &box,
00232 const std::string &input,
00233 const std::string &value)
00234 {
00235 m_Fp << " e->Set(\""<< box << "\", \"" << input
00236 << "\", \"" << value << "\");"
00237 << std::endl;
00238 }
00239
00240 std::string Transcriptor::Get(const std::string &box,
00241 const std::string &output)
00242 {
00243
00244 m_Fp << " e->Get(\""<< box << "\", \"" << output << "\");"
00245 << std::endl;
00246 return "";
00247 }
00248
00249
00250 void Transcriptor::Author(const std::string &authorName)
00251 {
00252
00253 m_Fp << " e->Author(\"" << authorName << "\");" << std::endl;
00254 }
00255
00256 void Transcriptor::Category(const std::string &category)
00257 {
00258 m_Fp << " e->Category(\"" << category << "\");" << std::endl;
00259 }
00260
00261 void Transcriptor::Description(const std::string &d)
00262 {
00263 m_Fp << " e->Description(\"" << d << "\");" << std::endl;
00264 }
00265
00267 void Transcriptor::PrintBoxes()
00268 {
00269 m_Fp << " e->PrintBoxes( );" << std::endl;
00270 }
00271
00272 std::string Transcriptor::ShowGraph(const std::string &nameblackbox,
00273 const std::string &detailStr,
00274 const std::string &levelStr,
00275 const std::string &output_html,
00276 const std::string &custom_header,
00277 const std::string &custom_title,
00278 bool system_display )
00279 {
00280
00281 m_Fp << " e->ShowGraph(\"" << nameblackbox << "\", \""
00282 << detailStr << "\", \""
00283 << levelStr << "\", \""
00284 << output_html << "\", \""
00285 << custom_header << "\", \""
00286 << custom_title << "\");"
00287 << std::endl;
00288
00289 return "";
00290 }
00291
00292 std::string Transcriptor::ShowGraphInstances(const std::string &nameblackbox, int detail, int level,
00293 bool system_display)
00294 {
00295 return "";
00296
00297 }
00298
00299 void Transcriptor::ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)
00300 {
00301
00302 }
00303
00304 void Transcriptor::Print(const std::string & message)
00305 {
00306 m_Fp << " e->Print(\"" <<message<<"\");"<<std::endl;
00307 }
00308
00309
00310
00311 void Transcriptor::SetMessageLevel(const std::string &kind,
00312 int level)
00313 {
00314 m_Fp << " e->SetMessageLevel(\"" <<kind<<"\","<<level<<");"<<std::endl;
00315 }
00316
00317
00318 void Transcriptor::HelpMessages()
00319 {
00320 m_Fp << " e->HelpMessages();"<<std::endl;
00321 }
00322
00323 void Transcriptor::LoadPackage(const std::string &name )
00324 {
00325 m_Fp << " e->LoadPackage(\"" <<name<<"\");"<<std::endl;
00326 }
00327
00328
00329 void Transcriptor::UnLoadPackage(const std::string &name )
00330 {
00331 m_Fp << " e->UnLoadPackage(\"" <<name<<"\");"<<std::endl;
00332 }
00333
00334
00335 std::string Transcriptor::GetObjectName() const
00336 {
00337 return std::string("Transcriptor");
00338 }
00339
00340
00341
00342 std::string Transcriptor::GetObjectInfo() const
00343 {
00344 std::stringstream i;
00345 return i.str();
00346 }
00347
00348
00349
00350 size_t Transcriptor::GetObjectSize() const
00351 {
00352 size_t s = Superclass::GetObjectSize();
00353 s += Transcriptor::GetObjectInternalSize();
00354 return s;
00355 }
00356
00357
00358 size_t Transcriptor::GetObjectInternalSize() const
00359 {
00360 size_t s = sizeof(Transcriptor);
00361 return s;
00362 }
00363
00364
00365 size_t Transcriptor::GetObjectRecursiveSize() const
00366 {
00367 size_t s = Superclass::GetObjectRecursiveSize();
00368 s += Transcriptor::GetObjectInternalSize();
00369 return s;
00370 }
00371
00372
00373
00374 }