Program: bbtk
Module: $RCSfile: bbtkBlackBox.cxx,v $
Language: C++
- Date: $Date: 2009/03/30 14:42:16 $
- Version: $Revision: 1.41 $
+ Date: $Date: 2009/05/18 10:45:40 $
+ Version: $Revision: 1.45 $
=========================================================================*/
/* ---------------------------------------------------------------------
#include "bbtkConfigurationFile.h"
#include "bbtkWxBlackBox.h"
+#include "bbtkWx.h"
#include <fstream>
//#include <vector>
//=========================================================================
//=========================================================================
- void BlackBox::Deleter::Delete(Object* p)
+ int BlackBox::Deleter::Delete(Object* p)
{
BlackBox* b = dynamic_cast<BlackBox*>(p);
if (!b)
BlackBoxDescriptor::WeakPointer desc = b->bbGetDescriptor();
bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : deleting black box"<<std::endl);
- b->bbDelete();
+ int refs = b->bbDelete();
bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : releasing descriptor"<<std::endl);
bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor expired : nothing to do (was not held by a package or the box is a complex black box prototype)"<<std::endl);
}
bbtkDebugMessage("object",2,"<## BlackBox::Deleter(\""<<name<<"\")"<<std::endl);
+ return refs;
}
//=========================================================================
BlackBox::BlackBox(const std::string &name)
:
// bbmStatus(MODIFIED),
+ bbmInitialized(false),
bbmExecuting(false),
bbmName(name),
bbmBoxProcessMode("Pipeline"),
BlackBox::BlackBox(BlackBox& from, const std::string &name)
:
// bbmStatus(from.bbmStatus),
- bbmExecuting(false),
- bbmName(name),
- bbmBoxProcessMode(from.bbmBoxProcessMode),
- bbmParent()
-
+ bbmInitialized(false),
+ bbmExecuting(false),
+ bbmName(name),
+ bbmBoxProcessMode(from.bbmBoxProcessMode),
+ bbmParent()
+
{
bbtkDebugMessage("object",4,"==> BlackBox::BlackBox("
<<from.bbGetFullName()<<",\""
}
//=========================================================================
+ //=========================================================================
+ void BlackBox::bbInitializeProcessing()
+ {
+ std::cout << "INIT BEFORE TEST"<<bbGetFullName()<<std::endl;
+ if (!bbmInitialized)
+ {
+ std::cout << "INIT "<<bbGetFullName()<<std::endl;
+ this->bbRecursiveInitializeProcessing();
+ bbmInitialized = true;
+ }
+ }
+ //=========================================================================
+ //=========================================================================
+ void BlackBox::bbFinalizeProcessing()
+ {
+ if (bbmInitialized)
+ {
+ std::cout << "FINI "<<bbGetFullName()<<std::endl;
+ this->bbRecursiveFinalizeProcessing();
+ bbmInitialized = false;
+ }
+ }
+ //=========================================================================
+
+
//=========================================================================
/// Main recursive processing method of the box.
void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
" -> already executing : abort"<<std::endl);
return;
}
+
+ // If not initialized do it
+ bbInitializeProcessing();
bbSetExecuting(true);
bool wasExecuting = bbGlobalGetSomeBoxExecuting();
bbGlobalSetSomeBoxExecuting(true);
-
- this->bbCreateWidget();
-
+
+ // Creates the window if the black box has one
+ this->bbCreateWindow();
+
// Updates its inputs
IOStatus s = bbUpdateInputs();
<<std::endl);
}
- this->bbShowWidget();
+ // Shows the window if the black box has one
+ this->bbShowWindow();
bbtkDebugMessage("process",3,