#include <bbtkVirtualExec.h>
Public Types | |
enum | DialogModeType { NoDialog, TextDialog, GraphicalDialog } |
typedef VirtualExec | Self |
typedef boost::shared_ptr< Self > | Pointer |
typedef boost::weak_ptr< Self > | WeakPointer |
Public Member Functions | |
void | SetInterpreter (InterpreterPointer i) |
Sets the interpreter who uses it. | |
InterpreterPointer | GetInterpreter () |
Gets the interpreter who uses it. | |
virtual Factory::Pointer | GetFactory () |
Gets the interpreter who uses it (const). | |
virtual void | SetInputs (const std::map< std::string, std::string > &m)=0 |
Gets the factory used by the executer (const). | |
virtual void | SetNoExecMode (bool b)=0 |
virtual bool | GetNoExecMode () const =0 |
virtual void | SetDialogMode (DialogModeType t)=0 |
Sets the mode of dialog of the executer for Root inputs. | |
virtual void | SetNoErrorMode (bool b)=0 |
virtual bool | GetNoErrorMode () const =0 |
virtual void | LoadPackage (const std::string &name)=0 |
Loads a package. | |
virtual void | UnLoadPackage (const std::string &name)=0 |
Unloads a package. | |
virtual void | BeginPackage (const std::string &name)=0 |
Starts a package block. | |
virtual void | EndPackage ()=0 |
Ends a package block. | |
virtual void | Define (const std::string &name, const std::string &pack, const std::string &scriptfilename)=0 |
virtual void | SetCurrentFileName (const std::string &name)=0 |
virtual void | EndDefine ()=0 |
End the definition of a ComplexBlackBox. | |
virtual void | Kind (const std::string &kind)=0 |
Sets the kind of the currently defined ComplexBlackBox. | |
virtual void | Create (const std::string &boxType, const std::string &boxName)=0 |
Creates a new black box in current complex box. | |
virtual void | Destroy (const std::string &boxName)=0 |
Destroys a black box. | |
virtual void | Connect (const std::string &boxfrom, const std::string &output, const std::string &boxto, const std::string &input)=0 |
Connects the output boxOutput to the input boxInput. | |
virtual void | Execute (const std::string &box)=0 |
Executes the box. | |
virtual void | DefineInput (const std::string &name, const std::string &box, const std::string &input, const std::string &help)=0 |
Defines an input of the current complex box. | |
virtual void | DefineOutput (const std::string &name, const std::string &box, const std::string &output, const std::string &help)=0 |
Defines an output of the current complex box. | |
virtual void | Set (const std::string &box, const std::string &input, const std::string &value)=0 |
sets the input of the box with the value | |
virtual std::string | Get (const std::string &box, const std::string &output)=0 |
gets the output of the box | |
virtual void | SetWorkspaceName (const std::string &n)=0 |
changes the workspace name | |
virtual void | Author (const std::string &authorName)=0 |
Adds the authorName to the Box author list. | |
virtual void | Category (const std::string &categories)=0 |
Adds the categories to the Box categoris list. | |
virtual void | Description (const std::string &d)=0 |
The description string which explains what does the ComplexBox. | |
virtual void | PrintBoxes ()=0 |
prints the list off the boxes of the current box | |
virtual std::string | ShowGraph (const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr, const std::string &output_file, const std::string &custom_header, const std::string &custom_title, bool system_display=true)=0 |
Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path. | |
virtual std::string | ShowGraphInstances (const std::string &nameblackbox, int detail, int level, bool system_display=true)=0 |
Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path. | |
virtual void | ShowRelations (const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)=0 |
Description of the actual pipeline. | |
virtual void | Reset ()=0 |
virtual void | SetMessageLevel (const std::string &kind, int level)=0 |
Sets the level of message for kind. | |
virtual void | HelpMessages ()=0 |
Prints help on the messages. | |
virtual void | Print (const std::string &message)=0 |
Prints the string ... MORE : TO EXPLAIN. | |
virtual ComplexBlackBoxDescriptor::Pointer | GetWorkspace () |
virtual std::string | GetObjectName () const |
virtual std::string | GetObjectInfo () const |
virtual size_t | GetObjectSize () const |
virtual size_t | GetObjectInternalSize () const |
virtual size_t | GetObjectRecursiveSize () const |
long | GetUseCount () |
Static Public Member Functions | |
static void | InsertInObjectList (Pointer) |
static void | RemoveFromObjectList (WeakPointer) |
static void | InsertInPackageList (Pointer) |
static void | ReleasePackages () |
static void | PrintObjectListInfo (const std::string &name) |
static void | PrintObjectInfo (const Pointer &o) |
static long | GetObjectsCount () |
Protected Member Functions | |
VirtualExec () | |
VirtualExec (const VirtualExec &) | |
virtual | ~VirtualExec () |
void | LockThis () |
void | UnLockThis () |
template<class U> | |
boost::shared_ptr< U > | GetThisPointer () const |
Static Protected Member Functions | |
template<class U> | |
static boost::shared_ptr< U > | MakePointer (U *s, bool lock=false) |
template<class U, class D> | |
static boost::shared_ptr< U > | MakePointer (U *s, const D &del, bool lock=false) |
Private Attributes | |
InterpreterWeakPointer | mInterpreter |
The interpreter which uses it (0 if none). | |
Friends | |
struct | Object::Deleter |
Definition at line 53 of file bbtkVirtualExec.h.
typedef VirtualExec bbtk::VirtualExec::Self |
Reimplemented in bbtk::Executer, and bbtk::Transcriptor.
Definition at line 55 of file bbtkVirtualExec.h.
typedef boost::shared_ptr<Self> bbtk::VirtualExec::Pointer |
Reimplemented from bbtk::Object.
Reimplemented in bbtk::Executer, and bbtk::Transcriptor.
Definition at line 55 of file bbtkVirtualExec.h.
typedef boost::weak_ptr<Self> bbtk::VirtualExec::WeakPointer |
Reimplemented from bbtk::Object.
Reimplemented in bbtk::Executer, and bbtk::Transcriptor.
Definition at line 55 of file bbtkVirtualExec.h.
enum bbtk::VirtualExec::DialogModeType |
Definition at line 57 of file bbtkVirtualExec.h.
00058 { 00059 NoDialog, 00060 TextDialog, 00061 GraphicalDialog 00062 }
bbtk::VirtualExec::VirtualExec | ( | ) | [protected] |
bbtk::VirtualExec::VirtualExec | ( | const VirtualExec & | ) | [protected] |
bbtk::VirtualExec::~VirtualExec | ( | ) | [protected, virtual] |
void bbtk::VirtualExec::SetInterpreter | ( | InterpreterPointer | i | ) | [inline] |
Sets the interpreter who uses it.
Definition at line 67 of file bbtkVirtualExec.h.
00067 { mInterpreter = i; }
Interpreter::Pointer bbtk::VirtualExec::GetInterpreter | ( | ) |
Gets the interpreter who uses it.
Definition at line 46 of file bbtkVirtualExec.cxx.
References mInterpreter.
00047 { 00048 return mInterpreter.lock(); 00049 }
virtual Factory::Pointer bbtk::VirtualExec::GetFactory | ( | ) | [inline, virtual] |
Gets the interpreter who uses it (const).
Gets the factory used by the executer
Reimplemented in bbtk::Executer.
Definition at line 74 of file bbtkVirtualExec.h.
virtual void bbtk::VirtualExec::SetInputs | ( | const std::map< std::string, std::string > & | m | ) | [pure virtual] |
Gets the factory used by the executer (const).
Sets the inputs of the workspace :
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::SetNoExecMode | ( | bool | b | ) | [pure virtual] |
Puts the executer in "no exec" mode, which creates but does not execute pipelines
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual bool bbtk::VirtualExec::GetNoExecMode | ( | ) | const [pure virtual] |
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::SetDialogMode | ( | DialogModeType | t | ) | [pure virtual] |
virtual void bbtk::VirtualExec::SetNoErrorMode | ( | bool | b | ) | [pure virtual] |
Puts the executer in "no error" mode, Errors do not stop execution (but warnings are produced)
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual bool bbtk::VirtualExec::GetNoErrorMode | ( | ) | const [pure virtual] |
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::LoadPackage | ( | const std::string & | name | ) | [pure virtual] |
virtual void bbtk::VirtualExec::UnLoadPackage | ( | const std::string & | name | ) | [pure virtual] |
virtual void bbtk::VirtualExec::BeginPackage | ( | const std::string & | name | ) | [pure virtual] |
virtual void bbtk::VirtualExec::EndPackage | ( | ) | [pure virtual] |
virtual void bbtk::VirtualExec::Define | ( | const std::string & | name, | |
const std::string & | pack, | |||
const std::string & | scriptfilename | |||
) | [pure virtual] |
Starts the definition of a new ComplexBlackBox in package pack scriptfilename is the file from which the def is read
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::SetCurrentFileName | ( | const std::string & | name | ) | [pure virtual] |
Sets the file name to use for the current definition (Used to set it after the Define command)
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::EndDefine | ( | ) | [pure virtual] |
virtual void bbtk::VirtualExec::Kind | ( | const std::string & | kind | ) | [pure virtual] |
Sets the kind of the currently defined ComplexBlackBox.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::Create | ( | const std::string & | boxType, | |
const std::string & | boxName | |||
) | [pure virtual] |
Creates a new black box in current complex box.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::Destroy | ( | const std::string & | boxName | ) | [pure virtual] |
virtual void bbtk::VirtualExec::Connect | ( | const std::string & | boxfrom, | |
const std::string & | output, | |||
const std::string & | boxto, | |||
const std::string & | input | |||
) | [pure virtual] |
Connects the output boxOutput to the input boxInput.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::Execute | ( | const std::string & | box | ) | [pure virtual] |
virtual void bbtk::VirtualExec::DefineInput | ( | const std::string & | name, | |
const std::string & | box, | |||
const std::string & | input, | |||
const std::string & | help | |||
) | [pure virtual] |
virtual void bbtk::VirtualExec::DefineOutput | ( | const std::string & | name, | |
const std::string & | box, | |||
const std::string & | output, | |||
const std::string & | help | |||
) | [pure virtual] |
Defines an output of the current complex box.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::Set | ( | const std::string & | box, | |
const std::string & | input, | |||
const std::string & | value | |||
) | [pure virtual] |
virtual std::string bbtk::VirtualExec::Get | ( | const std::string & | box, | |
const std::string & | output | |||
) | [pure virtual] |
virtual void bbtk::VirtualExec::SetWorkspaceName | ( | const std::string & | n | ) | [pure virtual] |
virtual void bbtk::VirtualExec::Author | ( | const std::string & | authorName | ) | [pure virtual] |
virtual void bbtk::VirtualExec::Category | ( | const std::string & | categories | ) | [pure virtual] |
Adds the categories to the Box categoris list.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::Description | ( | const std::string & | d | ) | [pure virtual] |
The description string which explains what does the ComplexBox.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::PrintBoxes | ( | ) | [pure virtual] |
prints the list off the boxes of the current box
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual std::string bbtk::VirtualExec::ShowGraph | ( | const std::string & | nameblackbox, | |
const std::string & | detailStr, | |||
const std::string & | levelStr, | |||
const std::string & | output_file, | |||
const std::string & | custom_header, | |||
const std::string & | custom_title, | |||
bool | system_display = true | |||
) | [pure virtual] |
Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual std::string bbtk::VirtualExec::ShowGraphInstances | ( | const std::string & | nameblackbox, | |
int | detail, | |||
int | level, | |||
bool | system_display = true | |||
) | [pure virtual] |
Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path.
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::ShowRelations | ( | const std::string & | nameblackbox, | |
const std::string & | detailStr, | |||
const std::string & | levelStr | |||
) | [pure virtual] |
virtual void bbtk::VirtualExec::Reset | ( | ) | [pure virtual] |
Implemented in bbtk::Executer, and bbtk::Transcriptor.
virtual void bbtk::VirtualExec::SetMessageLevel | ( | const std::string & | kind, | |
int | level | |||
) | [pure virtual] |
virtual void bbtk::VirtualExec::HelpMessages | ( | ) | [pure virtual] |
virtual void bbtk::VirtualExec::Print | ( | const std::string & | message | ) | [pure virtual] |
virtual ComplexBlackBoxDescriptor::Pointer bbtk::VirtualExec::GetWorkspace | ( | ) | [inline, virtual] |
std::string bbtk::Object::GetObjectName | ( | ) | const [virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 91 of file bbtkObject.cxx.
Referenced by bbtk::BlackBox::Deleter::Delete(), and bbtk::Object::Deleter::operator()().
std::string bbtk::Object::GetObjectInfo | ( | ) | const [virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 98 of file bbtkObject.cxx.
virtual size_t bbtk::Object::GetObjectSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 60 of file bbtkObject.h.
00060 { return sizeof(Object); }
virtual size_t bbtk::Object::GetObjectInternalSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 61 of file bbtkObject.h.
00061 { return sizeof(Object); }
virtual size_t bbtk::Object::GetObjectRecursiveSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 62 of file bbtkObject.h.
00062 { return sizeof(Object); }
long bbtk::Object::GetUseCount | ( | ) | [inline, inherited] |
void bbtk::Object::InsertInObjectList | ( | Pointer | p | ) | [static, inherited] |
Definition at line 59 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgObjectList.
00060 { 00061 bbtkDebugMessage("object",9,"##> Object::InsertInObjectList(\"" 00062 <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl); 00063 boost::weak_ptr<Object> w(p); 00064 mgObjectList.insert(w); 00065 }
void bbtk::Object::RemoveFromObjectList | ( | WeakPointer | p | ) | [static, inherited] |
Definition at line 80 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgObjectList.
00081 { 00082 bbtkDebugMessage("object",9,"##> Object::RemoveFromObjectList()" 00083 <<std::endl); 00084 mgObjectList.erase(p); 00085 00086 }
void bbtk::Object::InsertInPackageList | ( | Pointer | p | ) | [static, inherited] |
Definition at line 69 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgPackageList.
00070 { 00071 bbtkDebugMessage("object",9,"##> Object::InsertInPackageList(\"" 00072 <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl); 00073 boost::weak_ptr<Object> w(p); 00074 mgPackageList.insert(w); 00075 }
void bbtk::Object::ReleasePackages | ( | ) | [static, inherited] |
Definition at line 213 of file bbtkObject.cxx.
References bbtkDebugMessage, bbtk::i, and bbtk::Object::mgPackageList.
00214 { 00215 bbtkDebugMessage("object",1,"##> Object::ReleasePackages()"<<std::endl); 00216 // Release package pointers 00217 ObjectListType::iterator i; 00218 for (i = mgPackageList.begin(); 00219 i!= mgPackageList.end(); 00220 ++i) 00221 { 00222 if (i->use_count() != 0) 00223 { 00224 bbtkDebugMessage("object",1,"##> Releasing package '"<< 00225 i->lock()->GetThisPointer<Package>()->GetName() 00226 <<"'"<<std::endl); 00227 // Object::Pointer p(i->lock()); 00228 Package::WeakPointer w(i->lock()->GetThisPointer<Package>()); 00229 Package::Release(w); 00230 /* 00231 if (p->GetObjectName().find(name) != std::string::npos ) 00232 { 00233 std::cout << n << "/" << mgObjectList.size() << " "; 00234 PrintObjectInfo(p); 00235 m += p->GetObjectSize(); 00236 n++; 00237 } 00238 */ 00239 } 00240 } 00241 00242 }
void bbtk::Object::PrintObjectListInfo | ( | const std::string & | name | ) | [static, inherited] |
Definition at line 105 of file bbtkObject.cxx.
References bbtk::i, bbtk::Object::mgObjectList, and bbtk::Object::PrintObjectInfo().
00106 { 00107 00108 std::cout 00109 << "=============== Living bbtk::Object pointers ========="<<std::endl; 00110 00111 long n = 0; 00112 long u = 0; 00113 size_t m = 0; 00114 ObjectListType::iterator i; 00115 for (i = mgObjectList.begin(); 00116 i!=mgObjectList.end(); 00117 ++i) 00118 { 00119 if (i->use_count() == 0) 00120 { 00121 u++; 00122 } 00123 else 00124 { 00125 Object::Pointer p(i->lock()); 00126 if (p->GetObjectName().find(name) != std::string::npos ) 00127 { 00128 std::cout << n << "/" << mgObjectList.size() << " "; 00129 PrintObjectInfo(p); 00130 m += p->GetObjectSize(); 00131 n++; 00132 } 00133 } 00134 } 00135 std::cout 00136 << "------------------------------------------------------"<<std::endl; 00137 00138 std::cout << " Total : "<<n<<" objects - "<<m<<" b"<<std::endl; 00139 if (u==1) 00140 { 00141 std::cout<<"* Note : "<<u 00142 <<" object in list has 0 ref count, " 00143 <<"i.e. destroyed without removing itself from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl; 00144 } 00145 else if (u>1) 00146 { 00147 std::cout<<"* Note : "<<u 00148 <<" objects in list have 0 ref count, " 00149 <<"i.e. destroyed without removing themselves from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl; 00150 } 00151 std::cout 00152 << "============ EO Living bbtk::Object pointers ========="<<std::endl; 00153 00154 }
void bbtk::Object::PrintObjectInfo | ( | const Pointer & | o | ) | [static, inherited] |
Definition at line 180 of file bbtkObject.cxx.
Referenced by bbtk::Object::PrintObjectListInfo().
00181 { 00182 std::cout << "* [" << p << "] \t" 00183 << p.use_count()-1 << " r \t" 00184 << p->GetObjectRecursiveSize() << " (" 00185 << p->GetObjectSize() << ") b \t" 00186 << p->GetObjectName() 00187 << std::endl; 00188 std::cout << p->GetObjectInfo(); 00189 }
static long bbtk::Object::GetObjectsCount | ( | ) | [inline, static, inherited] |
void bbtk::Object::LockThis | ( | ) | [inline, protected, inherited] |
void bbtk::Object::UnLockThis | ( | ) | [inline, protected, inherited] |
boost::shared_ptr<U> bbtk::Object::GetThisPointer | ( | ) | const [inline, protected, inherited] |
Definition at line 92 of file bbtkObject.h.
00093 { 00094 return boost::dynamic_pointer_cast<U>(mThisPointer.lock()); 00095 }
static boost::shared_ptr<U> bbtk::Object::MakePointer | ( | U * | s, | |
bool | lock = false | |||
) | [inline, static, protected, inherited] |
Definition at line 97 of file bbtkObject.h.
Referenced by bbtk::Executer::Executer(), bbtk::Interpreter::Init(), bbtk::Transcriptor::New(), bbtk::Package::New(), bbtk::Interpreter::New(), bbtk::Factory::New(), and bbtk::Executer::New().
00098 { 00099 if (s->mThisPointer.lock()) 00100 { 00101 boost::shared_ptr<U> p = s->GetThisPointer<U>(); 00102 if (!lock) s->mThisPointerLocked.reset(); 00103 return p; 00104 } 00105 boost::shared_ptr<U> p = boost::shared_ptr<U>(s,Object::Deleter()); 00106 static_cast<Object::Deleter*> 00107 (p._internal_get_deleter(typeid(Object::Deleter))) 00108 ->mPointer = p; 00109 s->mThisPointer = p; 00110 Object::InsertInObjectList(p); 00111 if (lock) s->LockThis(); 00112 return p; 00113 }
static boost::shared_ptr<U> bbtk::Object::MakePointer | ( | U * | s, | |
const D & | del, | |||
bool | lock = false | |||
) | [inline, static, protected, inherited] |
Definition at line 115 of file bbtkObject.h.
00118 { 00119 if (s->mThisPointer.lock()) 00120 { 00121 boost::shared_ptr<U> p = s->GetThisPointer<U>(); 00122 if (!lock) s->mThisPointerLocked.reset(); 00123 return p; 00124 } 00125 boost::shared_ptr<U> p = boost::shared_ptr<U>(s,del); 00126 static_cast<D*> 00127 (p._internal_get_deleter(typeid(D))) 00128 ->mPointer = p; 00129 s->mThisPointer = p; 00130 Object::InsertInObjectList(p); 00131 if (lock) s->LockThis(); 00132 return p; 00133 }
friend struct Object::Deleter [friend] |
Reimplemented in bbtk::Executer, and bbtk::Transcriptor.
Definition at line 55 of file bbtkVirtualExec.h.
InterpreterWeakPointer bbtk::VirtualExec::mInterpreter [private] |
The interpreter which uses it (0 if none).
Definition at line 211 of file bbtkVirtualExec.h.
Referenced by GetInterpreter().