std::cout << "con="<<console<<std::endl;
std::cout << "iws="<<bbtk::Wx::IsSomeWindowShown()<<std::endl;
*/
- if (!(show_on_error || cmd.console || bbtk::Wx::IsSomeWindowShown() ))
+ if (!(show_on_error || cmd.console || bbtk::Wx::IsSomeWindowAlive() ))
{
I->Close();
// std::cout << "I->Close"<<std::endl;
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
-OPTION(BBTK_USE_KWWIDGETS "Build bbtk with KWWidgets ?" OFF)
+# LG 25/05/09 : KW NOT SUPPORTED ANYMORE
+#OPTION(BBTK_USE_KWWIDGETS "Build bbtk with KWWidgets ?" OFF)
IF (BBTK_USE_KWWIDGETS)
SET(USE_KWWIDGETS ON CACHE BOOL "Use KWWidgets" FORCE)
ELSE (BBTK_USE_KWWIDGETS)
SET(USE_KWWIDGETS OFF CACHE BOOL "Use KWWidgets" FORCE)
ENDIF (BBTK_USE_KWWIDGETS)
-SWITCH_ON_IF_BUILD_ALL(BBTK_USE_KWWIDGETS)
+#SWITCH_ON_IF_BUILD_ALL(BBTK_USE_KWWIDGETS)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
Program: bbtk
Module: $RCSfile: bbtkAtomicBlackBox.cxx,v $
Language: C++
- Date: $Date: 2008/12/11 09:50:34 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.13 $
=========================================================================*/
/* ---------------------------------------------------------------------
AtomicBlackBox::AtomicBlackBox(const std::string &name, bool alloc)
: BlackBox(name)
{
- bbtkDebugMessage("object",3,
- "==> AtomicBlackBox::AtomicBlackBox(\""
- <<name<<"\")"<<std::endl);
- bbtkDebugMessage("object",3,
- "<== AtomicBlackBox::AtomicBlackBox(\""
+ bbtkBlackBoxDebugMessage("object",3,
+ "==> AtomicBlackBox(\""
<<name<<"\")"<<std::endl);
}
//=========================================================================
bool alloc)
: BlackBox(from,name)
{
- bbtkDebugMessage("object",3,
- "==>AtomicBlackBox::AtomicBlackBox("
- <<from.bbGetFullName()<<",\""
- <<name<<"\")"<<std::endl);
- bbtkDebugMessage("object",3,
- "<==AtomicBlackBox::AtomicBlackBox("
- <<from.bbGetFullName()<<",\""
- <<name<<"\")"<<std::endl);
-
+ bbtkBlackBoxDebugMessage("object",3,
+ "==> AtomicBlackBox("
+ <<from.bbGetFullName()<<",\""
+ <<name<<"\")"<<std::endl);
}
//=========================================================================
/// Destructor
AtomicBlackBox::~AtomicBlackBox()
{
- bbtkDebugMessage("object",3,"==> AtomicBlackBox::~AtomicBlackBox()"
+ bbtkBlackBoxDebugMessage("object",3,"==> ~AtomicBlackBox()"
<<std::endl);
- bbtkDebugMessage("object",3,"<== AtomicBlackBox::~AtomicBlackBox()"
+ bbtkBlackBoxDebugMessage("object",3,"<== ~AtomicBlackBox()"
<<std::endl);
}
//=========================================================================
//=========================================================================
Data AtomicBlackBox::bbGetOutput( const std::string &name )
{
- bbtkDebugMessageInc("Data",7,
- "AtomicBlackBox::bbGetOutput(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"
- <<std::endl);
+ bbtkBlackBoxDebugMessage("data",7,
+ "AtomicBlackBox::bbGetOutput(\""<<name<<"\")"
+ <<std::endl);
Data p = ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
- ->GetOutputDescriptor(name))->GetGetFunctor()->Get(this);
+ ->GetOutputDescriptor(name))->GetGetFunctor()->Get(this);
- bbtkDebugDecTab("Data",7);
return p;
}
//=========================================================================
/// Gets the input Data of a given name
Data AtomicBlackBox::bbGetInput( const std::string &name )
{
- bbtkDebugMessageInc("Data",7,
- "AtomicBlackBox::bbGetInput(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"
- <<std::endl);
+ bbtkBlackBoxDebugMessage("data",7,
+ "AtomicBlackBox::bbGetInput(\""<<name<<"\")"
+ <<std::endl);
Data p = ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
- ->GetInputDescriptor(name))->GetGetFunctor()->Get(this);
+ ->GetInputDescriptor(name))->GetGetFunctor()->Get(this);
- bbtkDebugDecTab("Data",7);
return p;
}
//=========================================================================
/// Sets the data of the output called <name>
void AtomicBlackBox::bbSetOutput( const std::string &name, Data data)
{
- bbtkDebugMessageInc("Data",7,
- "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data) ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("data",7,
+ "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data)"
<<std::endl);
((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
Data data,
bool setModified )
{
- bbtkDebugMessageInc("data",7,
- "AtomicBlackBox::bbSetInput(\""<<name<<"\",data) ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("data",7,
+ "AtomicBlackBox::bbSetInput(\""<<name<<"\",data)"
<<std::endl);
((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->Set(this,data);
MODIFIED);
}
- bbtkDebugDecTab("data",7);
}
//=========================================================================
bool setModified
)
{
- bbtkDebugMessageInc("data",7,
+ bbtkBlackBoxDebugMessage("data",7,
"AtomicBlackBox::bbBruteForceSetInputPointer(\""
- <<name<<"\",data) ["
- <<bbGetFullName()<<"]"
+ <<name<<"\",data)"
<<std::endl);
((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
->GetInputDescriptor(name))->GetSetFunctor()
MODIFIED);
}
- bbtkDebugDecTab("data",7);
}
//=========================================================================
Program: bbtk
Module: $RCSfile: bbtkAtomicBlackBoxDescriptor.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:12 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.4 $
=========================================================================*/
/* ---------------------------------------------------------------------
#include "bbtkAtomicBlackBoxDescriptor.h"
#include "bbtkBlackBox.h"
#include "bbtkPackage.h"
+#define bbtkDMessage(key,level,mess) \
+ bbtkMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
+#define bbtkDDebugMessage(key,level,mess) \
+ bbtkDebugMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
namespace bbtk
{
AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor()
{
- bbtkDebugMessage("object",3,"==> AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor()"<<std::endl);
+ bbtkDDebugMessage("object",3,"==> AtomicBlackBoxDescriptor()"<<std::endl);
// Creates the input 'BoxProcessMode'
AddInputDescriptor
(new
new bbtk::AtomicBlackBoxTSetFunctor<BlackBox,Void,Void>(&BlackBox::bbSetOutputBoxChange) ) );
//
AddToCategory("atomic box");
- bbtkDebugMessage("object",3,"<== AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor()"<<std::endl);
+ bbtkDDebugMessage("object",3,"<== AtomicBlackBoxDescriptor()"<<std::endl);
}
//===================================================================
AtomicBlackBoxDescriptor::~AtomicBlackBoxDescriptor()
{
- bbtkDebugMessage("object",3,"==> AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor()"<<std::endl);
- bbtkDebugMessage("object",3,"<== AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor()"<<std::endl);
+ bbtkDDebugMessage("object",3,"==> ~AtomicBlackBoxDescriptor()"<<std::endl);
}
}// namespace bbtk
Program: bbtk
Module: $RCSfile: bbtkAtomicBlackBoxInputDescriptor.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:12 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.4 $
=========================================================================*/
/* ---------------------------------------------------------------------
mGetFunctor(getfunctor),
mSetFunctor(setfunctor)
{
- bbtkDebugMessage("Kernel",9,
- "AtomicBlackBoxInputDescriptor::"
- <<"AtomicBlackBoxInputDescriptor(\""
+ bbtkDebugMessage("kernel",9,
+ "AtomicBlackBoxInputDescriptor(\""
<<name<<"\",\""<<description<<"\",\""
<<nature<<"\","
<<getfunctor<<","<<setfunctor<<","
AtomicBlackBoxInputDescriptor::~AtomicBlackBoxInputDescriptor()
{
- bbtkDebugMessage("Kernel",9,
- "AtomicBlackBoxInputDescriptor::"
- <<"~AtomicBlackBoxInputDescriptor(\""
- <<GetName()<<"\",\""<<GetDescription()<<"\","
- <<mGetFunctor<<","<<mSetFunctor<<")"<<std::endl);
+ bbtkDebugMessage("kernel",9,
+ "~AtomicBlackBoxInputDescriptor(\""
+ <<GetName()<<"\")"<<std::endl);
}
}
Program: bbtk
Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
Language: C++
- Date: $Date: 2009/05/18 10:45:40 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.18 $
=========================================================================*/
/* ---------------------------------------------------------------------
} \
inline bbtk::BlackBox::Pointer bbClone(const std::string& name) \
{ \
- bbtkDebugMessage("object",1,"##> "<<#CLASS \
- <<"::bbClone(\""<<name<<"\")"<<std::endl); \
+ bbtkBlackBoxDebugMessage("object",1,"##> "<<#CLASS \
+ <<"::bbClone(\""<<name<<"\")"<<std::endl); \
Pointer p = MakeBlackBoxPointer(new Self(*this,name)); \
- bbtkDebugMessage("object",1,"<## "<<#CLASS \
+ bbtkBlackBoxDebugMessage("object",1,"<## "<<#CLASS \
<<"::bbClone(\""<<name<<"\")"<<std::endl); \
return p; \
} \
public: \
inline void bbUserProcess() \
{ \
- bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName() \
- <<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("process",1,"**> Processing..." \
+ <<std::endl); \
CALLBACK(); \
- bbtkDebugMessage("process",1,"<** Processing ["<<bbGetFullName() \
- <<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("process",1,"<** Processing" \
+ <<std::endl); \
}
//============================================================================
//============================================================================
#define BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,ALLOC) \
- bbtkDebugMessage("object",2,"==> "<<#CLASS<<"::"<<#CLASS \
- <<"(\""<<bbGetName()<<"\")"<<std::endl); \
+ bbtkBlackBoxDebugMessage("object",2,"==> "<<#CLASS<<"::"<<#CLASS \
+ <<"()"<<std::endl); \
if (ALLOC) \
{ \
bbLockDescriptor(); \
//============================================================================
#define BBTK_END_BLACK_BOX_CONSTRUCTOR(CLASS) \
- bbtkDebugMessage("object",2,"<== "<<#CLASS<<"::"<<#CLASS \
- <<"(\""<<bbGetName()<<"\")"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",2,"<== "<<#CLASS<<"::"<<#CLASS \
+ <<"()"<<std::endl);
//============================================================================
//============================================================================
#define BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,FROM,ALLOC) \
- bbtkDebugMessageInc("object",2,"==> "<<#CLASS<<"::"<<#CLASS \
- <<"("<<FROM.bbGetFullName()<<",\"" \
- <<bbGetName()<<"\")"<<std::endl); \
+ bbtkBlackBoxDebugMessage("object",2,"==> "<<#CLASS<<"::"<<#CLASS \
+ <<"("<<FROM.bbGetFullName() \
+ <<")"<<std::endl); \
if (ALLOC) \
{ \
bbLockDescriptor(); \
//============================================================================
#define BBTK_END_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,FROM,ALLOC) \
- bbtkDebugMessage("object",2,"<== "<<#CLASS<<"::"<<#CLASS \
- <<"("<<FROM.bbGetFullName()<<",\"" \
- <<bbGetName()<<"\")"<<std::endl); \
+ bbtkBlackBoxDebugMessage("object",2,"<== "<<#CLASS<<"::"<<#CLASS \
+ <<"("<<FROM.bbGetFullName() \
+ <<")"<<std::endl); \
if (ALLOC) \
{ \
bbCopyIOValues(FROM); \
//============================================================================
#define BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS) \
- bbtkDebugMessage("object",2,"==> "<<#CLASS <<"::~"<< #CLASS \
- <<"() ["<<this->bbGetFullName()<<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("object",2,"==> "<<#CLASS <<"::~"<< #CLASS \
+ <<"()"<<std::endl); \
bbFinalizeProcessing();
//============================================================================
#define BBTK_END_BLACK_BOX_DESTRUCTOR(CLASS) \
- bbtkDebugMessage("object",2,"<== "<<#CLASS <<"::~"<< #CLASS \
- <<"() ["<<this->bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",2,"<== "<<#CLASS <<"::~"<< #CLASS \
+ <<"()"<<std::endl);
//============================================================================
Program: bbtk
Module: $RCSfile: bbtkAtomicBlackBoxOutputDescriptor.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:12 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.4 $
=========================================================================*/
/* ---------------------------------------------------------------------
mSetFunctor(setfunctor)
{
- bbtkDebugMessage("Kernel",9,
- "AtomicBlackBoxOutputDescriptor::AtomicBlackBoxOutputDescriptor(\""
+ bbtkDebugMessage("kernel",9,
+ "AtomicBlackBoxOutputDescriptor(\""
<<name<<"\",\""<<description
<<"\",\""<<nature<<"\","
<<getfunctor<<","<<setfunctor
AtomicBlackBoxOutputDescriptor::~AtomicBlackBoxOutputDescriptor()
{
- bbtkDebugMessage("Kernel",9,"AtomicBlackBoxOutputDescriptor::~AtomicBlackBoxOutputDescriptor(\""<<GetName()<<"\",\""<<GetDescription()<<"\""<<mGetFunctor<<","<<mSetFunctor<<")"<<std::endl);
+ bbtkDebugMessage("kernel",9,"~AtomicBlackBoxOutputDescriptor(\""<<GetName()<<"\")"<<std::endl);
}
}
Program: bbtk
Module: $RCSfile: bbtkBlackBox.cxx,v $
Language: C++
- Date: $Date: 2009/05/18 10:45:40 $
- Version: $Revision: 1.45 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.46 $
=========================================================================*/
/* ---------------------------------------------------------------------
bbmParent()
{
- bbtkDebugMessage("object",4,"==> BlackBox::BlackBox(\""
+ bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::BlackBox(\""
<<name<<"\")"<<std::endl);
- bbtkDebugMessage("object",4,"<== BlackBox::BlackBox(\""
+ bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::BlackBox(\""
<<name<<"\")"<<std::endl);
}
//=========================================================================
bbmParent()
{
- bbtkDebugMessage("object",4,"==> BlackBox::BlackBox("
+ bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::BlackBox("
<<from.bbGetFullName()<<",\""
<<name<<"\")"<<std::endl);
- bbtkDebugMessage("object",4,"<== BlackBox::BlackBox("
+ bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::BlackBox("
<<from.bbGetFullName()<<",\""
<<name<<"\")"<<std::endl);
}
//=========================================================================
BlackBox::~BlackBox()
{
- bbtkDebugMessage("object",4,"==> BlackBox::~BlackBox() ["<<bbmName
+ bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::~BlackBox() ["<<bbmName
<<"]"<<std::endl);
this->bbDesallocateConnectors();
- bbtkDebugMessage("object",4,"<== BlackBox::~BlackBox() ["<<bbmName
+ bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::~BlackBox() ["<<bbmName
<<"]"<<std::endl);
}
//=========================================================================
/// Returns true if the UserBlackBox has an input of name name
bool BlackBox::bbHasInput(const std::string& name) const
{
- bbtkDebugMessageInc("Kernel",8,
+ bbtkBlackBoxDebugMessage("kernel",8,
"BlackBox::bbHasInput(\""
- <<name<<"\") ["<<bbGetFullName()<<"]"
+ <<name<<"\")"
<<std::endl);
bool r = ( bbGetDescriptor()->GetInputDescriptorMap().find(name)
!= bbGetDescriptor()->GetInputDescriptorMap().end());
- bbtkDebugDecTab("Kernel",8);
+ bbtkDebugDecTab("kernel",8);
return r;
}
//=========================================================================
/// Returns true if the UserBlackBox has an output of name name
bool BlackBox::bbHasOutput(const std::string& name) const
{
- bbtkDebugMessageInc("Kernel",8,"BlackBox::bbHasOutput(\""
- <<name<<"\") ["<<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,"BlackBox::bbHasOutput(\""
+ <<name<<"\")"
+ <<std::endl);
bool r = ( bbGetDescriptor()->GetOutputDescriptorMap().find(name)
!= bbGetDescriptor()->GetOutputDescriptorMap().end());
- bbtkDebugDecTab("Kernel",8);
+ bbtkDebugDecTab("kernel",8);
return r;
}
//=========================================================================
/// Gets the output type of a given name
TypeInfo BlackBox::bbGetOutputType( const std::string &name ) const
{
- bbtkDebugMessageInc("Kernel",8,
- "BlackBox::bbGetOutputType(\""
- <<name<<"\") ["<<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,
+ "BlackBox::bbGetOutputType(\""
+ <<name<<"\")"
+ <<std::endl);
TypeInfo r = bbGetDescriptor()->GetOutputDescriptor(name)->GetTypeInfo();
- bbtkDebugDecTab("Kernel",8);
+ bbtkDebugDecTab("kernel",8);
return r;
}
//=========================================================================
/// Gets the input type of a given name
TypeInfo BlackBox::bbGetInputType( const std::string &name ) const
{
- bbtkDebugMessageInc("Kernel",8,
- "BlackBox::bbGetInputType(\""
- <<name<<"\") ["<<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,
+ "BlackBox::bbGetInputType(\""
+ <<name<<"\")"
+ <<std::endl);
TypeInfo r = bbGetDescriptor()->GetInputDescriptor(name)->GetTypeInfo();
- bbtkDebugDecTab("Kernel",8);
+ bbtkDebugDecTab("kernel",8);
return r;
}
//=========================================================================
/// Allocates the i/o connectors of the black box
void BlackBox::bbAllocateConnectors()
{
- bbtkDebugMessageInc("Kernel",8,
- "BlackBox::bbAllocateConnectors() ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("kernel",8,
+ "BlackBox::bbAllocateConnectors()"
<<std::endl);
+
+ MakeBlackBoxPointer(this,true);
+
const BlackBoxDescriptor::InputDescriptorMapType& imap
= bbGetDescriptor()->GetInputDescriptorMap();
BlackBoxDescriptor::InputDescriptorMapType::const_iterator i;
for ( i = imap.begin(); i != imap.end(); ++i )
{
- bbtkDebugMessage("Kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl);
bbGetInputConnectorMap()[i->second->GetName()]
= new BlackBoxInputConnector(GetThisPointer<BlackBox>());
}
BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o;
for ( o = omap.begin(); o != omap.end(); ++o )
{
- bbtkDebugMessage("Kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl);
bbGetOutputConnectorMap()[o->second->GetName()]
- = new BlackBoxOutputConnector();
+ = new BlackBoxOutputConnector(GetThisPointer<BlackBox>());
}
- bbtkDebugDecTab("Kernel",8);
+
}
//=========================================================================
/// Desallocates the i/o connectors of the black box
void BlackBox::bbDesallocateConnectors()
{
- bbtkDebugMessageInc("Kernel",8,
+ bbtkBlackBoxDebugMessage("kernel",8,
"BlackBox::bbDesallocateConnectors()"
<<std::endl);
for ( i = bbGetInputConnectorMap().begin();
i != bbGetInputConnectorMap().end(); ++i )
{
- bbtkDebugMessage("Kernel",8,"* Delete \""<<i->first<<"\""<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,"* Delete \""<<i->first<<"\""<<std::endl);
delete (i->second);
}
OutputConnectorMapType::const_iterator o;
for ( o = bbGetOutputConnectorMap().begin();
o != bbGetOutputConnectorMap().end(); ++o )
{
- bbtkDebugMessage("Kernel",8,"* Delete \""<<o->first<<"\""<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,"* Delete \""<<o->first<<"\""<<std::endl);
delete (o->second);
}
- bbtkDebugDecTab("Kernel",8);
+ bbtkDebugDecTab("kernel",8);
}
//=========================================================================
/// Copies the input / output values from another box
void BlackBox::bbCopyIOValues(BlackBox& from)
{
- bbtkDebugMessageInc("Kernel",1,
- "BlackBox::bbCopyIOValues("
- <<from.bbGetFullName()<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",1,
+ "BlackBox::bbCopyIOValues("
+ <<from.bbGetFullName()<<")"
+ <<std::endl);
// copies the input values
const BlackBoxDescriptor::InputDescriptorMapType& imap
= bbGetDescriptor()->GetInputDescriptorMap();
{
if (! i->second->GetCopyConstruct() ) continue;
std::string input = i->second->GetName();
- bbtkDebugMessage("Kernel",2,"* Copying input "<<input<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",2,"* Copying input "<<input<<std::endl);
this->bbSetInput(input, from.bbGetInput(input) );
}
// copies the output values
{
if (! o->second->GetCopyConstruct() ) continue;
std::string output = o->second->GetName();
- bbtkDebugMessage("Kernel",2,"* Copying output "<<output<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",2,"* Copying output "<<output<<std::endl);
this->bbSetOutput(output, from.bbGetOutput(output) );
}
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//=========================================================================
/// User overloadable destruction method of a black box
void BlackBox::bbUserDelete()
{
- bbtkDebugMessage("process",5,
- "=> BlackBox::bbUserDelete() ["
- <<bbGetFullName()<<"]"
- <<" : not overloaded; using standard deletion"
- <<std::endl);
+ bbtkBlackBoxDebugMessage("process",5,
+ "=> BlackBox::bbUserDelete()"
+ <<" : not overloaded; using standard deletion"
+ <<std::endl);
delete this;
}
//=========================================================================
void BlackBox::bbSetInputChangeTime(BlackBoxInputConnector* c,
const ChangeTime& t)
{
- bbtkDebugMessage("change",1,
+ bbtkBlackBoxDebugMessage("change",1,
"==> BlackBox::bbSetInputChangeTime("<<c<<","<<t<<") ["
<<bbGetFullName()<<"]"<<std::endl);
(c==bbGetInputConnectorMap().find("BoxExecute")->second))
&& (bbCanReact() ) )
{
- bbtkDebugMessage("change",2,
+ bbtkBlackBoxDebugMessage("change",2,
"an input of "
<<bbGetFullName()
<<" changed and box is in Reactive mode or BoxExecute input changed : adding it to the global execution list"
void BlackBox::bbSetOutputChangeTime(BlackBoxOutputConnector* c,
const ChangeTime& t)
{
- bbtkDebugMessage("change",1,
+ bbtkBlackBoxDebugMessage("change",1,
"==> BlackBox::bbSetOutputChangeTime("<<c<<","<<t<<") ["
<<bbGetFullName()<<"]"<<std::endl);
void BlackBox::bbSetStatusAndPropagate(BlackBoxInputConnector* c,
IOStatus s)
{
- bbtkDebugMessageInc("change",5,
- "=> BlackBox::bbSetStatusAndPropagate(input,"
- <<GetIOStatusString(s)<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "=> BlackBox::bbSetStatusAndPropagate(input,"
+ <<GetIOStatusString(s)<<")"
+ <<std::endl);
if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!");
c->SetStatus(s);
(c==bbGetInputConnectorMap().find("BoxExecute")->second))
&& (bbCanReact() ) )
{
- bbtkDebugMessage("change",2,
+ bbtkBlackBoxDebugMessage("change",2,
"-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl);
bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
}
- bbtkDebugMessageInc("change",5,
- "<= BlackBox::bbSetStatusAndPropagate(input) ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "<= BlackBox::bbSetStatusAndPropagate(input)"
+ <<std::endl);
}
//=========================================================================
//=========================================================================
void BlackBox::bbSignalOutputModification(bool reaction)
{
- bbtkDebugMessageInc("change",5,
- "=> BlackBox::bbSignalOutputModification("
- <<reaction<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "=> BlackBox::bbSignalOutputModification("
+ <<reaction<<")"
+ <<"]"<<std::endl);
OutputConnectorMapType::iterator i;
for ( i = bbGetOutputConnectorMap().begin();
if (reaction) bbGlobalProcessExecutionList();
- bbtkDebugMessageDec("change",5,
- "<= BlackBox::bbSignalOutputModification() ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "<= BlackBox::bbSignalOutputModification()"
+ <<std::endl);
}
//=========================================================================
void BlackBox::bbSignalOutputModification(const std::string& output,
bool reaction)
{
- bbtkDebugMessageInc("change",5,
- "=> BlackBox::bbSignalOutputModification("
- <<output<<","<<reaction<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "=> BlackBox::bbSignalOutputModification("
+ <<output<<","<<reaction<<")"
+ <<std::endl);
OutputConnectorMapType::iterator i =
bbGetOutputConnectorMap().find(output);
if (reaction) bbGlobalProcessExecutionList();
// }
- bbtkDebugMessageDec("change",5,
- "<= BlackBox::bbSignalOutputModification("
- <<output<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "<= BlackBox::bbSignalOutputModification("
+ <<output<<")"
+ <<std::endl);
}
//=========================================================================
void BlackBox::bbSignalOutputModification(const std::vector<std::string>& output,
bool reaction)
{
- bbtkDebugMessageInc("change",5,
- "=> BlackBox::bbSignalOutputModification(vector of outputs) ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "=> BlackBox::bbSignalOutputModification(vector of outputs)"
+<<std::endl);
OutputConnectorMapType::iterator i;
std::vector<std::string>::const_iterator o;
bool changed = false;
// }
}
- bbtkDebugMessageDec("change",5,
- "<= BlackBox::bbSignalOutputModification(vector of outputs) ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",5,
+ "<= BlackBox::bbSignalOutputModification(vector of outputs)"
+ <<std::endl);
}
//=========================================================================
/// Main processing method of the box.
void BlackBox::bbExecute(bool force)
{
- bbtkDebugMessageInc("process",2,
- "=> BlackBox::bbExecute("<<(int)force<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("process",2,
+ "=> BlackBox::bbExecute("<<(int)force<<")"
+ <<std::endl);
// If already executing : return
/*
if (bbGetExecuting())
{
- bbtkDebugMessage("process",2,
+ bbtkBlackBoxDebugMessage("process",2,
" -> already executing : abort"<<std::endl);
return;
}
// If execution frozen : return
if (bbGlobalGetFreezeExecution())
{
- bbtkDebugMessage("process",2,
+ bbtkBlackBoxDebugMessage("process",2,
" -> FreezeExecution global flag is 'true' : abort execution"<<std::endl);
}
// Calls the main recursive execution method
bbRecursiveExecute(Connection::Pointer());
- bbtkDebugMessageDec("process",2,
- "<= BlackBox::bbExecute() ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("process",2,
+ "<= BlackBox::bbExecute()"
+ <<std::endl);
}
//=========================================================================
//=========================================================================
void BlackBox::bbInitializeProcessing()
{
- std::cout << "INIT BEFORE TEST"<<bbGetFullName()<<std::endl;
if (!bbmInitialized)
{
- std::cout << "INIT "<<bbGetFullName()<<std::endl;
+ bbtkBlackBoxDebugMessage("process",2,"** Initialize processing"
+ <<std::endl);
this->bbRecursiveInitializeProcessing();
bbmInitialized = true;
}
{
if (bbmInitialized)
{
- std::cout << "FINI "<<bbGetFullName()<<std::endl;
+ bbtkBlackBoxDebugMessage("process",2,"** Finalize processing"
+ <<std::endl);
this->bbRecursiveFinalizeProcessing();
bbmInitialized = false;
}
/// Main recursive processing method of the box.
void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
{
- bbtkDebugMessageInc("process",3,
+ bbtkBlackBoxDebugMessage("process",3,
"=> BlackBox::bbRecursiveExecute("
- <<(caller?caller->GetFullName():"0")<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ <<(caller?caller->GetFullName():"0")<<")"
+ <<std::endl);
// If already executing : return
if (bbGetExecuting())
{
- bbtkDebugMessage("process",3,
+ bbtkBlackBoxDebugMessage("process",3,
" -> already executing : abort"<<std::endl);
return;
}
{
if (o->second->GetStatus() != UPTODATE)
{
- bbtkWarning("BlackBox::bbRecursiveExecute ["
- <<bbGetFullName()
- <<"] : all inputs are Up-to-date but output '"
+ bbtkWarning("BlackBox::bbRecursiveExecute: "
+ <<"all inputs are Up-to-date but output '"
<<o->first<<"' is Out-of-date ???");
}
}
- bbtkDebugMessage("process",3," -> Up-to-date : nothing to do"
+ bbtkBlackBoxDebugMessage("process",3," -> Up-to-date : nothing to do"
<<std::endl);
}
this->bbShowWindow();
- bbtkDebugMessage("process",3,
- "<= BlackBox::bbRecursiveExecute() ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("process",3,
+ "<= BlackBox::bbRecursiveExecute()"
+ <<std::endl);
bbSetExecuting(false);
bbGlobalSetSomeBoxExecuting(wasExecuting);
/// \returns The maximum of final IOStatus after each input update
IOStatus BlackBox::bbUpdateInputs()
{
- bbtkDebugMessageInc("process",4,
- "=> BlackBox::bbUpdateInputs() ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("process",4,
+ "=> BlackBox::bbUpdateInputs()"
<<std::endl);
IOStatus s = UPTODATE;
//if ( bbGetDescriptor()->GetInputDescriptor(i->first)->GetTypeInfo()
// == typeid(Void) )
// continue;
- bbtkDebugMessageDec("change",2,
- bbGetName()<<"."<<i->first
- <<" ["<<i->second<<"] "
- <<" status before update = '"
+ bbtkBlackBoxDebugMessage("change",2,
+ "Input '"<<i->first
+ <<"': status before update = '"
<<GetIOStatusString(i->second->GetStatus())
<<"'"<<std::endl);
i->second->RecursiveExecute();
IOStatus t = i->second->GetStatus();
if (t > s) s = t;
- bbtkDebugMessageDec("change",2,
- bbGetName()<<"."<<i->first
- <<" ["<<i->second<<"] "
- <<" status before process = '"
- <<GetIOStatusString(i->second->GetStatus())
- <<"'"<<std::endl);
+ bbtkBlackBoxDebugMessage("change",2,
+ "Input '"<<i->first
+ <<"': status before process = '"
+ <<GetIOStatusString(i->second->GetStatus())
+ <<"'"<<std::endl);
}
- bbtkDebugMessageDec("process",4,
- "<= BlackBox::bbUpdateInputs() ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("process",4,
+ "<= BlackBox::bbUpdateInputs()"
<<std::endl);
/// Computes the final IOStatus of inputs and outputs after processing
void BlackBox::bbComputePostProcessStatus()
{
- bbtkDebugMessageInc("process",4,
- "=> BlackBox::bbComputePostProcessStatus() ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("process",4,
+ "=> BlackBox::bbComputePostProcessStatus()"
<<std::endl);
IOStatus new_output_status = UPTODATE;
if (t == OUTOFDATE) new_output_status = OUTOFDATE;
// A previously MODIFIED status turns to UPTODATE
if (t==MODIFIED) i->second->SetStatus(UPTODATE);
- bbtkDebugMessage("change",2,
- bbGetName()<<"."<<i->first<<" : "
+ bbtkBlackBoxDebugMessage("change",2,
+ "Input '"<<i->first<<"' : "
<< GetIOStatusString(t) << " -> "
<< GetIOStatusString(i->second->GetStatus())
<< std::endl);
}
- bbtkDebugMessage("change",2,
- bbGetName()<<" new output status : "
- << GetIOStatusString(new_output_status)
- <<std::endl);
+ bbtkBlackBoxDebugMessage("change",2,
+ "New output status : "
+ << GetIOStatusString(new_output_status)
+ <<std::endl);
// Update the output statuses
OutputConnectorMapType::iterator o;
for ( o = bbGetOutputConnectorMap().begin();
o->second->SetStatus(new_output_status);
}
- bbtkDebugMessageInc("process",4,
- "<= BlackBox::bbComputePostProcessStatus() ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("process",4,
+ "<= BlackBox::bbComputePostProcessStatus()"
<<std::endl);
}
/// Connects the input <name> to the connection c
void BlackBox::bbConnectInput( const std::string& name, Connection* c)
{
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"==> BlackBox::bbConnectInput(\""
- <<name<<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<name<<"\","<<c->GetFullName()<<")"
<<std::endl);
// The input *MUST* be set OUTOFDATE to update its input on next execution
bbSetStatusAndPropagate(i->second,OUTOFDATE);
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"<== BlackBox::bbConnectInput(\""
- <<name<<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<name<<"\","<<c->GetFullName()<<")"
<<std::endl);
}
/// Connects the output <name> to the connection c
void BlackBox::bbConnectOutput( const std::string& name, Connection* c)
{
- bbtkDebugMessage("connection",2,
- "==> BlackBox::bbConnectOutput(\""<<name<<"\","
- <<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2,
+ "==> BlackBox::bbConnectOutput(\""<<name<<"\","
+ <<c->GetFullName()<<")"
+ <<std::endl);
OutputConnectorMapType::iterator i = bbGetOutputConnectorMap().find(name);
if (i==bbGetOutputConnectorMap().end())
}
i->second->SetConnection(c);
- bbtkDebugMessage("connection",2,
- "<== BlackBox::bbConnectOutput(\""<<name<<"\","
- <<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2,
+ "<== BlackBox::bbConnectOutput(\""<<name<<"\","
+ <<c->GetFullName()<<")"
+ <<std::endl);
}
//=========================================================================
void BlackBox::bbDisconnectInput( const std::string& name, Connection* c)
{
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"==> BlackBox::bbDisconnectInput(\""<<name
- <<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<"\","<<c->GetFullName()<<")"
<<std::endl);
if (!c)
{
- bbtkDebugMessage("connection",2,"c==0"<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2,"c==0"<<std::endl);
return;
}
}
i->second->UnsetConnection(c);
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"<== BlackBox::bbDisconnectInput(\""<<name
- <<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<"\","<<c->GetFullName()<<")"
<<std::endl);
}
/// Disconnects the output <name> from the connection c
void BlackBox::bbDisconnectOutput( const std::string& name, Connection* c)
{
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"==> BlackBox::bbDisconnectOutput(\""<<name
- <<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<"\","<<c->GetFullName()<<")"
<<std::endl);
if (!c)
{
- bbtkDebugMessage("connection",2,"c==0"<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2,"c==0"<<std::endl);
return;
}
}
i->second->UnsetConnection(c);
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"<== BlackBox::bbDisconnectOutput(\""<<name
- <<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<"\","<<c->GetFullName()<<")"
<<std::endl);
}
//=========================================================================
if (this->bbGetDescriptor()->GetPackage())
{
- bbtkMessage("Help",1,"Black Box '"<<bbGetName()<<"' <"<<
+ bbtkBlackBoxMessage("Help",1,"Black Box '"<<bbGetName()<<"' <"<<
this->bbGetDescriptor()->GetPackage()->GetName()
<<"::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
}
else
{
- bbtkMessage("Help",1,"Black Box <::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
+ bbtkBlackBoxMessage("Help",1,"Black Box <::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
}
/*
if (bbIsUpToDate())
{
- bbtkMessage("Help",1,"Up-to-date ["<<mMaxInputChangeTime<<","
+ bbtkBlackBoxMessage("Help",1,"Up-to-date ["<<mMaxInputChangeTime<<","
<<mMinOutputChangeTime<<"]"<<std::endl);
}
else
{
- bbtkMessage("Help",1,"Out-of-date ["<<mMaxInputChangeTime<<","
+ bbtkBlackBoxMessage("Help",1,"Out-of-date ["<<mMaxInputChangeTime<<","
<<mMinOutputChangeTime<<"]"<<std::endl);
}
*/
- // bbtkMessage("Help",1," "<<GetDescription()<<std::endl);
- // bbtkMessage("Help",1," By : "<<GetAuthor()<<std::endl);
+ // bbtkBlackBoxMessage("Help",1," "<<GetDescription()<<std::endl);
+ // bbtkBlackBoxMessage("Help",1," By : "<<GetAuthor()<<std::endl);
std::vector<std::string> iname;
std::vector<std::string> ivalue;
}
if (iname.size())
- bbtkMessage("Help",1," * Inputs : "<<std::endl);
+ bbtkBlackBoxMessage("Help",1," * Inputs : "<<std::endl);
else
- bbtkMessage("Help",1," * No inputs"<<std::endl);
+ bbtkBlackBoxMessage("Help",1," * No inputs"<<std::endl);
std::vector<std::string>::iterator i1,i2,i3,i4;
for (i1=iname.begin(),i2=ivalue.begin(),i3=iconn.begin(),i4=istatus.begin();
value += "'";
value.append(1+valuelmax-value.size(),' ');
if (i3->size())
- bbtkMessage("Help",1," '"<<name<<" = '"<<value<<" <-- '"
+ bbtkBlackBoxMessage("Help",1," '"<<name<<" = '"<<value<<" <-- '"
<<*i3<<"'");
else
- bbtkMessage("Help",1," '"<<name<<" = '"<<value);
- bbtkMessage("Help",1," ["<<*i4<<"]"<<std::endl);
+ bbtkBlackBoxMessage("Help",1," '"<<name<<" = '"<<value);
+ bbtkBlackBoxMessage("Help",1," ["<<*i4<<"]"<<std::endl);
}
if (oname.size())
- bbtkMessage("Help",1," * Outputs : "<<std::endl);
+ bbtkBlackBoxMessage("Help",1," * Outputs : "<<std::endl);
else
- bbtkMessage("Help",1," * No outputs"<<std::endl);
+ bbtkBlackBoxMessage("Help",1," * No outputs"<<std::endl);
std::vector<std::vector<std::string> >::iterator i5;
value += "'";
value.append(1+valuelmax-value.size(),' ');
if (!(*i5).size())
- bbtkMessage("Help",1," '"<<name<<" = '"<<value);
+ bbtkBlackBoxMessage("Help",1," '"<<name<<" = '"<<value);
else
{
std::string pref = " '"+name+" = '"+value;
for (i3=i5->begin();i3!=i5->end();++i3)
{
- bbtkMessage("Help",1,pref<<" --> '"<<*i3<<"'");
+ bbtkBlackBoxMessage("Help",1,pref<<" --> '"<<*i3<<"'");
pref.replace(0,pref.size(),pref.size(),' ');
}
}
- bbtkMessage("Help",1," ["<<*i4<<"]"<<std::endl);
+ bbtkBlackBoxMessage("Help",1," ["<<*i4<<"]"<<std::endl);
}
}
//=========================================================================
void BlackBox::bbGlobalProcessExecutionList()
{
- bbtkDebugMessageInc("process",3,
- "=> BlackBox::bbGlobalProcessExecutionList()"
- <<std::endl);
+ bbtkDebugMessage("process",3,
+ "=> BlackBox::bbGlobalProcessExecutionList()"
+ <<std::endl);
if (bbmgGlobalProcessingExecutionList)
{
bbtkDebugMessage("process",3,"BlackBox::bbGlobalProcessExecutionList() reentered !");
if (p.lock())
{
bbtkDebugMessage("process",4,
- " -> Executing "<<
- p.lock()->bbGetFullName()<<std::endl);
+ " -> Executing '"<<
+ p.lock()->bbGetName()<<"'"<<std::endl);
p.lock()->bbExecute(true);
}
else
}
bbmgExecutionList.clear();
- bbtkDebugMessageDec("process",3,
+ bbtkDebugMessage("process",3,
"<= BlackBox::bbGlobalProcessExecutionList()"
<<std::endl);
void BlackBox::bbGlobalAddToExecutionList( BlackBox::Pointer b )
{
- bbtkDebugMessage("process",3,"* bbGlobalAddToExecutionList("<<b->bbGetFullName()<<")"<<std::endl);
+ bbtkDebugMessage("process",3,"* bbGlobalAddToExecutionList("<<b->bbGetName()<<")"<<std::endl);
if (bbmgGlobalProcessingExecutionList)
{
bbtkDebugMessage("process",3,"bbGlobalAddToExecutionList called inside bbGlobalProcessExecutionList !");
//=========================================================================
void BlackBox::Check(bool recursive)
{
- bbtkMessage("debug",1,"*** Checking Black Box "<<(void*)this<<" ["<<bbGetFullName()
- <<"] ... OK"<<std::endl);
+ bbtkBlackBoxMessage("debug",1,"*** Checking"
+ <<" ... OK"<<std::endl);
}
//=========================================================================
- void BlackBox::bbUserOnShowWidget(std::string nameInput)
- {
- bbtk::BlackBoxInputConnector *cc;
- cc = this->bbGetInputConnectorMap().find( nameInput.c_str() )->second;
- if (cc->GetConnection()!=NULL)
- {
- cc->GetConnection()->GetBlackBoxFrom()->bbUserOnShow();
- }
- }
Program: bbtk
Module: $RCSfile: bbtkBlackBox.h,v $
Language: C++
- Date: $Date: 2009/05/14 14:43:33 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.26 $
=========================================================================*/
/* ---------------------------------------------------------------------
#define __bbtkBlackBox_h__
#include "bbtkSystem.h"
+#include "bbtkMessageManager.h"
#include "bbtkBlackBoxDescriptor.h"
#include "bbtkBlackBoxInputConnector.h"
//#include "bbtkBlackBoxOutputConnector.h"
#include <boost/signal.hpp>
#include <boost/bind.hpp>
+
+#define bbtkBlackBoxMessage(key,level,mess) \
+ bbtkMessage(key,level,"["<<bbGetName()<<"] "<<mess)
+#define bbtkBlackBoxDebugMessage(key,level,mess) \
+ bbtkDebugMessage(key,level,"["<<bbGetName()<<"] "<<mess)
+
namespace bbtk
{
virtual void Check(bool recursive = true);
- virtual void bbUserOnShow() { }
- void bbUserOnShowWidget(std::string nameInput);
+ virtual void bbSetShown(bool) {}
+ virtual bool bbIsShown() { return false; }
+ virtual void bbUserOnShow() {}
protected:
//==================================================================
void bbComputePostProcessStatus();
//==================================================================
-
- //==================================================================
- /// Specific methods for window creation during pipeline execution
- /// Creates the window associated to the box (called after bbUpdateInputs)
- /// Does nothing here. Overloaded in WxBlackBox.
- // virtual void bbCreateWindow() { }
- /// Shows the window associated to the box
- /// (called after bbProcess during bbExecute)
- /// Does nothing here but overloaded in WxBlackBox and WxContainerBlackBox
- // virtual void bbShowWindow(Connection::Pointer caller) { }
- // virtual void bbHideWindow() {}
- // virtual void bbCloseWindow() { }
- //==================================================================
-
//@}
public:
Program: bbtk
Module: $RCSfile: bbtkBlackBoxDescriptor.cxx,v $
Language: C++
- Date: $Date: 2009/04/08 07:56:11 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.21 $
=========================================================================*/
/* ---------------------------------------------------------------------
typedef Package::Pointer PackagePointer;
+#define bbtkDMessage(key,level,mess) \
+ bbtkMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
+#define bbtkDDebugMessage(key,level,mess) \
+ bbtkDebugMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
//=========================================================================
mKind(STANDARD),
mPackage()
{
- bbtkDebugMessage("object",4,
- "==> BlackBoxDescriptor::BlackBoxDescriptor()"<<std::endl);
- bbtkDebugMessage("object",4,
- "<== BlackBoxDescriptor::BlackBoxDescriptor()"<<std::endl);
+ bbtkDDebugMessage("object",4,
+ "==> BlackBoxDescriptor()"<<std::endl);
+ bbtkDDebugMessage("object",4,
+ "<== BlackBoxDescriptor()"<<std::endl);
}
//=========================================================================
/// Dtor
BlackBoxDescriptor::~BlackBoxDescriptor()
{
- bbtkDebugMessage("object",4,
- "==> BlackBoxDescriptor::~BlackBoxDescriptor() ["
- <<mTypeName<<"]"<<std::endl);
+ bbtkDDebugMessage("object",4,
+ "==> ~BlackBoxDescriptor()"
+ <<std::endl);
// deletes all I/O descriptors
InputDescriptorMapType::iterator i;
OutputDescriptorMapType::iterator o;
for (o=mOutput.begin(); o!=mOutput.end(); ++o) delete o->second;
- bbtkDebugMessage("object",4,
- "<== BlackBoxDescriptor::~BlackBoxDescriptor() ["
- <<mTypeName<<"]"<<std::endl);
+ bbtkDDebugMessage("object",4,
+ "<== ~BlackBoxDescriptor()"
+ <<std::endl);
}
//=========================================================================
/// Dtor
void BlackBoxDescriptor::UnReference()
{
- bbtkDebugMessageInc("Kernel",1,
+ bbtkDDebugMessageInc("kernel",1,
"BlackBoxDescriptor::UnReference() ["
<<mTypeName<<"] #"<<mRefCount-1<<std::endl);
mRefCount--;
if (mRefCount<=0)
{
- bbtkDebugMessage("Kernel",1,"--> Destructing BlackBoxDescriptor ["<<mTypeName<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",1,"--> Destructing BlackBoxDescriptor ["<<mTypeName<<"]"<<std::endl);
delete this;
}
}
/// Adds the string to the BlackBox description
void BlackBoxDescriptor::AddToDescription( const std::string& s, bool clear)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToDescription(\""<<s<<
- "\") ["<<GetFullTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",9,"BlackBoxDescriptor::AddToDescription(\""
+ <<s<<"\")"<<std::endl);
if (clear) mDescription = s;
else mDescription += s;
}
/// Adds the string to the BlackBox author list
void BlackBoxDescriptor::AddToAuthor( const std::string& s, bool clear)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToAuthor(\""<<s<<"\") ["
- <<GetFullTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",9,"BlackBoxDescriptor::AddToAuthor(\""
+ <<s<<"\")"
+ <<std::endl);
if (clear) mAuthor = s;
else mAuthor += s;
}
/// Adds the string to the BlackBox category list
void BlackBoxDescriptor::AddToCategory( const std::string& s, bool clear)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToCategory(\""<<s<<"\") ["
- <<GetFullTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",9,"BlackBoxDescriptor::AddToCategory(\""
+ <<s<<"\")"
+ <<std::endl);
if (clear) mCategory = s;
else mCategory += s;
mCategory += ";";
const BlackBoxDescriptor::InputDescriptor*
BlackBoxDescriptor::GetInputDescriptor(const std::string & name) const
{
- bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetInputDescriptor('"
- <<name<<"') ["<<GetFullTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",9,"BlackBoxDescriptor::GetInputDescriptor('"
+ <<name<<"')"<<std::endl);
InputDescriptorMapType::const_iterator i;
i = mInput.find(name);
{
bbtkError("input '"<<name<<"' does not exist");
}
- bbtkDebugDecTab("Kernel",9);
+
return i->second;
}
//=========================================================================
const BlackBoxDescriptor::OutputDescriptor*
BlackBoxDescriptor::GetOutputDescriptor(const std::string & name) const
{
- bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetOutputDescriptor('"
- <<name<<"') ["<<GetFullTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",9,"BlackBoxDescriptor::GetOutputDescriptor('"
+ <<name<<"')"<<std::endl);
OutputDescriptorMapType::const_iterator i;
i = mOutput.find(name);
if ( i == mOutput.end() )
{
- bbtkError("output '"<<name<<"' does not exist");
+ bbtkError("output '"<<name<<"' does not exist");
}
- bbtkDebugDecTab("Kernel",9);
+
return i->second;
}
//=========================================================================
//=========================================================================
void BlackBoxDescriptor::GetHelp(bool full) const
{
- bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetHelp() ["<<GetFullTypeName()<<"]"<<std::endl);
-
- bbtkMessage("Help",1,"Black Box <"<<GetFullTypeName()<<">"<<std::endl);
- bbtkMessage("Help",1," " <<GetDescription()<<std::endl);
- bbtkMessage("Help",1," By : " <<GetAuthor() <<std::endl);
- bbtkMessage("Help",1," Categories : " <<GetCategory() <<std::endl);
+ bbtkDDebugMessage("kernel",9,"BlackBoxDescriptor::GetHelp()"
+ <<std::endl);
+
+ bbtkMessage("help",1,"Black Box <"<<GetFullTypeName()<<">"<<std::endl);
+ bbtkMessage("help",1," " <<GetDescription()<<std::endl);
+ bbtkMessage("help",1," By : " <<GetAuthor() <<std::endl);
+ bbtkMessage("help",1," Categories : " <<GetCategory() <<std::endl);
if (mInput.size())
- bbtkMessage("Help",1," * Inputs : "<<std::endl);
+ bbtkMessage("help",1," * Inputs : "<<std::endl);
else
- bbtkMessage("Help",1," * No inputs"<<std::endl);
+ bbtkMessage("help",1," * No inputs"<<std::endl);
InputDescriptorMapType::const_iterator i;
unsigned int namelmax = 0;
unsigned int typelmax = 0;
std::string nature(i->second->GetNature());
nature += "]";
nature.append(1+natlmax-nature.size(),' ');
- bbtkMessage("Help",1,
+ bbtkMessage("help",1,
" '"<<name
<<" <"<<type
<<" ["<<nature
<<" : "<<i->second->GetDescription()<<std::endl);
}
if (mOutput.size())
- bbtkMessage("Help",1," * Outputs : "<<std::endl);
+ bbtkMessage("help",1," * Outputs : "<<std::endl);
else
- bbtkMessage("Help",1," * No outputs"<<std::endl);
+ bbtkMessage("help",1," * No outputs"<<std::endl);
for ( o = mOutput.begin(); o != mOutput.end(); ++o )
{
std::string name(o->second->GetName());
std::string nature(o->second->GetNature());
nature += "]";
nature.append(1+natlmax-nature.size(),' ');
- bbtkMessage("Help",1,
+ bbtkMessage("help",1,
" '"<<name
<<" <"<<type
<<" ["<<nature
<<" : "<<o->second->GetDescription()<<std::endl);
}
- bbtkDebugDecTab("Kernel",9);
-
}
//=========================================================================
const std::string& output_dir,
bool relative_link )
{
- bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::InsertHtmlHelp() ["<<GetFullTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",9,"BlackBoxDescriptor::InsertHtmlHelp()"
+ <<std::endl);
//-------------
// General info
//------------
// End
- bbtkDebugDecTab("Kernel",9);
+
}
//=========================================================================
Program: bbtk
Module: $RCSfile: bbtkBlackBoxInputConnector.cxx,v $
Language: C++
- Date: $Date: 2008/12/11 09:50:35 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.10 $
=========================================================================*/
/* ---------------------------------------------------------------------
BlackBoxInputConnector::BlackBoxInputConnector(BlackBox::Pointer b)
: mBox(b), mConnection(0), mStatus(MODIFIED)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::BlackBoxInputConnector()"<<std::endl);
+ bbtkDebugMessage("kernel",9,
+ "["<<b->bbGetName()
+ <<"] BlackBoxInputConnector()"<<std::endl);
}
//========================================================================
//========================================================================
BlackBoxInputConnector::~BlackBoxInputConnector()
{
- bbtkDebugMessageInc("Kernel",9,"BlackBoxInputConnector::~BlackBoxInputConnector()"<<std::endl);
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugMessage("kernel",9,
+ "[NULL"//<<mBox.lock()->bbGetName()
+ <<"] ~BlackBoxInputConnector()"
+ <<std::endl);
}
//========================================================================
//========================================================================
void BlackBoxInputConnector::SetConnection(Connection* c)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::SetConnection("<<c<<")"<<std::endl);
+ bbtkDebugMessage("kernel",9,
+ "["<<mBox.lock()->bbGetName()
+ <<"] BlackBoxInputConnector::SetConnection("<<c<<")"<<std::endl);
mConnection = c;
}
//========================================================================
//========================================================================
void BlackBoxInputConnector::UnsetConnection(Connection* c)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::UnsetConnection("
+ bbtkDebugMessage("kernel",9,
+ "["<<mBox.lock()->bbGetName()
+ <<"] BlackBoxInputConnector::UnsetConnection("
<<c<<")"<<std::endl);
mConnection = 0;
}
}
else
{
- bbtkDebugMessage("process",5,
- "--> BlackBoxInputConnector::RecursiveExecute() : "
- <<"No connection or input not Out-of-date : nothing to do"
- <<std::endl);
-
+ if (!mBox.expired())
+ bbtkDebugMessage("process",5,"["<<mBox.lock()->bbGetName()
+ <<"] --> BlackBoxInputConnector::RecursiveExecute() : "
+ <<"No connection or input not Out-of-date : nothing to do"
+ <<std::endl);
+ else
+ bbtkDebugMessage("process",5,"[UNKNOWN"
+ <<"] --> BlackBoxInputConnector::RecursiveExecute() : "
+ <<"No connection or input not Out-of-date : nothing to do"
+ <<std::endl);
+
}
}
//========================================================================
Program: bbtk
Module: $RCSfile: bbtkBlackBoxOutputConnector.cxx,v $
Language: C++
- Date: $Date: 2008/12/10 09:33:18 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.12 $
=========================================================================*/
/* ---------------------------------------------------------------------
{
//======================================================================
- BlackBoxOutputConnector::BlackBoxOutputConnector()
- : mStatus(OUTOFDATE)
+ BlackBoxOutputConnector::BlackBoxOutputConnector(BlackBox::Pointer b)
+ : mBox(b),
+ mStatus(OUTOFDATE)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxOutputConnector::BlackBoxOutputConnector()"<<std::endl);
+ bbtkDebugMessage("kernel",9,
+ "["<<b->bbGetName()
+ <<"] BlackBoxOutputConnector()"<<std::endl);
}
//======================================================================
//======================================================================
BlackBoxOutputConnector::~BlackBoxOutputConnector()
{
- bbtkDebugMessage("Kernel",9,
- "==> BlackBoxOutputConnector::~BlackBoxOutputConnector()"
+ bbtkDebugMessage("kernel",9,
+ "[NULL"//<<mBox.lock()->bbGetName()
+ <<"] ==> ~BlackBoxOutputConnector()"
<<std::endl);
/*
ConnectionVector::iterator i;
(*i) = Connection::WeakPointer();
*/
mConnection.clear();
- bbtkDebugMessage("Kernel",9,
- "<== BlackBoxOutputConnector::~BlackBoxOutputConnector()"
+ bbtkDebugMessage("kernel",9,
+ "[NULL"//<<mBox.lock()->bbGetName()
+ <<"] <== ~BlackBoxOutputConnector()"
<<std::endl);
}
//======================================================================
///
void BlackBoxOutputConnector::SetConnection(Connection* c)
{
- bbtkDebugMessage("Kernel",9,"BlackBoxOutputConnector::SetConnection("
+ bbtkDebugMessage("kernel",9,
+ "["<<mBox.lock()->bbGetName()
+ <<"] BlackBoxOutputConnector::SetConnection("
<<c<<")"<<std::endl);
mConnection.push_back(c);
// AddChangeObserver(boost::bind(&Connection::SignalChange,c));
//======================================================================
void BlackBoxOutputConnector::UnsetConnection(Connection* c)
{
- bbtkDebugMessageInc("Kernel",9,"BlackBoxOutputConnector::UnsetConnection("
+ bbtkDebugMessage("kernel",9,"["<<mBox.lock()->bbGetName()
+ <<"] BlackBoxOutputConnector::UnsetConnection("
<<c<<")"<<std::endl);
if (!c)
{
- bbtkInternalError("BlackBoxOutputConnector::UnsetConnection("<<c<<") : invalid connection");
+ bbtkInternalError(mBox.lock()->bbGetFullName()
+ <<": BlackBoxOutputConnector::UnsetConnection("
+ <<c<<") : invalid connection");
}
// c->Check();
}
if (i==mConnection.end())
{
- bbtkInternalError("BlackBoxOutputConnector::UnsetConnection("<<c<<") : connection is absent from connections list");
+ bbtkInternalError(mBox.lock()->bbGetFullName()
+ <<": BlackBoxOutputConnector::UnsetConnection("
+ <<c
+ <<") : connection is absent from connections list");
}
mConnection.erase(i);
// RemoveChangeObserver(boost::bind(&Connection::SignalChange,c));
- bbtkDebugDecTab("Kernel",9);
+
}
//======================================================================
//if (s==UPTODATE) s=MODIFIED;
bbtkDebugMessage("change",2,
- "==> BlackBoxOutputConnector::SignalChange("
- <<box->bbGetFullName()<<",'"
+ "["<<box->bbGetName()
+ <<"] ==> BlackBoxOutputConnector::SignalChange('"
<<output<<"','"<<GetIOStatusString(s)<<"') ["
<<this<<"]"
<<std::endl);
// std::cout<<"BlackBoxOutputConnector::SignalChange("
- // <<box->bbGetFullName()<<",'"
+ // <<box->bbGetName()<<",'"
// <<output<<"')"<<std::endl;
mChangeSignal(box,output,s);
bbtkDebugMessage("change",2,
- "<== BlackBoxOutputConnector::SignalChange("
- <<box->bbGetFullName()<<",'"
+ "["<<box->bbGetName()
+ <<"] <== BlackBoxOutputConnector::SignalChange('"
<<output<<"','"<<GetIOStatusString(s)<<"') ["
<<this<<"]"
<<std::endl);
Program: bbtk
Module: $RCSfile: bbtkBlackBoxOutputConnector.h,v $
Language: C++
- Date: $Date: 2008/12/15 09:04:46 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.9 $
=========================================================================*/
/* ---------------------------------------------------------------------
typedef BlackBox::OutputChangeCallbackType OutputChangeCallbackType;
- BlackBoxOutputConnector();
+ BlackBoxOutputConnector(BlackBoxPointer b);
~BlackBoxOutputConnector();
void SetConnection(Connection* c);
private:
+ ///
+ BlackBoxWeakPointer mBox;
/// The vector of output connections
ConnectionVector mConnection;
/// The status of the output
Program: bbtk
Module: $RCSfile: bbtkComplexBlackBox.cxx,v $
Language: C++
- Date: $Date: 2009/05/25 12:48:57 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.27 $
=========================================================================*/
/* ---------------------------------------------------------------------
mLockedDescriptor(desc),
mDescriptor(desc)
{
- bbtkDebugMessage("object",3,
- "##> ComplexBlackBox::ComplexBlackBox(\""
+ bbtkBlackBoxDebugMessage("object",3,
+ "##> ComplexBlackBox(\""
<<name<<"\")"<<std::endl);
bbAllocateConnectors();
- bbtkDebugMessage("object",3,
- "<## ComplexBlackBox::ComplexBlackBox(\""
+ bbtkBlackBoxDebugMessage("object",3,
+ "<## ComplexBlackBox(\""
<<name<<"\")"<<std::endl);
}
//=======================================================================
mDescriptor(from.mDescriptor),
mExecutionList(from.mExecutionList)
{
- bbtkDebugMessage("object",3,
- "##> ComplexBlackBox::ComplexBlackBox(\""
+ bbtkBlackBoxDebugMessage("object",3,
+ "##> ComplexBlackBox(\""
<<from.bbGetName()<<"\",\""
<<name<<"\")"<<std::endl);
- bbtkDebugMessage("object",4," * Cloning Black Boxes"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",4," * Cloning Black Boxes"<<std::endl);
// We have to make the shared_ptr on this because it is used
// in bbUnsafeAddBlackBox !
BlackBoxMapType::const_iterator i;
for ( i = from.mBlackBoxMap.begin(); i != from.mBlackBoxMap.end(); ++i )
{
- bbtkDebugMessageInc("object",5," * Cloning \""<<i->first<<"\""<<std::endl);
+ bbtkBlackBoxDebugMessage("object",5," * Cloning \""<<i->first<<"\""<<std::endl);
BlackBox::Pointer B = i->second->bbClone(i->second->bbGetName());
bbUnsafeAddBlackBox(B);
}
- bbtkDebugMessage("object",4," * Cloning Connections"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",4," * Cloning Connections"<<std::endl);
ConnectionListType::const_iterator j;
for ( j = from.mConnectionList.begin(); j != from.mConnectionList.end(); ++j )
{
- bbtkDebugMessage("object",5," * Cloning \""<<
+ bbtkBlackBoxDebugMessage("object",5," * Cloning \""<<
(*j)->GetFullName()<<"\""<<std::endl);
BlackBox::Pointer bbfrom = bbGetBlackBox( (*j)->GetOriginalBlackBoxFrom()->bbGetName() );
}
bbAllocateConnectors();
- bbtkDebugMessage("object",3,
- "<## ComplexBlackBox::ComplexBlackBox(\""
+ bbtkBlackBoxDebugMessage("object",3,
+ "<## ComplexBlackBox(\""
<<from.bbGetName()<<"\",\""
<<name<<"\")"<<std::endl);
}
/// Destructor
ComplexBlackBox::~ComplexBlackBox()
{
- bbtkDebugMessage("object",3,
- "==> ComplexBlackBox::~ComplexBlackBox() ["
- <<bbGetName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",3,
+ "==> ~ComplexBlackBox()"
+ <<std::endl);
Clear();
this->bbDesallocateConnectors();
- bbtkDebugMessage("object",3,
- "<== ComplexBlackBox::~ComplexBlackBox() ["
- <<bbGetName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",3,
+ "<== ~ComplexBlackBox()"
+ <<std::endl);
}
//=======================================================================
/// Clear
void ComplexBlackBox::Clear()
{
- bbtkDebugMessage("object",3,
- "==> ComplexBlackBox::Clear() ["
- <<bbGetName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",3,
+ "==> ComplexBlackBox::Clear()"
+ <<std::endl);
- bbtkDebugMessage("object",4,
+ bbtkBlackBoxDebugMessage("object",4,
" -> Releasing connections"<<std::endl);
mConnectionList.clear();
- bbtkDebugMessage("object",4,
+ bbtkBlackBoxDebugMessage("object",4,
" -> Releasing boxes"<<std::endl);
mBlackBoxMap.clear();
- bbtkDebugMessage("object",3,
- "<== ComplexBlackBox::Clear() ["
- <<bbGetName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("object",3,
+ "<== ComplexBlackBox::Clear()"
+ <<std::endl);
}
//=======================================================================
/// Allocates the i/o connectors of the black box
void ComplexBlackBox::bbAllocateConnectors()
{
- bbtkDebugMessageInc("Kernel",8,
- "ComplexBlackBox::bbAllocateConnectors() ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("kernel",8,
+ "==> ComplexBlackBox::bbAllocateConnectors()"
<<std::endl);
// Input connectors
BlackBoxDescriptor::InputDescriptorMapType::const_iterator i;
for ( i = imap.begin(); i != imap.end(); ++i )
{
- bbtkDebugMessage("Kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl);
// Redirect the connector to the internal box connector
// Cast the BBInputDescriptor into a ComplexBBInputDescriptor
ComplexBlackBoxInputDescriptor* d =
BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o;
for ( o = omap.begin(); o != omap.end(); ++o )
{
- bbtkDebugMessage("Kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl);
// Redirect the connector to the internal box connector
// Cast the BBOutputDescriptor into a ComplexBBOutputDescriptor
ComplexBlackBoxOutputDescriptor* d =
bbGetOutputConnectorMap()[o->second->GetName()] = c;
}
-
- bbtkDebugDecTab("Kernel",8);
- }
+ bbtkBlackBoxDebugMessage("kernel",8,
+ "<== ComplexBlackBox::bbAllocateConnectors()"
+ <<std::endl);
+ }
//=========================================================================
/// Desallocates the i/o connectors of the black box
void ComplexBlackBox::bbDesallocateConnectors()
{
- bbtkDebugMessageInc("Kernel",8,
- "ComplexBlackBox::DesallocateConnectors()"
+ bbtkBlackBoxDebugMessage("kernel",8,
+ "==> ComplexBlackBox::DesallocateConnectors()"
<<std::endl);
// The connectors have not been allocated by the complex box
// BlackBox::bbDesallocateConnectors delete the connectors
bbGetInputConnectorMap().clear();
bbGetOutputConnectorMap().clear();
-
- bbtkDebugDecTab("Kernel",8);
+
+ bbtkBlackBoxDebugMessage("kernel",8,
+ "<== ComplexBlackBox::DesallocateConnectors()"
+ <<std::endl);
+
}
//=========================================================================
//=======================================================================
BlackBox::Pointer ComplexBlackBox::bbClone(const std::string& name)
{
- bbtkDebugMessageInc("Kernel",9,
- "ComplexBlackBox::bbClone(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",9,
+ "==> ComplexBlackBox::bbClone(\""<<name<<"\")"
+ <<std::endl);
ComplexBlackBox* CBB = new ComplexBlackBox(*this,name);
- return MakeBlackBoxPointer(CBB);
+ bbtkBlackBoxDebugMessage("kernel",9,
+ "<== ComplexBlackBox::bbClone(\""<<name<<"\")"
+ <<std::endl);
+ return MakeBlackBoxPointer(CBB);
}
//=======================================================================
/// Executes the box so that its outputs are up-to-date on exit
void ComplexBlackBox::bbExecute(bool force)
{
- bbtkDebugMessageInc("process",2,
- "=> ComplexBlackBox::bbExecute() ["
- <<bbGetFullName()<<"]"<<std::endl);
-
-
+ bbtkBlackBoxDebugMessage("process",2,
+ "**> ComplexBlackBox::bbExecute()"
+ <<std::endl);
+
+
Wx::BusyCursor wait;
if (mExecutionList.size() != 0)
i!=mExecutionList.end();
++i)
{
- bbtkDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl);
+ bbtkBlackBoxDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl);
mBlackBoxMap[*i]->bbExecute(force);
}
}
i->second->bbExecute(force);
}
}
-
+ bbtkBlackBoxDebugMessage("process",2,
+ "<** ComplexBlackBox::bbExecute()"
+ <<std::endl);
+
}
//==================================================================
//==================================================================
void ComplexBlackBox::bbAddToExecutionList( const std::string& name )
{
- bbtkDebugMessageInc("Kernel",9,
+ bbtkBlackBoxDebugMessage("kernel",9,
"ComplexBlackBox::bbAddToExecutionList(\""
- <<name<<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ <<name<<"\")"
+ <<std::endl);
mExecutionList.push_back( name );
- bbtkDebugDecTab("Kernel",9);
}
//==================================================================
//==================================================================
Data ComplexBlackBox::bbGetOutput( const std::string &name )
{
- bbtkDebugMessageInc("Data",7,
- "ComplexBlackBox::bbGetOutput(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("data",7,
+ "ComplexBlackBox::bbGetOutput(\""<<name<<"\")"
+ <<std::endl);
ComplexBlackBoxOutputDescriptor* d =
(ComplexBlackBoxOutputDescriptor*)
Data p = bbGetBlackBox(d->GetTarget())->bbGetOutput(d->GetOutput());
-
- bbtkDebugDecTab("Data",7);
return p;
}
//==================================================================
/// Gets the input Data of a given name
Data ComplexBlackBox::bbGetInput( const std::string &name )
{
- bbtkDebugMessageInc("Data",7,
- "ComplexBlackBox::bbGetInput(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("data",7,
+ "ComplexBlackBox::bbGetInput(\""<<name<<"\")"
+ <<std::endl);
ComplexBlackBoxInputDescriptor* d =
(ComplexBlackBoxInputDescriptor*)
Data p = bbGetBlackBox(d->GetTarget())->bbGetInput(d->GetInput());
- bbtkDebugDecTab("Data",7);
return p;
}
//==================================================================
/// Sets the data of the output called <name>
void ComplexBlackBox::bbSetOutput( const std::string &name, Data data)
{
- bbtkDebugMessageInc("Data",7,
- "ComplexBlackBox::bbSetOutput(\""<<name<<"\",data) ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("data",7,
+ "ComplexBlackBox::bbSetOutput(\""<<name<<"\",data)"
+ <<std::endl);
ComplexBlackBoxOutputDescriptor* d =
(ComplexBlackBoxOutputDescriptor*)
bbGetBlackBox(d->GetTarget())->bbSetOutput(d->GetOutput(),data);
- bbtkDebugDecTab("Data",7);
}
//==================================================================
void ComplexBlackBox::bbSetInput( const std::string &name, Data data,
bool setModified)
{
- bbtkDebugMessageInc("Data",7,
- "ComplexBlackBox::bbSetInput(\""<<name<<"\",data) ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("data",7,
+ "ComplexBlackBox::bbSetInput(\""<<name<<"\",data)"
+ <<std::endl);
ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
bbGetDescriptor()->GetInputDescriptor(name);
bbGetBlackBox(d->GetTarget())->bbSetInput(d->GetInput(),data,setModified);
- bbtkDebugDecTab("Data",7);
}
//==================================================================
void* data,
bool setModified)
{
- bbtkDebugMessageInc("Data",7,
+ bbtkBlackBoxDebugMessage("data",7,
"ComplexBlackBox::bbBruteForceSetInputPointer('"
- <<name<<"',"<<data<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ <<name<<"',"<<data<<")"
+ <<std::endl);
ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
bbGetDescriptor()->GetInputDescriptor(name);
data,
setModified);
- bbtkDebugDecTab("Data",7);
}
//==================================================================
/// Connects the input <name> to the connection c
void ComplexBlackBox::bbConnectInput( const std::string& name, Connection* c)
{
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"==> ComplexBlackBox::bbConnectInput(\""
- <<name<<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<name<<"\","<<c->GetFullName()<<")"
<<std::endl);
ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
BlackBox::Pointer t = bbGetBlackBox(d->GetTarget());
- bbtkDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
c->SetBlackBoxTo(t);
c->SetBlackBoxToInput(d->GetInput());
- bbtkDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
t->bbConnectInput(d->GetInput(),c);
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"<== ComplexBlackBox::bbConnectInput(\""
- <<name<<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"
+ <<name<<"\","<<c->GetFullName()<<")"
<<std::endl);
}
//=========================================================================
/// Connects the output <name> to the connection c
void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection* c)
{
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"==> ComplexBlackBox::bbConnectOutput(\""
- <<name<<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ <<name<<"\","<<c->GetFullName()<<")"
+ <<std::endl);
ComplexBlackBoxOutputDescriptor* d = (ComplexBlackBoxOutputDescriptor*)
bbGetDescriptor()->GetOutputDescriptor(name);
BlackBox::Pointer t = bbGetBlackBox(d->GetTarget());
- bbtkDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
c->SetBlackBoxFrom(t);
c->SetBlackBoxFromOutput(d->GetOutput());
- bbtkDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
+ bbtkBlackBoxDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
t->bbConnectOutput(d->GetOutput(),c);
- bbtkDebugMessage("connection",2,
+ bbtkBlackBoxDebugMessage("connection",2,
"<== ComplexBlackBox::bbConnectOutput(\""
- <<name<<"\","<<c->GetFullName()<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ <<name<<"\","<<c->GetFullName()<<")"
+ <<std::endl);
}
//=========================================================================
/// Adds the black box to the complex box
void ComplexBlackBox::bbAddBlackBox( BlackBox::Pointer b)
{
- bbtkDebugMessageInc("Kernel",7,
- "ComplexBlackBox::AddBlackBox(\""<<b->bbGetName()
- <<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",7,
+ "ComplexBlackBox::AddBlackBox(\""<<b->bbGetName()
+ <<"\")"
+ <<std::endl);
if ( bbUnsafeGetBlackBox(b->bbGetName()) )
{
b->bbSetParent(GetThisPointer<ComplexBlackBox>());
mBlackBoxMap[b->bbGetName()] = b;
- bbtkDebugDecTab("Kernel",7);
}
//==================================================================
/// Adds the black box to the complex box (unsafe)
void ComplexBlackBox::bbUnsafeAddBlackBox( BlackBox::Pointer b)
{
- bbtkDebugMessageInc("Kernel",7,
+ bbtkBlackBoxDebugMessage("kernel",7,
"ComplexBlackBox::UnsafeAddBlackBox(\""<<b->bbGetName()
- <<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ <<"\")"
+ <<std::endl);
b->bbSetParent(GetThisPointer<ComplexBlackBox>());
mBlackBoxMap[b->bbGetName()] = b;
- bbtkDebugDecTab("Kernel",7);
}
//==================================================================
void ComplexBlackBox::bbRemoveBlackBox( const std::string& name,
bool remove_connections )
{
- bbtkDebugMessageInc("Kernel",7,
- "ComplexBlackBox::RemoveBlackBox(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",7,
+ "ComplexBlackBox::RemoveBlackBox(\""<<name<<"\")"
+ <<std::endl);
BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
if ( i == mBlackBoxMap.end() )
// Unload orphan dl packages
Package::UnLoadReleasedDynamicallyLoadedPackages();
- bbtkDebugDecTab("Kernel",7);
}
//==================================================================
/// Adds the connection to the complex box
void ComplexBlackBox::bbAddConnection( Connection::Pointer c)
{
- bbtkDebugMessageInc("Kernel",7,
- "ComplexBlackBox::AddConnection(\""<<"..."<<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",7,
+ "ComplexBlackBox::AddConnection(\""<<"..."<<"\")"
+ <<std::endl);
mConnectionList.push_back(c);
- bbtkDebugDecTab("Kernel",7);
}
//==================================================================
// void RemoveConnection( );
/// Returns the black box with name <name>
BlackBox::Pointer ComplexBlackBox::bbGetBlackBox( const std::string& name )
{
- bbtkDebugMessageInc("Kernel",9,
- "ComplexBlackBox::GetBlackBox(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("kernel",9,
+ "ComplexBlackBox::GetBlackBox(\""<<name<<"\")"
+ <<std::endl);
BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
if ( i == mBlackBoxMap.end() )
bbtkError("the black box \""<<name<<"\" does not exist");
}
- bbtkDebugDecTab("Kernel",9);
return i->second;
}
//==================================================================
/// if it does not exist but return a null pointer
BlackBox::Pointer ComplexBlackBox::bbUnsafeGetBlackBox( const std::string& name )
{
- bbtkDebugMessageInc("Kernel",9,
- "ComplexBlackBox::UnsafeGetBlackBox(\""<<name<<"\") ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("kernel",9,
+ "ComplexBlackBox::UnsafeGetBlackBox(\""<<name<<"\")"
<<std::endl);
BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
if ( i == mBlackBoxMap.end() )
{
- bbtkDebugDecTab("Kernel",9);
return BlackBox::Pointer();
}
- bbtkDebugDecTab("Kernel",9);
return i->second;
}
//==================================================================
void ComplexBlackBox::bbPrintBlackBoxes()
{
- bbtkDebugMessageInc("Kernel",9,
- "ComplexBlackBox::PrintBlackBoxes() ["
- <<bbGetFullName()<<"]"
+ bbtkBlackBoxDebugMessage("kernel",9,
+ "ComplexBlackBox::PrintBlackBoxes()"
<<std::endl);
BlackBoxMapType::iterator i;
for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i )
{
- bbtkMessage("Help",1,i->second->bbGetFullName()<<std::endl);
+ bbtkMessage("help",1,i->second->bbGetFullName()<<std::endl);
}
- bbtkDebugDecTab("Kernel",9);
}
//==================================================================
Program: bbtk
Module: $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $
Language: C++
- Date: $Date: 2009/03/30 15:22:51 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.20 $
=========================================================================*/
/* ---------------------------------------------------------------------
#include "bbtkMessageManager.h"
#include "bbtkUtilities.h"
+#define bbtkDMessage(key,level,mess) \
+ bbtkMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
+#define bbtkDDebugMessage(key,level,mess) \
+ bbtkDebugMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
+
namespace bbtk
{
//=======================================================================
/// Default ctor
ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(const std::string& name)
{
- bbtkDebugMessage("object",2,"==> ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
+ bbtkDDebugMessage("object",2,"==> ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
SetTypeName(name);
AddToCategory("complex box");
mPrototype = ComplexBlackBox::New(name+std::string("Prototype"),
MakePointer(this,true));
mPrototype->SetAsPrototype();
- bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
+ bbtkDDebugMessage("object",2,"<== ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
}
//=======================================================================
/// Default dtor
ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor()
{
- bbtkDebugMessage("object",2,"==> ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<<GetTypeName()<<"\")"<<std::endl);
- // mPrototype->Delete();
+ bbtkDDebugMessage("object",2,"==> ~ComplexBlackBoxDescriptor()"<<std::endl);
mPrototype.reset();
- bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<<GetTypeName()<<"\")"<<std::endl);
+ bbtkDDebugMessage("object",2,"<== ~ComplexBlackBoxDescriptor()"<<std::endl);
}
//=======================================================================
BlackBox::Pointer
ComplexBlackBoxDescriptor::NewBlackBox(const std::string& name)
{
- bbtkDebugMessageInc("Kernel",5,
- "ComplexBlackBoxDescriptor::NewBlackBox(\""
- <<name<<"\") ["
- <<GetTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",5,
+ "ComplexBlackBoxDescriptor::NewBlackBox(\""
+ <<name<<"\")"
+ <<std::endl);
return mPrototype->bbClone(name);
- bbtkDebugDecTab("Kernel",5);
+
}
//=======================================================================
const std::string& name
)
{
- bbtkDebugMessageInc("Kernel",5,
+ bbtkDDebugMessage("kernel",5,
"ComplexBlackBoxDescriptor::Add(\""
- <<type<<"\",\""<<name<<"\") ["
- <<GetTypeName()<<"]"<<std::endl);
+ <<type<<"\",\""<<name<<"\")"
+ <<std::endl);
//
if (!GetFactory())
// ok : create new one
mPrototype->bbAddBlackBox ( GetFactory()->NewBlackBox(type,name) );
- bbtkDebugDecTab("Kernel",5);
+
}
//=======================================================================
/// Adds a black box to the execution list
void ComplexBlackBoxDescriptor::AddToExecutionList ( const std::string& box)
{
- bbtkDebugMessageInc("Kernel",5,
- "ComplexBlackBoxDescriptor::AddToExecutionList(\""
- <<box<<"\" ["
- <<GetTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",5,
+ "ComplexBlackBoxDescriptor::AddToExecutionList(\""
+ <<box<<"\""
+ <<std::endl);
// Verify that the box exists
BlackBox::Pointer b = mPrototype->bbUnsafeGetBlackBox( box );
if ( !b )
// ok
mPrototype->bbAddToExecutionList ( box );
- bbtkDebugDecTab("Kernel",5);
+
}
const std::string& input
)
{
- bbtkDebugMessageInc("Kernel",5,
+ bbtkDDebugMessage("kernel",5,
"ComplexBlackBoxDescriptor::Connect(\""
<<from<<"\",\""<<output<<"\",\""
<<to<<"\",\""<<input
- <<"\") ["
- <<GetTypeName()<<"]"<<std::endl);
+ <<"\")"
+ <<std::endl);
//
if (!GetFactory())
{
mPrototype->bbAddConnection(c);
- bbtkDebugDecTab("Kernel",5);
+
}
//=======================================================================
const std::string& input,
const std::string& help)
{
- bbtkDebugMessageInc("Kernel",5,
+ bbtkDDebugMessage("kernel",5,
"ComplexBlackBoxDescriptor::DefineInput(\""
<<name<<"\",\""<<box<<"\",\""
<<input<<"\",\""<<help
- <<"\") ["
- <<GetTypeName()<<"]"<<std::endl);
+ <<"\")"
+ <<std::endl);
BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
if ( !bb )
d->GetTypeInfo()));
- bbtkDebugDecTab("Kernel",5);
+
}
//=======================================================================
const std::string& output,
const std::string& help)
{
- bbtkDebugMessageInc("Kernel",5,
+ bbtkDDebugMessage("kernel",5,
"ComplexBlackBoxDescriptor::DefineOutput(\""
<<name<<"\",\""<<box<<"\",\""
<<output<<"\",\""<<help
- <<"\") ["
- <<GetTypeName()<<"]"<<std::endl);
+ <<"\")"
+ <<std::endl);
BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
if ( !bb )
d->GetTypeInfo()));
- bbtkDebugDecTab("Kernel",5);
+
}
//=======================================================================
int detail, int level,
const std::string& output_dir, bool relative_link)
{
- bbtkDebugMessageInc("Kernel",9,
- "ComplexBlackBoxDescriptor::InsertHtmlHelp() ["
- <<GetTypeName()<<"]"<<std::endl);
+ bbtkDDebugMessage("kernel",9,
+ "ComplexBlackBoxDescriptor::InsertHtmlHelp()"
+ <<std::endl);
//-------------
// General info
//------------
// End
- bbtkDebugDecTab("Kernel",9);
+
}
//=========================================================================
//=======================================================================
void ComplexBlackBoxDescriptor::GetHelp(bool full) const
{
- if (full) bbtkMessage("Help",1,"Complex Black Box <"<<
+ if (full) bbtkMessage("help",1,"Complex Black Box <"<<
GetPackage()->GetName()<<"::"
<<GetTypeName()<<">"<<std::endl);
- bbtkMessage("Help",1," " << GetDescription() <<std::endl);
- bbtkMessage("Help",1," By : " << GetAuthor() <<std::endl);
- bbtkMessage("Help",1," Category(s) : " << GetCategory() <<std::endl);
+ bbtkMessage("help",1," " << GetDescription() <<std::endl);
+ bbtkMessage("help",1," By : " << GetAuthor() <<std::endl);
+ bbtkMessage("help",1," Category(s) : " << GetCategory() <<std::endl);
if (mInput.size())
- bbtkMessage("Help",1," * Inputs : "<<std::endl);
+ bbtkMessage("help",1," * Inputs : "<<std::endl);
else
- bbtkMessage("Help",1," * No inputs"<<std::endl);
+ bbtkMessage("help",1," * No inputs"<<std::endl);
InputDescriptorMapType::const_iterator i;
unsigned int namelmax = 0;
unsigned int typelmax = 0;
std::string nature(i->second->GetNature());
nature += "]";
nature.append(1+natlmax-nature.size(),' ');
- bbtkMessage("Help",1,
+ bbtkMessage("help",1,
" '"<<name
<<" <"<<type
<<" ["<<nature
if (full)
{
if (mOutput.size())
- bbtkMessage("Help",1," * Outputs : "<<std::endl);
+ bbtkMessage("help",1," * Outputs : "<<std::endl);
else
- bbtkMessage("Help",1," * No outputs"<<std::endl);
+ bbtkMessage("help",1," * No outputs"<<std::endl);
for ( o = mOutput.begin(); o != mOutput.end(); ++o )
{
std::string name(o->second->GetName());
std::string nature(o->second->GetNature());
nature += "]";
nature.append(1+natlmax-nature.size(),' ');
- bbtkMessage("Help",1,
+ bbtkMessage("help",1,
" '"<<name
<<" <"<<type
<<" ["<<nature
const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
if (B.size())
- bbtkMessage("Help",1," * Boxes : "<<std::endl);
+ bbtkMessage("help",1," * Boxes : "<<std::endl);
else
- bbtkMessage("Help",1," * No boxes"<<std::endl);
+ bbtkMessage("help",1," * No boxes"<<std::endl);
ComplexBlackBox::BlackBoxMapType::const_iterator b;
for ( b = B.begin(); b != B.end(); ++b )
{
- bbtkMessage("Help",1," '"<<b->second->bbGetName()<<
+ bbtkMessage("help",1," '"<<b->second->bbGetName()<<
"' <"
<< b->second->bbGetDescriptor()->GetPackage()->GetName()
<<"::"
Program: bbtk
Module: $RCSfile: bbtkComplexBlackBoxInputDescriptor.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:12 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.6 $
=========================================================================*/
/* ---------------------------------------------------------------------
mType(type)
{
- bbtkDebugMessage("Kernel",9,"ComplexBlackBoxInputDescriptor::ComplexBlackBoxInputDescriptor(\""<<name<<"\",\""<<description<<"\",\""<<target<<"\",\""<<input<<"\")"<<std::endl);
+ bbtkDebugMessage("kernel",9,"ComplexBlackBoxInputDescriptor(\""<<name<<"\",\""<<description<<"\",\""<<target<<"\",\""<<input<<"\")"<<std::endl);
}
ComplexBlackBoxInputDescriptor::~ComplexBlackBoxInputDescriptor()
{
- bbtkDebugMessage("Kernel",9,"ComplexBlackBoxInputDescriptor::~ComplexBlackBoxInputDescriptor(\""<<GetName()<<"\",\""<<GetDescription()<<"\",\""<<GetTarget()<<"\",\""<<GetInput()<<"\")"<<std::endl);
+ bbtkDebugMessage("kernel",9,"~ComplexBlackBoxInputDescriptor(\""
+ <<GetName()<<"\")"<<std::endl);
}
}
Program: bbtk
Module: $RCSfile: bbtkComplexBlackBoxOutputDescriptor.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:12 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.6 $
=========================================================================*/
/* ---------------------------------------------------------------------
mType(type)
{
- bbtkDebugMessage("Kernel",9,"ComplexBlackBoxOutputDescriptor::ComplexBlackBoxOutputDescriptor(\""<<name<<"\",\""<<description<<"\",\""<<target<<"\",\""<<output<<"\")"<<std::endl);
+ bbtkDebugMessage("kernel",9,"ComplexBlackBoxOutputDescriptor(\""<<name<<"\",\""<<description<<"\",\""<<target<<"\",\""<<output<<"\")"<<std::endl);
}
ComplexBlackBoxOutputDescriptor::~ComplexBlackBoxOutputDescriptor()
{
- bbtkDebugMessage("Kernel",9,"ComplexBlackBoxOutputDescriptor::~ComplexBlackBoxOutputDescriptor(\""<<GetName()<<"\",\""<<GetDescription()<<"\",\""<<GetTarget()<<"\",\""<<GetOutput()<<"\")"<<std::endl);
+ bbtkDebugMessage("kernel",9,"~ComplexBlackBoxOutputDescriptor(\""
+ <<GetName()<<"\")"<<std::endl);
}
}
Program: bbtk
Module: $RCSfile: bbtkConnection.cxx,v $
Language: C++
- Date: $Date: 2009/03/30 14:42:16 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.21 $
=========================================================================*/
/* ---------------------------------------------------------------------
#include "bbtkMessageManager.h"
#include "bbtkBlackBoxOutputConnector.h"
+#define bbtkCMessage(key,level,mess) \
+ bbtkMessage(key,level,"["<<GetFullName()<<"] "<<mess)
+#define bbtkCDebugMessage(key,level,mess) \
+ bbtkDebugMessage(key,level,"["<<GetFullName()<<"] "<<mess)
+
namespace bbtk
{
const std::string IOSTATUS_STRING[3] =
const std::string& input ,
const Factory::Pointer f )
{
- bbtkDebugMessage("object",1,"##> Connection::Connection(\""
+ bbtkDebugMessage("object",1,"##> Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
Connection::Pointer p =
MakePointer(new Connection(from,output,to,input,f));
- bbtkDebugMessage("object",1,"<## Connection::Connection(\""
+ bbtkDebugMessage("object",1,"<## Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
mFromAny(false),
mToAny(false)
{
- bbtkDebugMessage("object",2,"==> Connection::Connection(\""
+ bbtkDebugMessage("object",2,"==> Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
- bbtkDebugMessage("connection",1,"==> Connection::Connection(\""
- <<from->bbGetFullName()<<"\",\""<<output<<"\",\""
- <<to->bbGetFullName()<<"\",\""<<input<<"\")"
+ bbtkDebugMessage("connection",1,"==> Connection(\""
+ <<from->bbGetName()<<"\",\""<<output<<"\",\""
+ <<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
}
else if ( to->bbGetInputType(input) == typeid(Data) )
{
- bbtkDebugMessage("Kernel",8," -> '"<<input<<"' type is "
+ bbtkDebugMessage("kernel",8," -> '"<<input<<"' type is "
<<TypeName<Data>()<<" : can receive any data"
<<std::endl);
mToAny = true;
from->bbGetOutputConnector(output).AddChangeObserver(boost::bind(&bbtk::Connection::OnOutputChange,this, _1, _2, _3));
- bbtkDebugMessage("connection",1,"<== Connection::Connection(\""
- <<from->bbGetFullName()<<"\",\""<<output<<"\",\""
- <<to->bbGetFullName()<<"\",\""<<input<<"\")"
+ bbtkDebugMessage("connection",1,"<== Connection(\""
+ <<from->bbGetName()<<"\",\""<<output<<"\",\""
+ <<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
- bbtkDebugMessage("object",2,"==> Connection::Connection(\""
+ bbtkDebugMessage("object",2,"<== Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
BlackBox::Pointer to,
const std::string& input )
{
- bbtkDebugMessage("object",1,"##> Connection::Connection(\""
+ bbtkDebugMessage("object",1,"##> Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
Connection::Pointer p =
MakePointer(new Connection(from,output,to,input));
- bbtkDebugMessage("object",1,"<## Connection::Connection(\""
+ bbtkDebugMessage("object",1,"<## Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
mFromAny(false),
mToAny(false)
{
- bbtkDebugMessage("object",2,"==> Connection::Connection(\""
+ bbtkDebugMessage("object",2,"==> Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
- bbtkDebugMessage("connection",1,"==> Connection::Connection(\""
- <<from->bbGetFullName()<<"\",\""<<output<<"\",\""
- <<to->bbGetFullName()<<"\",\""<<input<<"\")"
+ bbtkDebugMessage("connection",1,"==> Connection(\""
+ <<from->bbGetName()<<"\",\""<<output<<"\",\""
+ <<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
}
else if ( to->bbGetInputType(input) == typeid(Data) )
{
- bbtkDebugMessage("Kernel",8," -> '"<<input<<"' type is "
+ bbtkDebugMessage("kernel",8," -> '"<<input<<"' type is "
<<TypeName<Data>()<<" : can receive any data"
<<std::endl);
mToAny = true;
from->bbGetOutputConnector(output).AddChangeObserver(boost::bind(&bbtk::Connection::OnOutputChange,this, _1, _2, _3));
- bbtkDebugMessage("connection",1,"<== Connection::Connection(\""
- <<from->bbGetFullName()<<"\",\""<<output<<"\",\""
- <<to->bbGetFullName()<<"\",\""<<input<<"\")"
+ bbtkDebugMessage("connection",1,"<== Connection(\""
+ <<from->bbGetName()<<"\",\""<<output<<"\",\""
+ <<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
- bbtkDebugMessage("object",2,"==> Connection::Connection(\""
+ bbtkDebugMessage("object",2,"==> Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
/// Dtor
Connection::~Connection()
{
- bbtkDebugMessage("object",2,
- "==> Connection::~Connection() ["
- <<GetFullName()<<"]"<<std::endl);
+ bbtkCDebugMessage("object",4,
+ "==> ~Connection()"
+ <<std::endl);
if (mAdaptor) mAdaptor.reset();
if (mFrom!=0)
}
else
{
- bbtkInternalError("Connection::~Connection() : invalid initial box pointer");
+ bbtkInternalError("~Connection() : invalid initial box pointer");
}
if (mTo!=0)
{
}
else
{
- bbtkInternalError("Connection::~Connection() : invalid final box pointer");
+ bbtkInternalError("~Connection() : invalid final box pointer");
}
- bbtkDebugMessage("object",2,
- "<== Connection::~Connection() ["
- <<GetFullName()<<"]"<<std::endl);
+ bbtkCDebugMessage("object",4,
+ "<== ~Connection()"
+ <<std::endl);
}
//==================================================================
/// Recursive execution
void Connection::RecursiveExecute()
{
- bbtkDebugMessage("process",4,
- "===> Connection::RecursiveExecute() ["
- <<GetFullName()<<"]"<<std::endl);
+ bbtkCDebugMessage("process",4,
+ "===> Connection::RecursiveExecute()"
+ <<std::endl);
/*
// If box from already executing : nothing to do
}
mTo->bbGetInputConnector(mInput).SetStatus(s);
- bbtkDebugMessage("process",4,
+ bbtkCDebugMessage("process",4,
" --> '"<<mTo->bbGetName()<<"."<<mInput
<<" ["<<&mTo->bbGetInputConnector(mInput)<<"] "
<<"' new status '"
<<"'"
<< std::endl);
- bbtkDebugMessage("process",4,
- "<=== Connection::RecursiveExecute() ["
- <<GetFullName()<<"]"<<std::endl);
+ bbtkCDebugMessage("process",4,
+ "<=== Connection::RecursiveExecute()"
+ <<std::endl);
return;
}
//==================================================================
/// doing necessary conversions (adaptation or pointer cast)
void Connection::TransferData()
{
- bbtkDebugMessageInc("data",3,
- "Connection::TransferData() ["
- <<GetFullName()<<"]"<<std::endl);
+ bbtkCDebugMessage("data",3,
+ "Connection::TransferData()"
+ <<std::endl);
// If an adaptor was created we need to adapt the data
// If no adaptor but source type is an any and target is not an any
else if ( mFromAny && (! mToAny) )
{
- bbtkDebugMessage("data",3,
+ bbtkCDebugMessage("data",3,
" * Source type is an "
<<HumanTypeName<Data>()
<<" which contains a <"
<<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
<<">"<<std::endl);
- bbtkDebugMessage("data",3,
+ bbtkCDebugMessage("data",3,
" * Target type is <"
<<HumanTypeName(mTo->bbGetInputType(mInput))
<<">"<<std::endl);
// 0) If from any contents void : nothing to do
if (mFrom->bbGetOutput(mOutput).type() == typeid(void))
{
- bbtkDebugMessage("data",3,
+ bbtkCDebugMessage("data",3,
" -> Source is void : nothing to transfer!"<<std::endl);
}
// 1) Test strict type matching between any content and target
else if (mFrom->bbGetOutput(mOutput)
.contains( mTo->bbGetInputType(mInput) ) )
{
- bbtkDebugMessage("data",3,
+ bbtkCDebugMessage("data",3,
" -> Equal types : transfer ok"<<std::endl);
mTo->bbSetInput( mInput,
mFrom->bbGetOutput(mOutput),
}
if (adaptor)
{
- bbtkDebugMessage("data",3," -> Adaptor found : using it"
+ bbtkCDebugMessage("data",3," -> Adaptor found : using it"
<<std::endl);
adaptor->bbSetInput("In",mFrom->bbGetOutput(mOutput),false);
adaptor->bbExecute();
(mTo->bbGetDescriptor()->GetInputDescriptor(mInput)
->IsPointerType()) )
{
- bbtkDebugMessage("data",3,
+ bbtkCDebugMessage("data",3,
" -> No adaptor found but source and target types are both pointers : trying up or down cast"<<std::endl);
void* nptr =
void Connection::OnOutputChange(bbtk::BlackBox::Pointer, const std::string&,
IOStatus status)
{
- bbtkDebugMessage("change",2,
+ bbtkCDebugMessage("change",2,
"==> Connection::OnOutputChange("
- <<GetIOStatusString(status)<<") ["
- <<GetFullName()<<"]"<<std::endl);
+ <<GetIOStatusString(status)<<")"
+ <<std::endl);
if (mAdaptor)
{
BlackBoxInputConnector* ac = mAdaptor->bbGetInputConnectorMap().find("In")->second;
//==================================================================
void Connection::Check() const
{
- bbtkMessage("debug",1,"** Checking Connection "<<(void*)this<<" ["<<GetFullName()<<"]"
+ bbtkMessage("debug",1,"** Checking Connection "<<(void*)this<<" ["
+ <<GetFullName()<<"]"
<<std::endl);
if (mFrom==0)
{
}
else
{
- bbtkMessage("debug",2," - From : "<<mFrom->bbGetFullName()<<std::endl);
+ bbtkMessage("debug",2," - From : "<<mFrom->bbGetName()<<std::endl);
if (!mFrom->bbHasOutput(mOutput))
{
bbtkError("** Checking Connection "<<(void*)this
<<" ["<<GetFullName()<<"] : "
- << mFrom->bbGetFullName()<<" does not have output '"
+ << mFrom->bbGetName()<<" does not have output '"
<<mOutput<<"'");
}
bbtkMessage("debug",2," - From : Output '"<<mOutput<<"' exists"<<std::endl);
{
bbtkError("** Checking Connection "<<(void*)this
<<" ["<<GetFullName()<<"] : "
- <<mFrom->bbGetFullName()<<" output '"
+ <<mFrom->bbGetName()<<" output '"
<<mOutput<<"' is not in OutputConnectorMap");
}
bbtkMessage("debug",2," - From : Output '"<<mOutput
{
bbtkError("** Checking Connection "<<(void*)this
<<" ["<<GetFullName()<<"] : "
- << "Connection ["<<GetFullName()<<"] : "
<<" OutputConnector '"
- <<mOutput<<"' of "<<mFrom->bbGetFullName()
+ <<mOutput<<"' of "<<mFrom->bbGetName()
<<" does not point to this connection");
}
// std::cout << mTo << std::endl;
// std::cout << mTo->bbGetDescriptor() << std::endl;
// std::cout << mTo->bbGetDescriptor()->GetTypeName() << std::endl;
- // mTo->bbGetFullName();
- bbtkMessage("debug",2," - To : "<<mTo->bbGetFullName()<<std::endl);
+ // mTo->bbGetName();
+ bbtkMessage("debug",2," - To : "<<mTo->bbGetName()<<std::endl);
if (!mTo->bbHasInput(mInput))
{
bbtkError("** Checking Connection "<<(void*)this
<<" ["<<GetFullName()<<"] : "
- <<mTo->bbGetFullName()<<" does not have input '"
+ <<mTo->bbGetName()<<" does not have input '"
<<mInput<<"'");
}
bbtkMessage("debug",2," - To : Input '"<<mInput<<"' exists"<<std::endl);
{
bbtkError("** Checking Connection "<<(void*)this
<<" ["<<GetFullName()<<"] : "
- <<mTo->bbGetFullName()<<" input '"
+ <<mTo->bbGetName()<<" input '"
<<mInput<<"' is not in InputConnectorMap");
}
bbtkMessage("debug",2," - To : Input '"<<mInput
{
bbtkError("** Checking Connection "<<(void*)this
<<" ["<<GetFullName()<<"] : "
- <<"Connection "<<GetFullName()<<" : "
<<" InputConnector '"
- <<mInput<<"' of "<<mTo->bbGetFullName()
+ <<mInput<<"' of "<<mTo->bbGetName()
<<" does not point to this connection");
}
Program: bbtk
Module: $RCSfile: bbtkExecuter.cxx,v $
Language: C++
- Date: $Date: 2009/03/30 15:22:51 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.30 $
=========================================================================*/
/* ---------------------------------------------------------------------
#include "bbtkMessageManager.h"
#include "bbtkFactory.h"
#include "bbtkUtilities.h"
+//#include "bbtkWx.h"
#include <fstream>
#ifdef USE_WXWIDGETS
//=======================================================================
Executer::Pointer Executer::New()
{
- bbtkDebugMessage("Kernel",9,"Executer::New()"<<std::endl);
+ bbtkDebugMessage("object",9,"Executer::New()"<<std::endl);
return MakePointer(new Executer());
}
//=======================================================================
mDialogMode(NoDialog),
mNoErrorMode(false)
{
- bbtkDebugMessageInc("Kernel",9,"Executer::Executer()" <<std::endl);
+ bbtkDebugMessage("object",2,"==> Executer()" <<std::endl);
mFactory = Factory::New();
// The smart pointer on this is not made yet (is made by New)
// -> create it to pass it to the factory
// -> this would auto-destroy !!
mFactory->SetExecuter(MakePointer(this,true));
Reset();
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugMessage("object",2,"<== Executer()" <<std::endl);
}
//=======================================================================
//=======================================================================
Executer::~Executer()
{
- bbtkDebugMessageInc("Kernel",9,"==> Executer::~Executer()" <<std::endl);
+ bbtkDebugMessage("object",2,"==> ~Executer()" <<std::endl);
mOpenDefinition.clear();
mOpenPackage.clear();
mFactory->Reset();
mFactory.reset();
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugMessage("object",2,"<== ~Executer()" <<std::endl);
}
//=======================================================================
//=======================================================================
void Executer::Reset()
{
- bbtkDebugMessageInc("Kernel",9,"Executer::Reset()" <<std::endl);
+ bbtkDebugMessage("kernel",9,"==> Executer::Reset()" <<std::endl);
GetFactory()->CheckPackages();
mOpenDefinition.clear();
mOpenPackage.clear();
- GetFactory()->Reset();
+ // Wx::DestroyTopWindow();
+
+ GetFactory()->Reset();
+ Wx::ProcessPendingEvents();
+
// Create user package
Package::Pointer p =
Package::New("user","internal","User defined black boxes","");
// Object::PrintObjectListInfo();
// GetFactory()->CheckPackages();
-
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugMessage("kernel",9,"<== Executer::Reset()" <<std::endl);
}
//=======================================================================
//=======================================================================
void Executer::BeginPackage (const std::string &name)
{
- bbtkDebugMessageInc("Kernel",9,"Executer::BeginPackage(\""<<name<<"\")"
+ bbtkDebugMessage("kernel",9,"==> Executer::BeginPackage(\""<<name<<"\")"
<<std::endl);
Package::Pointer p;
try
GetFactory()->InsertPackage(p);
}
mOpenPackage.push_back(p);
+
+ bbtkDebugMessage("kernel",9,"<== Executer::BeginPackage(\""<<name<<"\")"
+ <<std::endl);
}
//=======================================================================
const std::string &pack,
const std::string &scriptfilename)
{
- bbtkDebugMessageInc("Kernel",9,"Executer::Define(\""<<name<<
- ","<<pack<<"\")"
- <<std::endl);
+ bbtkDebugMessage("kernel",9,"==> Executer::Define(\""<<name<<
+ ","<<pack<<"\")"
+ <<std::endl);
ComplexBlackBoxDescriptor::Pointer b
= ComplexBlackBoxDescriptor::New(name);
b->SetScriptFileName(scriptfilename);
mOpenDefinition.push_back( CBBDefinition( b, pack ) );
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugMessage("kernel",9,"<== Executer::Define(\""<<name<<
+ ","<<pack<<"\")"
+ <<std::endl);
}
//=======================================================================
//=======================================================================
void Executer::Clear()
{
- bbtkDebugMessageInc("Kernel",9,"Executer::Clear()" <<std::endl);
+ bbtkDebugMessage("kernel",9,"==> Executer::Clear()" <<std::endl);
GetCurrentDescriptor()->GetPrototype()->Clear();
-
+ bbtkDebugMessage("kernel",9,"<== Executer::Clear()" <<std::endl);
}
//=======================================================================
//=======================================================================
void Executer::EndDefine ()
{
- bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\""
- <<GetCurrentDescriptor()->GetTypeName()<<"\")"
- <<std::endl);
+ bbtkDebugMessage("kernel",9,"==> Executer::EndDefine(\""
+ <<GetCurrentDescriptor()->GetTypeName()<<"\")"
+ <<std::endl);
// Does current package exist ?
Package::Pointer p;
std::string pname(mOpenDefinition.back().package);
}
p->RegisterBlackBox(GetCurrentDescriptor());
+ bbtkDebugMessage("kernel",9,"<== Executer::EndDefine(\""
+ <<GetCurrentDescriptor()->GetTypeName()<<"\")"
+ <<std::endl);
mOpenDefinition.pop_back();
}
//=======================================================================
/// prints the list of the boxes of the current descriptor
void Executer::PrintBoxes()
{
- bbtkMessageInc("Help",1,"The black box descriptor \""
- <<GetCurrentDescriptor()->GetTypeName()<<"\" contains : "<<std::endl);
+ bbtkMessage("help",1,"The black box descriptor \""
+ <<GetCurrentDescriptor()->GetTypeName()<<"\" contains : "<<std::endl);
GetCurrentDescriptor()->PrintBlackBoxes();
- bbtkDecTab("Help",1);
}
//=======================================================================
}
else
{
- bbtkMessageInc("Help",1,"No black box: \""
- <<nameblackbox<<"\" " <<std::endl);
+ bbtkMessage("help",1,"No black box: \""
+ <<nameblackbox<<"\" " <<std::endl);
}
return page;
}
if (GetNoExecMode() && (GetCurrentDescriptor()==GetWorkspace()) ) return;
if (GetCurrentDescriptor()!=GetWorkspace()) return;
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
+ bbtkDebugMessage("kernel",9,"Executer::Print(\""<<str<<"\")"<<std::endl);
// TO DO :
// InterpretLine ("load std")
for (i= chains.begin(); i!=chains.end(); ++i)
{
Utilities::SubsBackslashN(*i);
- bbtkMessage("Output",1,*i);
+ bbtkMessage("output",1,*i);
}
- bbtkMessage("Output",1,std::endl);
+ bbtkMessage("output",1,std::endl);
}
//==========================================================================
Program: bbtk
Module: $RCSfile: bbtkFactory.cxx,v $
Language: C++
- Date: $Date: 2009/03/30 15:22:51 $
- Version: $Revision: 1.42 $
+ Date: $Date: 2009/05/28 08:12:05 $
+ Version: $Revision: 1.43 $
=========================================================================*/
/* ---------------------------------------------------------------------
/// Default ctor
Factory::Pointer Factory::New()
{
- bbtkDebugMessage("Kernel",9,"Factory::New()"<<std::endl);
+ bbtkDebugMessage("kernel",9,"Factory::New()"<<std::endl);
return MakePointer(new Factory());
}
//===================================================================
Factory::Factory()
: mExecuter()
{
- bbtkDebugMessage("Kernel",7,"Factory::Factory()"<<std::endl);
+ bbtkDebugMessage("kernel",7,"Factory()"<<std::endl);
}
//===================================================================
/// Dtor
Factory::~Factory()
{
- bbtkDebugMessageInc("Kernel",7,"Factory::~Factory()"<<std::endl);
+ bbtkDebugMessage("kernel",7,"==> ~Factory()"<<std::endl);
CloseAllPackages();
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugMessage("kernel",7,"<== ~Factory()"<<std::endl);
}
//===================================================================
//===================================================================
void Factory::Reset()
{
- bbtkDebugMessageInc("Kernel",7,"Factory::Reset()"<<std::endl);
+ bbtkDebugMessage("kernel",7,"==> Factory::Reset()"<<std::endl);
CloseAllPackages();
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugMessage("kernel",7,"<== Factory::Reset()"<<std::endl);
}
//===================================================================
if (p!=0)
{
//===================================================================
- bbtkMessage("Output",2,p->GetName()<<" "
+ bbtkMessage("output",2,p->GetName()<<" "
<<p->GetVersion()
<<" "
<<p->GetAuthor() << " Category(s) :"
<<p->GetCategory()
<<std::endl);
- bbtkMessage("Output",2,p->GetDescription()<<std::endl);
+ bbtkMessage("output",2,p->GetDescription()<<std::endl);
//===================================================================
p->AddFactory(GetThisPointer<Factory>());
mPackageMap[pkgname] = p;
//
// lastname : string before the last / (if any), or user supplied name
- bbtkDebugMessageInc("Kernel",7,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
+ bbtkDebugMessageInc("kernel",7,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
bbtkMessage("debug",1,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
std::vector<std::string> package_paths;
iUnload = mPackageMap.find(pkgname);
if (iUnload != mPackageMap.end())
{
- bbtkMessage("Output",2,"["<< pkgname <<"] already loaded" << std::endl);
+ bbtkMessage("output",2,"["<< pkgname <<"] already loaded" << std::endl);
return;
}
// The following is *NOT* a debug time message :
// It's a user intended message.
// Please don't remove it.
- bbtkMessage("Output",3," [" <<libname
+ bbtkMessage("output",3," [" <<libname
<<"] : doesn't exist" <<std::endl);
}
else
// The following is *NOT* a debug time message :
// It's a user intended message.
// Please don't remove it.
- bbtkMessage("Output",3,
+ bbtkMessage("output",3,
" [" <<libname <<"] : doesn't exist" <<std::endl);
continue; // try next path
}
#endif
}
}
- bbtkMessage("Output",2,"[" << libname << "] loaded" << std::endl);
+ bbtkMessage("output",2,"[" << libname << "] loaded" << std::endl);
}
/// If the entry is found in the map, calls ClosePackage
void Factory::UnLoadPackage( const std::string& name )
{
- bbtkDebugMessageInc("Kernel",7,"Factory::UnLoadPackage(\""
+ bbtkDebugMessageInc("kernel",7,"Factory::UnLoadPackage(\""
<<name<<"\")"<<std::endl);
PackageMapType::iterator i;
<<"\" : package not loaded !");
}
ClosePackage(i);
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
}
//===================================================================
//===================================================================
void Factory::CloseAllPackages()
{
- bbtkDebugMessageInc("Kernel",7,"Factory::CloseAllPackages()"<<std::endl);
+ bbtkDebugMessageInc("kernel",7,"Factory::CloseAllPackages()"<<std::endl);
std::vector< Package::WeakPointer > mAlive;
do {
// If not dead : reinsert
if (i->lock())
{
- bbtkDebugMessage("Kernel",7,"Package "<<i->lock()->GetName()
+ bbtkDebugMessage("kernel",7,"Package "<<i->lock()->GetName()
<<" still alive"<<std::endl);
// InsertPackage(i->lock());
}
}
while (mPackageMap.size()>0);
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
}
//===================================================================
/// Finally erases the package entry in the packages map
void Factory::ClosePackage(PackageMapType::iterator& i)
{
- bbtkDebugMessageInc("Kernel",7,"Factory::ClosePackage(\""
+ bbtkDebugMessageInc("kernel",7,"Factory::ClosePackage(\""
<<i->second->GetName()
<<"\")"<<std::endl);
{
Package::Release(p);
}
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
}
//===================================================================
/// Displays the list of packages loaded
void Factory::PrintPackages(bool details, bool adaptors) const
{
- bbtkDebugMessageInc("Kernel",9,"Factory::PrintPackages"<<std::endl);
+ bbtkDebugMessageInc("kernel",9,"Factory::PrintPackages"<<std::endl);
PackageMapType::const_iterator i;
for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
}
}
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//===================================================================
/// Displays help on a package
void Factory::HelpPackage(const std::string& name, bool adaptors) const
{
- bbtkDebugMessageInc("Kernel",9,"Factory::HelpPackage(\""<<name<<"\")"
+ bbtkDebugMessageInc("kernel",9,"Factory::HelpPackage(\""<<name<<"\")"
<<std::endl);
PackageMapType::const_iterator i = mPackageMap.find(name);
}
else
{
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
bbtkError("package \""<<name<<"\" unknown");
}
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//===================================================================
std::string& package,
bool full) const
{
- bbtkDebugMessageInc("Kernel",9,"Factory::HelpBlackBox(\""<<name<<"\")"
+ bbtkDebugMessageInc("kernel",9,"Factory::HelpBlackBox(\""<<name<<"\")"
<<std::endl);
bool found = false;
}
}
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
if (!found)
{
bbtkError("No package of the factory contains any black box <"
/// Inserts a package in the factory
void Factory::InsertPackage( Package::Pointer p )
{
- bbtkDebugMessageInc("Kernel",9,"Factory::InsertPackage(\""<<
+ bbtkDebugMessageInc("kernel",9,"Factory::InsertPackage(\""<<
p->GetName()<<"\")"<<std::endl);
p->AddFactory(GetThisPointer<Factory>());
mPackageMap[p->GetName()] = p;
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//===================================================================
/// Removes a package from the factory (and deletes it)
void Factory::RemovePackage( Package::Pointer p )
{
- bbtkDebugMessageInc("Kernel",9,"Factory::RemovePackage(\""<<
+ bbtkDebugMessageInc("kernel",9,"Factory::RemovePackage(\""<<
p->GetName()<<"\")"<<std::endl);
PackageMapType::iterator i;
p->GetName()<<"\") : package absent from factory");
}
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//===================================================================
BlackBox::Pointer Factory::NewBlackBox(const std::string& type,
const std::string& name) const
{
- bbtkDebugMessageInc("Kernel",7,"Factory::NewBlackBox(\""
+ bbtkDebugMessageInc("kernel",7,"Factory::NewBlackBox(\""
<<type<<"\",\""<<name<<"\")"<<std::endl);
BlackBox::Pointer b;
bbtkError("black box type \""<<type<<"\" unknown");
}
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
return b;
}
//===================================================================
const DataInfo& typeout,
const std::string& name) const
{
- bbtkDebugMessageInc("Kernel",8,"Factory::NewAdaptor("
+ bbtkDebugMessageInc("kernel",8,"Factory::NewAdaptor("
<<typein<<","
<<typeout<<",\""
<<name<<"\")"<<bbtkendl);
<<" adaptor available");
}
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
return b;
}
//===================================================================
const DataInfo& typeout,
const std::string& name) const
{
- bbtkDebugMessageInc("Kernel",8,"Factory::NewWidgetAdaptor(<"
+ bbtkDebugMessageInc("kernel",8,"Factory::NewWidgetAdaptor(<"
<<typein<<">,<"
<<typeout<<">,\""
<<name<<"\")"<<bbtkendl);
<<"> widget adaptor available");
}
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
return b;
}
//===================================================================
const DataInfo& typeout,
std::string& adaptor) const
{
- bbtkDebugMessageInc("Kernel",8,"Factory::FindAdaptor(<"
+ bbtkDebugMessageInc("kernel",8,"Factory::FindAdaptor(<"
<<typein<<">,<"
<<typeout<<">)"<<bbtkendl);
}
*/
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
return b;
}
//===================================================================
const DataInfo& typeout,
std::string& adaptor) const
{
- bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+ bbtkDebugMessageInc("kernel",8,"Factory::FindWidgetAdaptor(<"
<<typein<<">,<"
<<typeout<<">)"<<bbtkendl);
adaptor);
if (b) break;
}
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
return b;
}
//===================================================================
std::string& widget,
std::string& adaptor) const
{
- bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+ bbtkDebugMessageInc("kernel",8,"Factory::FindWidgetAdaptor(<"
<<typein<<">,<"
<<typeout<<">)"<<bbtkendl);
if (!b)
{
// Look for a widget adaptor with good nature out
- bbtkMessage("Kernel",5,
+ bbtkMessage("kernel",5,
"*** Looking for a two pieces widget adaptor for : "
<< typein << "->"<<typeout<<std::endl);
for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
)
{
widget = j->second.lock()->GetTypeName();
- bbtkMessage("Kernel",5,
+ bbtkMessage("kernel",5,
"===> Found first part : "<<widget
<< " "<<j->first.mTypeIn<<"->"
<<j->first.mTypeOut<<std::endl);
b = FindAdaptor( ti, to, adaptor );
if (b)
{
- bbtkMessage("Kernel",5,
+ bbtkMessage("kernel",5,
"===> Found second part : "<<adaptor
<<std::endl);
break;
}
else
{
- bbtkMessage("Kernel",5,
+ bbtkMessage("kernel",5,
"===> No second part found"<<std::endl);
}
}
if (b) break;
}
}
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugDecTab("kernel",7);
return b;
}
//===================================================================
BlackBox::Pointer to,
const std::string& input) const
{
- bbtkDebugMessage("Kernel",7,"Factory::NewConnection(\""
+ bbtkDebugMessage("kernel",7,"Factory::NewConnection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input
<<"\")"<<std::endl);
//===================================================================
Package::Pointer Factory::GetPackage(const std::string& name) const
{
- bbtkDebugMessageInc("Kernel",9,"Factory::GetPackage(\""<<name<<"\")"
+ bbtkDebugMessageInc("kernel",9,"Factory::GetPackage(\""<<name<<"\")"
<<std::endl);
PackageMapType::const_iterator i = mPackageMap.find(name);
if ( i != mPackageMap.end() )
{
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
return i->second;
}
else
{
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
bbtkError("package \""<<name<<"\" unknown");
}
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//===================================================================
void Factory::WriteDotFilePackagesList(FILE *ff)
{
- bbtkDebugMessageInc("Kernel",9,"Factory::WriteDotFilePackagesList()"
+ bbtkDebugMessageInc("kernel",9,"Factory::WriteDotFilePackagesList()"
<<std::endl);
fprintf( ff , "\n");
fprintf(ff," %s [shape=ellipse, URL=\"%s\"]%s\n",i->first.c_str(),url.c_str(),";" );
}
fprintf( ff , "}\n\n");
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//===================================================================
}
}
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
if (!found)
{
bbtkError("No package of the factory contains any black box <"
void Factory::CreateHtmlIndex(IndexEntryType type,
const std::string& filename)
{
- bbtkDebugMessageInc("Kernel",9,"Factory::CreateHtmlIndex(\""
+ bbtkDebugMessageInc("kernel",9,"Factory::CreateHtmlIndex(\""
<<filename<<"\")"<<bbtkendl);
std::string title;
//----------------------
// End
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
//==========================================================================
Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $
Language: C++
- Date: $Date: 2009/04/30 14:31:31 $
- Version: $Revision: 1.84 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.85 $
=========================================================================*/
/* ---------------------------------------------------------------------
//=======================================================================
Interpreter::Pointer Interpreter::New(const std::string& cpp_file)
{
- bbtkDebugMessage("Kernel",9,"Interpreter::New('"<<cpp_file<<"')"<<std::endl);
+ bbtkDebugMessage("kernel",9,"Interpreter::New('"<<cpp_file<<"')"<<std::endl);
return MakePointer(new Interpreter(cpp_file));
}
//=======================================================================
//=======================================================================
Interpreter::Pointer Interpreter::New(VirtualExec::Pointer e)
{
- bbtkDebugMessage("Kernel",9,"Interpreter::New(VirtualExec)"<<std::endl);
+ bbtkDebugMessage("kernel",9,"Interpreter::New(VirtualExec)"<<std::endl);
return MakePointer(new Interpreter(e));
}
//=======================================================================
//=======================================================================
Interpreter::Interpreter(const std::string& cpp_file)
{
+ bbtkDebugMessage("object",2,"==> Interpreter("<<cpp_file<<")"<<std::endl);
Init(VirtualExec::Pointer(), cpp_file);
+ bbtkDebugMessage("object",2,"<== Interpreter("<<cpp_file<<")"<<std::endl);
}
//=======================================================================
//=======================================================================
Interpreter::Interpreter(VirtualExec::Pointer e)
{
+ bbtkDebugMessage("object",2,"==> Interpreter(VirtualExec)"<<std::endl);
Init(e,"");
+ bbtkDebugMessage("object",2,"<== Interpreter(VirtualExec)"<<std::endl);
}
//=======================================================================
mCommandDict[info.keyword] = info;
*/
- bbtkDebugDecTab("Interpreter",9);
+
}
//=======================================================================
*/
Interpreter::~Interpreter()
{
- bbtkDebugMessageInc("Interpreter",9,"==> Interpreter::~Interpreter()" <<std::endl);
+ bbtkDebugMessage("object",2,"==> ~Interpreter()" <<std::endl);
mVirtualExecuter = VirtualExec::Pointer();
- bbtkDebugMessageInc("Interpreter",9,"<== Interpreter::~Interpreter()" <<std::endl);
+ bbtkDebugMessage("object",2,"<== ~Interpreter()" <<std::endl);
}
//=======================================================================
const std::string& script_file,
int script_line
)
- : Exception("Interpreter",0,message),
+ : Exception("interpreter",0,message),
mInScriptFile(in_script_file),
mScriptFile(script_file),
mScriptLine(script_line)
//=======================================================================
Interpreter::ExitStatus Interpreter::InterpretFile( const std::string& filename, bool source )
{
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
+ bbtkDebugMessage("interpreter",4,"==> Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
bool exm = mCommandLine;
mCommandLine = false;
}
CATCH_MACRO;
- bbtkDebugMessage("Interpreter",9,
- "EO Interpreter::InterpretFile(\""
+ bbtkDebugMessage("interpreter",4,
+ "<== Interpreter::InterpretFile(\""
<<filename<<"\")"<<std::endl);
- bbtkDecTab("Interpreter",9);
+
mCommandLine = exm;
Interpreter::ExitStatus
Interpreter::InterpretBuffer( std::stringstream* buffer )
{
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretBuffer()"<<std::endl);
+ bbtkDebugMessage("interpreter",4,"==> Interpreter::InterpretBuffer()"<<std::endl);
bool exm = mCommandLine;
mCommandLine = false;
CATCH_MACRO;
// CloseAllFiles();
- bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretBuffer()"<<std::endl);
- bbtkDecTab("Interpreter",9);
+ bbtkDebugMessage("interpreter",4,"<== Interpreter::InterpretBuffer()"<<std::endl);
+
mCommandLine = exm;
return mStatus;
/// Interprets the currently open streams
Interpreter::ExitStatus Interpreter::InterpretCurrentStreams()
{
- bbtkDebugMessageInc("Interpreter",9,
- "Interpreter::InterpretCurrentStreams()"<<std::endl);
+ bbtkDebugMessage("interpreter",4,
+ "==> Interpreter::InterpretCurrentStreams()"<<std::endl);
while (mFile.size()>0)
{
}
CloseCurrentFile();
}
+ bbtkDebugMessage("interpreter",4,
+ "<== Interpreter::InterpretCurrentStreams()"<<std::endl);
+
return mStatus;
}
//=======================================================================
/// Runs the interpretation of a command
Interpreter::ExitStatus Interpreter::InterpretLine( const std::string& line )
{
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine('"<<line<<"')"<<std::endl);
+ bbtkDebugMessage("interpreter",5,"==> Interpreter::InterpretLine('"<<line<<"')"<<std::endl);
try
{
CATCH_MACRO;
- bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretLine()"
- <<std::endl);
- bbtkDecTab("Interpreter",9);
+ bbtkDebugMessage("interpreter",5,"<== Interpreter::InterpretLine('"<<line<<"')"<<std::endl);
return mStatus;
}
//=======================================================================
void Interpreter::DoInterpretLine( const std::string& line )
{
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::DoInterpretLine(\""<<line<<"\")"<<std::endl);
+ bbtkDebugMessage("interpreter",6,"==> Interpreter::DoInterpretLine(\""
+ <<line<<"\")"<<std::endl);
std::vector<std::string> words;
SplitLine(line,words);
// Empty line
if (words.size()<1)
{
- bbtkDebugDecTab("Interpreter",9);
+ bbtkDebugDecTab("interpreter",9);
return;
}
// Single line comment : # or //
if ( words[0][0]=='#' || (words[0][0]=='/' && words[0][1]=='/') )
{
- bbtkDebugDecTab("Interpreter",9);
- bbtkMessage("Interpreter",9,"Comment"<<std::endl);
+ bbtkDebugDecTab("interpreter",9);
+ bbtkMessage("interpreter",9,"Comment"<<std::endl);
return;
}
if (words[0][0]=='/' && words[0][1]=='*')
{
- bbtkDebugDecTab("Interpreter",9);
- bbtkMessage("Interpreter",9,"In multiline comment"<<std::endl);
+ bbtkDebugDecTab("interpreter",9);
+ bbtkMessage("interpreter",9,"In multiline comment"<<std::endl);
mInsideComment = true;
return;
}
if (words[0][0]=='*' && words[0][1]=='/')
{
- bbtkDebugDecTab("Interpreter",9);
- bbtkMessage("Interpreter",9,"Out multiline comment"<<std::endl);
+ bbtkDebugDecTab("interpreter",9);
+ bbtkMessage("interpreter",9,"Out multiline comment"<<std::endl);
if ( !mInsideComment ) {
- bbtkDebugDecTab("Interpreter",9);
- bbtkMessage("Interpreter",9,"Comment mismatch : '*/' with no matching '/*'"<<std::endl);
+ bbtkDebugDecTab("interpreter",9);
+ bbtkMessage("interpreter",9,"Comment mismatch : '*/' with no matching '/*'"<<std::endl);
}
mInsideComment = false;
return;
if (mInsideComment)
{
- bbtkDebugDecTab("Interpreter",9);
- bbtkMessage("Interpreter",9,"Multiline Comment"<<std::endl);
+ bbtkDebugDecTab("interpreter",9);
+ bbtkMessage("interpreter",9,"Multiline Comment"<<std::endl);
return;
}
CommandInfoType command;
InterpretCommand(words,command);
- bbtkDebugMessage("Interpreter",9,
+ bbtkDebugMessage("interpreter",9,
"Command='"<<command.keyword
<<"' code="<<command.code<<std::endl);
int level=0;
bbtkInternalError("should not reach here !!!");
}
- bbtkDecTab("Interpreter",9);
-}
+ bbtkDebugMessage("interpreter",6,"<== Interpreter::DoInterpretLine(\""
+ <<line<<"\")"<<std::endl);
+
+ }
//=======================================================================
//=======================================================================
void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>& tokens)
{
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::SplitLine(\""<<str<<"\")"<<std::endl);
+ bbtkDebugMessage("interpreter",9,"==> Interpreter::SplitLine(\""<<str<<"\")"<<std::endl);
std::string delimiters = "\"";
std::vector<std::string> quote;
++i;
if (i!=quote.end())
{
- // bbtkDebugMessage("Interpreter",0,"\""<<*i<<"\""<<std::endl);
+ // bbtkDebugMessage("interpreter",0,"\""<<*i<<"\""<<std::endl);
tokens.push_back(*i);
++i;
}
for (i=tokens.begin(); i!=tokens.end(); ++i)
{
- bbtkDebugMessage("Interpreter",9,"["<<*i<<"] ");
+ bbtkDebugMessage("interpreter",9,"--["<<*i<<"]"<<std::endl);
}
- bbtkDebugMessageCont("Interpreter",9,std::endl);
+ bbtkDebugMessage("interpreter",9,"<== Interpreter::SplitLine(\""<<str<<"\")"<<std::endl);
- bbtkDebugDecTab("Interpreter",9);
}
//=======================================================================
{
if (mVirtualExecuter->GetNoExecMode()) return;
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
+ bbtkDebugMessageInc("interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
// TO DO :
// InterpretLine ("load std")
std::cout << *i;
}
std::cout << std::endl;
- bbtkDebugDecTab("Interpreter",9);
+ bbtkDebugDecTab("interpreter",9);
}
*/
// use ./directory/subdir/scrname.bbs
//
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::SwitchToFile( \""
- <<name<<"\")"<<std::endl);
+ bbtkDebugMessage("interpreter",4,"==> Interpreter::SwitchToFile( \""
+ <<name<<"\")"<<std::endl);
std::vector<std::string> script_paths;
std::string fullPathScriptName; // full path script name
// The following is *NOT* a debug time message :
// It's a user intended message.
// Please don't remove it.
- bbtkMessage("Interpreter",1,
+ bbtkMessage("interpreter",1,
"look for : [" << name
<< "]" << std::endl);
std::string upath;
pkgname = Utilities::ExtractScriptName(name,upath);
- bbtkMessage("Interpreter",3,
+ bbtkMessage("interpreter",3,
"package name:[" << pkgname
<< "] path:[" << upath << "]" << std::endl);
bool fullnameGiven = false;
// ==== no path provided : look in root bbs path
if (upath.size()==0)
{
- // bbtkMessage("Interpreter",1,
+ // bbtkMessage("interpreter",1,
// LG : add all bbs path
// script_paths.push_back( ConfigurationFile::GetInstance().Get_root_bbs_path() );
std::vector<std::string>::const_iterator i;
std::vector<std::string>::iterator i;
for (i=script_paths.begin();i!=script_paths.end();i++)
{
- bbtkMessage("Interpreter",1,
+ bbtkMessage("interpreter",1,
"--> Looking in '" << *i << "'" << std::endl);
Filenames.clear();
if ( (*j).substr(lgr-4, 4) != ".bbp") continue;
(*stream) << "include \"" << *j << "\"\n";
- bbtkMessage("Interpreter",2," --> Found '" << *j << "'" << std::endl);
+ bbtkMessage("interpreter",2," --> Found '" << *j << "'" << std::endl);
nbBssFiles++;
} // for (std::vector...
// === Result ...
if (nbBssFiles==0)
{
- bbtkMessage("Interpreter",1,
+ bbtkMessage("interpreter",1,
" --> No .bbp found"<< std::endl);
}
else
{
- bbtkMessage("Interpreter",1,
+ bbtkMessage("interpreter",1,
" --> "<<nbBssFiles<<" .bbp found"<< std::endl);
SwitchToStream(stream);
}
// The following is *NOT* a debug time message :
// It's a user intended message.
// Please don't remove it.
- bbtkMessage("Interpreter",2,
+ bbtkMessage("interpreter",2,
" [" <<fullPathScriptName <<"] : does not exist"
<<std::endl);
continue; // try next path
}
- bbtkMessage("Interpreter",2,
+ bbtkMessage("interpreter",2,
" [" <<fullPathScriptName
<<"] : found" <<std::endl);
foundFile = true;
// The following is *NOT* a debug time message :
// It's a user intended message.
// Please don't remove it.
- bbtkMessage("Interpreter",2,
+ bbtkMessage("interpreter",2,
" [" <<tfullPathScriptName <<".bbs/.bbp] : do not exist"
<<std::endl);
continue; // try next path
}
}
- bbtkMessage("Interpreter",2,
+ bbtkMessage("interpreter",2,
" [" <<fullPathScriptName
<<"] : found" <<std::endl);
foundFile = true;
//=======================================================================
void Interpreter::SwitchToStream( std::stringstream* stream )
{
- mFile.push_back(stream);
+ bbtkDebugMessage("interpreter",4,"==> Interpreter::SwitchToStream()"
+ <<std::endl);
+ mFile.push_back(stream);
std::ostringstream buffer_name;
bufferNb++;
buffer_name << "buffer_" ;
void Interpreter::LoadScript( std::string fullPathScriptName,
std::string includeScriptName)
{
- Utilities::replace( fullPathScriptName ,
+ bbtkDebugMessage("interpreter",4,"==> Interpreter::LoadScript("
+ <<fullPathScriptName<<")"
+ <<std::endl);
+
+ Utilities::replace( fullPathScriptName ,
INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
if (find(mFileNameHistory.begin(),
return;
}
- bbtkMessage("Interpreter",1," -->[" << fullPathScriptName
+ bbtkMessage("interpreter",1," -->[" << fullPathScriptName
<< "] found" << std::endl);
mFile.push_back(s);
mIncludeFileName.push_back(includeScriptName);
mLine.push_back(0);
- return;
+ return;
}
//=======================================================================
//=======================================================================
void Interpreter::CloseCurrentFile()
{
- bbtkDebugMessage("Interpreter",9,"Interpreter::CloseCurrentFile()"
+ bbtkDebugMessage("interpreter",9,"==> Interpreter::CloseCurrentFile()"
<<std::endl);
if (mFile.size()==0)
{
- bbtkDebugMessage("Interpreter",9," -> no file left open"<<std::endl);
+ bbtkDebugMessage("interpreter",9," -> no file left open"<<std::endl);
return;
}
- bbtkDebugMessage("Interpreter",9," Closing file '"<<mFileName.back()<<"'"<<std::endl);
+ bbtkDebugMessage("interpreter",9," Closing file '"<<mFileName.back()<<"'"<<std::endl);
std::ifstream* file = dynamic_cast<std::ifstream*>(mFile.back());
if (file!=0) file->close();
mIncludeFileName.pop_back();
mLine.pop_back();
- bbtkDebugMessage("Interpreter",9," Remains "
+ bbtkDebugMessage("interpreter",9," Remains "
<<mFile.size()
<<" open"<<std::endl);
- bbtkDebugMessage("Interpreter",9,"EO Interpreter::CloseCurrentFile()"
+ bbtkDebugMessage("interpreter",9,"<== Interpreter::CloseCurrentFile()"
<<std::endl);
}
//=======================================================================
//=======================================================================
void Interpreter::CloseAllFiles()
{
- bbtkDebugMessage("Interpreter",9,"Interpreter::CloseAllFiles()"
+ bbtkDebugMessage("interpreter",9,"==> Interpreter::CloseAllFiles()"
<<std::endl);
while (mFile.size() != 0)
{
CloseCurrentFile();
}
- bbtkDebugMessage("Interpreter",9,"EO Interpreter::CloseAllFiles()"
+ bbtkDebugMessage("interpreter",9,"<== Interpreter::CloseAllFiles()"
<<std::endl);
}
//=======================================================================
void Interpreter::InterpretCommand( const std::vector<std::string>& words,
CommandInfoType& info )
{
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretCommand(...)"<<std::endl);
+ bbtkDebugMessage("interpreter",9,"==> Interpreter::InterpretCommand(...)"<<std::endl);
// searches the command keyword
CommandDictType::iterator c;
}
info = c->second;
- bbtkDecTab("Interpreter",9);
+
+ bbtkDebugMessage("interpreter",9,"<== Interpreter::InterpretCommand(...)"<<std::endl);
+
}
//=======================================================================
//=======================================================================
void Interpreter::CommandLineInterpreter()
{
- bbtkDebugMessageInc("Interpreter",9,
+ bbtkDebugMessageInc("interpreter",9,
"Interpreter::CommandLineInterpreter()"<<std::endl);
#ifdef BBTK_USE_TERMIOS_BASED_PROMPT
/*
catch (QuitException e)
{
- bbtkMessage("Interpreter",1,"Interpreter : Quit"<<std::endl);
+ bbtkMessage("interpreter",1,"Interpreter : Quit"<<std::endl);
again = false;
}
*/
std::cout << "Good bye !" << std::endl;
- bbtkDebugDecTab("Interpreter",9);
+ bbtkDebugDecTab("interpreter",9);
}
//=======================================================================
if (workspace==0)
{
delete s;
- bbtkError("Interpreter::CreateGUI : could not access the executer currently defined complex box");
+ bbtkError("interpreter::CreateGUI : could not access the executer currently defined complex box");
}
Program: bbtk
Module: $RCSfile: bbtkItkBlackBoxMacros.h,v $
Language: C++
- Date: $Date: 2009/05/15 15:00:24 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.7 $
=========================================================================*/
/* ---------------------------------------------------------------------
public: \
inline void bbUserProcess() \
{ \
- bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName() \
- <<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("process",1,"**> Processing..." \
+ <<std::endl); \
itkParent::Update(); \
- bbtkDebugMessage("process",2,"<** Processing ["<<bbGetFullName() \
- <<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("process",2,"<** Processing" \
+ <<std::endl); \
}
//============================================================================
Program: bbtk
Module: $RCSfile: bbtkMessageManager.cxx,v $
Language: C++
- Date: $Date: 2009/05/19 10:19:23 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.16 $
=========================================================================*/
/* ---------------------------------------------------------------------
mMessageLevel[key] = 9;
mMessageHelp[key] = "Maximum level for all kind of messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- key ="Kernel";
+ key ="kernel";
mMessageLevel[key] = 0;
mMessageHelp[key] = "Messages generated by the core classes of the lib";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
mMessageLevel[key] = 0;
mMessageHelp[key] = "Messages related to box processing";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- key = "Help";
+ key = "help";
mMessageLevel[key] = 1;
mMessageHelp[key] = "Help messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- key = "Error";
+ key = "error";
mMessageLevel[key] = 0;
mMessageHelp[key] = "Error messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- key = "Warning";
+ key = "warning";
mMessageLevel[key] = 1;
mMessageHelp[key] = "Warning messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- key = "Output";
+ key = "output";
mMessageLevel[key] = 1;
mMessageHelp[key] = "Output messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
mMessageLevel[key] = 0;
mMessageHelp[key] = "Debug messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- key = "Config";
+ key = "config";
mMessageLevel[key] = 0;
mMessageHelp[key] = "Configuration related messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
mMessageLevel[key] = 0;
mMessageHelp[key] = "Box i/o changes related messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- }
+ key = "code";
+ mMessageLevel[key] = 0;
+ mMessageHelp[key] = "If positive then codes of the messages are displayed";
+ if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
+ }
void MessageManager::PrintInfo()
{
- bbtkMessage("Help",1,"================ Messages ================="
+ bbtkMessage("help",1,"================ Messages ================="
<< bbtkendl);
- bbtkMessage("Help",1, "Kind");
+ bbtkMessage("help",1, "Kind");
for (int k=0;
k<(int)(GetInstance()->mMaxMessageLength-2);
k++)
{
- bbtkMessageCont("Help",1," ");
+ bbtkMessageCont("help",1," ");
}
- bbtkMessageCont("Help",1,"Level Nature" << bbtkendl);
+ bbtkMessageCont("help",1,"Level Nature" << bbtkendl);
std::map<std::string,int>::iterator i;
std::map<std::string,std::string>::iterator j;
for (i=GetInstance()->mMessageLevel.begin(),
j=GetInstance()->mMessageHelp.begin();
i!=GetInstance()->mMessageLevel.end();++i,++j) {
- bbtkMessage("Help",1, (*i).first);
+ bbtkMessage("help",1, (*i).first);
for (int k=0;
k<(int)(GetInstance()->mMaxMessageLength+2-(*i).first.length());
k++) {
- bbtkMessageCont("Help",1," ");
+ bbtkMessageCont("help",1," ");
}
- bbtkMessageCont("Help",1, (*i).second << "\t"
+ bbtkMessageCont("help",1, (*i).second << "\t"
<< (*j).second << bbtkendl);
}
- bbtkMessage("Help",1,"==========================================="
+ bbtkMessage("help",1,"==========================================="
<< bbtkendl);
}
-
+ std::string MessageManager::FormatKey(const std::string& key,
+ int value)
+ {
+ std::string s;
+ if ( GetInstance()->mMessageLevel["code"] != 0 )
+ {
+ s = key.substr(0,4);
+ std::stringstream ss;
+ ss << value;
+ // s += " ";
+ s += ss.str();
+ s += "> ";
+ }
+ return s;
+ }
}
Program: bbtk
Module: $RCSfile: bbtkMessageManager.h,v $
Language: C++
- Date: $Date: 2008/11/29 21:41:34 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.9 $
=========================================================================*/
/* ---------------------------------------------------------------------
} \
else if (value<= __bbtkOnMessageLevelVariable)
+#define BBTK_PREPEND_MESSAGE_WITH_CODE
#ifdef BBTK_PREPEND_MESSAGE_WITH_CODE
-#define bbtkMessageCode \
- key[0] << key[1] << key[2] << value << " "
+#define bbtkMessageCode(key,value) \
+ bbtk::MessageManager::FormatKey(key,value)
#else
-#define bbtkMessageCode ""
+#define bbtkMessageCode(key,value) ""
#endif
#ifdef BBTK_PREPEND_MESSAGE_WITH_TAB
#define bbtkMessageTab ""
#endif
-#define BBTK_PREPEND_MESSAGE_WITH_SPACE
+//#define BBTK_PREPEND_MESSAGE_WITH_SPACE
#ifdef BBTK_PREPEND_MESSAGE_WITH_SPACE
#define bbtkMessageSpace(value) \
bbtk::MessageManager::GetSpace(value)
do { \
bbtkOnMessageLevel(key,value) \
{ \
- std::cout << bbtkMessageCode \
+ std::cout << bbtkMessageCode(key,value) \
<< bbtkMessageTab \
<< bbtkMessageSpace(value) \
<< MESSAGE; \
{ \
bbtkOnMessageLevel(key,value) \
{ \
- std::cout << bbtkMessageCode \
+ std::cout << bbtkMessageCode(key,value) \
<< bbtkMessageTab \
<< bbtkMessageSpace(value) \
<< MESSAGE; \
bbtkOnMessageLevel(key,value) \
{ \
bbtk::MessageManager::DecTab(); \
- std::cout << bbtkMessageCode \
+ std::cout << bbtkMessageCode(key,value) \
<< bbtkMessageTab \
<< bbtkMessageSpace(value) \
<< MESSAGE; \
{ \
bbtkOnMessageLevel(key,value) \
{ \
- std::cout << bbtkMessageCode \
+ std::cout << bbtkMessageCode(key,value) \
<< bbtkMessageTab \
<< bbtkMessageSpace(value) \
<< MESSAGE; \
{ \
bbtkOnMessageLevel(key,value) \
{ \
- std::cout << bbtkMessageCode \
+ std::cout << bbtkMessageCode(key,value) \
<< bbtkMessageTab \
<< bbtkMessageSpace(value) \
<< MESSAGE; \
bbtkOnMessageLevel(key,value) \
{ \
bbtk::MessageManager::DecTab(); \
- std::cout << bbtkMessageCode \
+ std::cout << bbtkMessageCode(key,value) \
<< bbtkMessageTab \
<< bbtkMessageSpace(value) \
<< MESSAGE; \
///
static void PrintInfo();
+ static std::string FormatKey(const std::string& key, int value);
+
private:
std::map<std::string,int> mMessageLevel;
std::map<std::string,std::string> mMessageHelp;
Program: bbtk
Module: $RCSfile: bbtkPackage.cxx,v $
Language: C++
- Date: $Date: 2009/04/21 14:36:51 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.26 $
=========================================================================*/
/* ---------------------------------------------------------------------
mDescription(description),
mVersion(version)
{
- bbtkDebugMessage("object",2,"==> Package::Package('"<<name<<"',...)"
+ bbtkDebugMessage("object",2,"==> Package('"<<name<<"',...)"
<<bbtkendl);
std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
/// Dtor
Package::~Package()
{
- bbtkDebugMessage("object",2,"==> Package::~Package(\""<<mName<<"\")"<<bbtkendl);
- bbtkDebugMessage("object",2,"<== Package::~Package(\""<<mName<<"\")"<<bbtkendl);
+ bbtkDebugMessage("object",2,"==> ~Package(\""<<mName<<"\")"<<bbtkendl);
}
//==========================================================================
Program: bbtk
Module: $RCSfile: bbtkRTTI.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:14 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.4 $
=========================================================================*/
/* ---------------------------------------------------------------------
void* source_pointer
)
{
- bbtkDebugMessage("Data",5,
+ bbtkDebugMessage("data",5,
"run_time_up_or_down_cast : Casting pointer to '"
<< TypeName(typeid(*(Dummy*)source_pointer))
<< "' from " << TypeName(source_type)
const abi::__class_type_info* targetTI =
(const abi::__class_type_info *)( &(target_type));
- bbtkDebugMessage("Data",7," * source = "<<source_pointer<<std::endl);
+ bbtkDebugMessage("data",7," * source = "<<source_pointer<<std::endl);
void* tmp = source_pointer;
if (source_type.__do_upcast(targetTI,&tmp))
}
else
{
- bbtkDebugMessage("Data",7,
+ bbtkDebugMessage("data",7,
" * upcast failed : trying dynamic down cast"
<<std::endl);
const abi::__class_type_info* sourceTI =
-1);
}
- bbtkDebugMessage("Data",7," * target = "<<target_pointer<<std::endl);
+ bbtkDebugMessage("data",7," * target = "<<target_pointer<<std::endl);
#else
bbtkWarning("run_time_up_or_down_cast not impl. on Win : to do");
Program: bbtk
Module: $RCSfile: bbtkTranscriptor.cxx,v $
Language: C++
- Date: $Date: 2008/12/12 12:11:21 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.16 $
=========================================================================*/
/* ---------------------------------------------------------------------
mDialogMode(NoDialog)
{
//VirtualExec();
- bbtkDebugMessageInc("Kernel",9,"Transcriptor::Transcriptor()" <<std::endl);
+ bbtkDebugMessageInc("kernel",9,"Transcriptor()" <<std::endl);
//std::ofstream *m_Fp = new std::ofstream();
m_Fp.open (filename.c_str(), std::ios::out );
m_Fp << " bbtk::Executer *e = new bbtk::Executer();" << std::endl;
#endif
*/
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
/**
Transcriptor::~Transcriptor()
{
- bbtkDebugMessageInc("Kernel",9,"Transcriptor::~Transcriptor()" <<std::endl);
+ bbtkDebugMessageInc("kernel",9,"~Transcriptor()" <<std::endl);
/*
#ifdef _USE_WXWIDGETS_
m_Fp << " }"<<std::endl;
m_Fp << "}" << std::endl;
m_Fp.close();
- bbtkDebugDecTab("Kernel",9);
+ bbtkDebugDecTab("kernel",9);
}
Program: bbtk
Module: $RCSfile: bbtkVtkBlackBoxMacros.h,v $
Language: C++
- Date: $Date: 2009/05/18 10:45:41 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.13 $
=========================================================================*/
/* ---------------------------------------------------------------------
public: \
inline void bbUserProcess() \
{ \
- bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName() \
- <<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("process",1,"**> Processing..." \
+ <<std::endl); \
mVtkObject->Update(); \
- bbtkDebugMessage("process",2,"<** Processing ["<<bbGetFullName() \
- <<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("process",2,"<** Processing" \
+ <<std::endl); \
}
//============================================================================
Program: bbtk
Module: $RCSfile: bbtkWidgetBlackBox.h,v $
Language: C++
- Date: $Date: 2009/05/14 14:43:34 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.4 $
========================================================================*/
{
- template <class T> class WidgetBlackBoxWindow;
//==================================================================
// typedef WidgetTraits Traits;
typedef W Widget;
typedef Widget* WidgetPointer;
- typedef WidgetBlackBoxWindow<W> Window;
BBTK_BLACK_BOX_INTERFACE(WidgetBlackBox,bbtk::AtomicBlackBox);
/// Overloaded bbCreateWindow method for WidgetBlackBoxes which handles
/// the window creation if needed
virtual void bbCreateWindow();
+ virtual bool bbWindowIsCreated() { return false; }
//==================================================================
//==================================================================
/// Overloaded bbShowWindow method for WidgetBlackBoxes which handles
/// the window creation if needed
- virtual void bbShowWindow();
+ virtual void bbShowWindow() {}
//==================================================================
- //==================================================================
- /// Returns the **OWN** window associated to the box
- /// If 0 returned = no window
- Window* bbGetWindow() { return bbmWindow; }
- /// Returns the window containing the widget associated to the box
- /// Which can be the own window of **ANOTHER** box in case of
- /// a hierarchy of widgets (layouts)
- /// More precisely :
- /// If bbGetWindow() != 0 then returns bbGetWindow()
- /// Else if the output 'Widget' is connected
- /// then returns bbGetContainingWindow() of the box connected to 'Widget'
- /// Else returns 0;
- Window* bbGetContainingWindow();
-
-
- /// Returns true iff the 'containing window' exists and is shown
- /// (see bbGetContainingWindow).
- bool bbIsShown();
-
+
/// Convenient method which returns true iff the output Widget is connected
bool bbIsOutputWidgetConnected();
//==================================================================
- /// User callback invoked when the containing window is shown
- virtual void bbUserOnShow() {}
+ void bbSetShown(bool);
+ bool bbIsShown();
//==================================================================
- //==================================================================
- /// User callback invoked when the containing window is hidden
- virtual void bbUserOnHide() {}
- //==================================================================
-
- /// Sets the window
- inline void bbSetWindow(Window* w) { bbmWindow=w; }
-
+
//==================================================================
/// User callback for creating the widget associated to the box
/// ** Must be defined ** in user classes
//==================================================================
//==================================================================
- /// Hides the WidgetBlackBoxWindow associated to the box (if exists)
- void bbHideWindow();
- /// Closes (destroys) the WidgetBlackBoxWindow associated to the box
- /// (if exists)
- void bbCloseWindow();
- //==================================================================
-
-
- //==================================================================
- // virtual void InitWindowManagerIfNeeded();
- virtual void IncNbWindowsAlive() {}
- virtual void DecNbWindowsAlive() {}
- virtual int GetNbWindowsAlive() { return 0; }
- virtual bool IsSomeWindowAlive() { return false; }
-
- virtual void IncNbWindowsShown() {}
- virtual void DecNbWindowsShown() {}
- virtual int GetNbWindowsShown() { return 0; }
- virtual bool IsSomeWindowShown() { return false; }
+ /// Destroys the WidgetBlackBoxWindow associated to the box (if exists)
+ virtual void bbDestroyWindow() {}
//==================================================================
+
private:
- /// friendship
- friend class WidgetBlackBoxWindow<W>;
- // friend class WidgetBlackBoxWidgetEventHandler;
-
- /// The WidgetBlackBoxWindow associated to the box
- Window* bbmWindow;
-
-
-
+
+ /// Set to true when the
+ /// window containing the widget is shown
+ bool bbmShown;
+ /// Contains the "nested" WidgetBlackBoxes,
+ /// i.e. if this WidgetBox is a Layout the ones
+ /// which are inserted into the layout
+ /// The list is updated by the method bbCreateWidgetOfInput
+ /// It is emptied when ?
+ std::vector<BlackBox::WeakPointer> bbmNestedWidgetBoxes;
};
//=================================================================
public: \
inline void bbUserCreateWidget(Widget* parent) \
{ \
- bbtkDebugMessageInc("kw",1,"**> Creating widget for [" \
- <<bbGetFullName()<<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("widget",1,"**> Creating widget" \
+ <<std::endl); \
CALLBACK(parent); \
- bbtkDebugMessageInc("kw",1,"<** Creating widget for [" \
- <<bbGetFullName()<<"]"<<std::endl); \
}
//======================================================================
/// Defines the bbUserOnShow method
#define BBTK_ON_SHOW_WIDGET(CALLBACK) \
public: \
- inline void bbUserOnShow() \
+ inline void bbUserOnShow() \
{ \
- bbtkDebugMessageInc("wx",1,"**> Showing [" \
- <<bbGetFullName()<<"]"<<std::endl); \
+ bbtkBlackBoxDebugMessage("widget",1,"**> Showing" \
+ <<std::endl); \
CALLBACK(); \
- bbtkDebugMessageInc("wx",1,"<** Showing [" \
- <<bbGetFullName()<<"]"<<std::endl); \
}
//======================================================================
Program: bbtk
Module: $RCSfile: bbtkWidgetBlackBox.txx,v $
Language: C++
- Date: $Date: 2009/05/19 10:19:23 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.5 $
=========================================================================*/
/* ---------------------------------------------------------------------
-#include "bbtkWidgetBlackBoxWindow.h"
+//#include "bbtkWidgetBlackBoxWindow.h"
#include "bbtkBlackBoxOutputConnector.h"
template <class T>
void WidgetBlackBox<T>::bbUserSetDefaultValues()
{
- bbtkDebugMessage("widget",9,"WidgetBlackBox::bbUserSetDefaultValues()"<<std::endl);
- bbmWindow = 0;
+ bbtkBlackBoxDebugMessage("widget",9,"WidgetBlackBox::bbUserSetDefaultValues()"<<std::endl);
+ // bbmWindow = 0;
bbSetInputWinTitle(bbGetName());
bbSetInputWinWidth(800);
bbSetInputWinHeight(800);
template <class T>
void WidgetBlackBox<T>::bbUserInitializeProcessing()
{
+ bbmShown = false;
}
//=========================================================================
template <class T>
void WidgetBlackBox<T>::bbUserFinalizeProcessing()
{
- bbtkDebugMessage("widget",9,"==> WidgetBlackBox::bbUserFinalizeProcessing() ["<<bbGetFullName()<<"]"<<std::endl);
+ /*
+ std::cout << "****** WidgetBlackBox<T>::bbUserFinalizeProcessing()"<<std::endl;
+ bbtkBlackBoxDebugMessage("widget",9,"==> WidgetBlackBox::bbUserFinalizeProcessing() ["<<bbGetFullName()<<"]"<<std::endl);
if (bbGetWindow())
{
+ bool shown = bbGetWindow()->bbIsShown();
+ bbGetWindow()->bbDestroy();
+ bbSetWindow(0);
+
if (GetUseCount()==0)
- {
- if (bbGetWindow()->bbIsShown()) DecNbWindowsShown();
+ {
+ bbtkBlackBoxDebugMessage("widget",9,"**** HERE use count == 0"<<std::endl);
+ if (shown) DecNbWindowsShown();
DecNbWindowsAlive();
}
- bbGetWindow()->bbDestroy();
- bbSetWindow(0);
+
}
- bbtkDebugMessage("widget",9,"<== WidgetBlackBox::bbUserFinalizeProcessing() ["<<bbGetFullName()<<"]"<<std::endl);
+ bbtkBlackBoxDebugMessage("widget",9,"<== WidgetBlackBox::bbUserFinalizeProcessing() ["<<bbGetFullName()<<"]"<<std::endl);
+ */
}
//=========================================================================
if ( ! bbIsOutputWidgetConnected() )
{
// create the Window if does not exist
- if ( bbGetWindow() == 0)
+ if (!bbWindowIsCreated())
{
- bbtkDebugMessage("widget",2,
+ bbtkBlackBoxDebugMessage("widget",2,
"-> Creating the window"
<<std::endl);
+ // Reinitializing
+ bbSetShown(false);
+ bbmNestedWidgetBoxes.clear();
+
// this->InitWindowManagerIfNeeded();
// If is a Dialog requested
if ( bbGetInputWinDialog() )
{
- bbtkDebugMessage("process",2,
+ bbtkBlackBoxDebugMessage("widget",2,
" Input WinDialog set to true : creating a Dialog"
<<std::endl);
this->bbCreateDialogWindow();
// Input WinDialog set to false : creating a Frame
else
{
- bbtkDebugMessage("process",2,
+ bbtkBlackBoxDebugMessage("widget",2,
" Input WinDialog set to false : creating a Frame"
<<std::endl);
this->bbCreateFrameWindow();
}
}
+ /*
// Show the window
if ( !bbGetWindow() )
{
bbtkInternalError("Need to show the Window of widget "<<bbGetName()
<<" however was not created by apropriate cb");
}
- bbtkDebugMessage("widget",2,
+ */
+
+ /*
+ bbtkBlackBoxDebugMessage("widget",2,
"-> Showing the window"
<<std::endl);
- bbGetWindow()->bbShow();
+ // bbGetWindow()->bbShow();
+ this->bbShowWindow();
+ */
}
//
}
WidgetBlackBox<T>::bbCreateWidgetOfInput
(const std::string& in, typename WidgetBlackBox<T>::WidgetPointer parent)
{
+ bbtkBlackBoxDebugMessage("widget",2,"bbCreateWidgetOfInput("
+ <<in<<","<<parent<<")"
+ <<std::endl);
Widget* w = 0;
// If input is connected
BlackBoxInputConnector* c = bbGetInputConnectorMap().find(in)->second ;
wfrom->bbUserCreateWidget(parent);
// Get the widget created
w = wfrom->bbGetOutputWidget();
+ // Insert the box into the NestedWidgetBoxes list
+ bbmNestedWidgetBoxes.push_back(from);
}
return w;
}
}
//==================================================================
+ //==================================================================
+ template <class T>
+ void WidgetBlackBox<T>::bbSetShown(bool b)
+ {
+ if (b==bbmShown) return;
+
+ bbtkBlackBoxDebugMessage("widget",5,"WidgetBlackBox::bbSetShown("
+ <<b<<")"
+ <<std::endl);
+
+ bbmShown = b;
+ if (b)
+ {
+ this->bbUserOnShow();
+ }
+ // Have to propagate to nested widgets
+ std::vector<BlackBox::WeakPointer>::const_iterator i;
+ for (i =bbmNestedWidgetBoxes.begin();
+ i!=bbmNestedWidgetBoxes.end();
+ ++i)
+ {
+ if (!i->expired()) i->lock()->bbSetShown(b);
+ }
+
+ }
+ //==================================================================
+
+ //==================================================================
+ template <class T>
+ bool WidgetBlackBox<T>::bbIsShown()
+ {
+ return bbmShown;
+ }
+ //==================================================================
+
+ /*
//==================================================================
template <class T>
void WidgetBlackBox<T>::bbShowWindow()
{
- bbtkDebugMessageInc("widget",1,"=> WidgetBlackBox::bbShowWindow() ["
+ bbtkBlackBoxDebugMessage("widget",1,"=> WidgetBlackBox::bbShowWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
if (bbGetWindow()!=0) bbGetWindow()->bbShow();
- bbtkDebugMessageDec("widget",2,"<= WidgetBlackBox::bbShowWindow() ["
+ bbtkBlackBoxDebugMessage("widget",1,"<= WidgetBlackBox::bbShowWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
}
//==================================================================
template <class T>
void WidgetBlackBox<T>::bbHideWindow()
{
- bbtkDebugMessageInc("widget",1,"=> WidgetBlackBox::bbHideWindow() ["
+ bbtkBlackBoxDebugMessage("widget",1,"=> WidgetBlackBox::bbHideWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
if (bbGetWindow()!=0) bbGetWindow()->bbHide();
- bbtkDebugMessageDec("widget",2,"<= WidgetBlackBox::bbHideWindow() ["
+ bbtkBlackBoxDebugMessage("widget",1,"<= WidgetBlackBox::bbHideWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
}
//==================================================================
template <class T>
void WidgetBlackBox<T>::bbCloseWindow()
{
- bbtkDebugMessageInc("widget",1,"=> WidgetBlackBox::bbCloseWindow() ["
+ bbtkBlackBoxDebugMessage("widget",1,"=> WidgetBlackBox::bbCloseWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
if (bbGetWindow()!=0) bbGetWindow()->bbDestroy();
- bbtkDebugMessageDec("widget",2,"<= WidgetBlackBox::bbCloseWindow() ["
+ bbtkBlackBoxDebugMessage("widget",1,"<= WidgetBlackBox::bbCloseWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
}
//==================================================================
return false;
}
//==================================================================
-
+ */
}//namespace bbtk
Program: bbtk
Module: $RCSfile: bbtkWidgetBlackBoxWindow.txx,v $
Language: C++
- Date: $Date: 2009/05/19 10:19:23 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.3 $
=========================================================================*/
/* ---------------------------------------------------------------------
bbtkDebugMessage("widget",9,
"WidgetBlackBoxWindow::~WidgetBlackBoxWindow() "
<<this<<std::endl);
+ std::cout << "**** WidgetBlackBoxWindow::~WidgetBlackBoxWindow() "
+ <<this<<std::endl;
bbHide();
if (!mBox.expired())
{
template <class W>
void WidgetBlackBoxWindow<W>::bbDestroy()
{
+ /*
if (mBox.expired()) return;
bbtkDebugMessage("widget",9,"WidgetBlackBoxWindow::bbDestroy() ["
<<mBox.lock()->bbGetName()<<"]"<<std::endl);
bbHide();
mBox.lock()->DecNbWindowsAlive();
mBox.lock()->bbSetWindow(0);
+ */
}
//=========================================================================
Program: bbtk
Module: $RCSfile: bbtkWx.cxx,v $
Language: C++
- Date: $Date: 2009/05/19 10:19:23 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.15 $
=========================================================================*/
/* ---------------------------------------------------------------------
//=========================================================================
static WxApp* mgWxApp = 0;
static wxWindow* mgTopWindow = 0;
- static wxWindow* mgTopWindowParent = 0;
- static bool mgAutoDestroyTopWindow = true;
static int mgNbWindowsAlive = 0;
- static int mgNbWindowsShown = 0;
//=========================================================================
-
+
//=========================================================================
// BBTKWXSIG
static Wx::Signal_type mgWxSignal;
bbtkDebugMessage("wx",1," --> Creating bbtk wxApp"<<std::endl);
mgWxApp = new WxApp;
wxApp::SetInstance(mgWxApp);
- //int argc = 0;
- //wxEntry(argc,0);
wxInitialize();
}
}
{
if (mgWxApp!= 0)
{
- bbtkDebugMessage("wx",1," --> Destructing bbtk WxApp"<<std::endl);
+ // bbtkDebugMessage("wx",1," --> Destructing bbtk WxApp"<<std::endl);
//delete mgWxApp;
// mgWxApp = 0;
// Uninit wx
}
//=========================================================================
- //=========================================================================
- void Wx::SetTopWindowParent(wxWindow* w)
- {
- if (mgTopWindowParent != 0)
- {
- bbtkGlobalError("Wx::SetTopWindowParent : top window parent != 0");
- }
- mgTopWindowParent = w;
- }
- //=========================================================================
-
- //=========================================================================
- void Wx::CreateTopWindowIfNeeded()
- {
- if (mgTopWindow!=0) return;
- bbtkDebugMessage("wx",1," --> Creating bbtk top window"<<std::endl);
-
- CreateWxAppIfNeeded();
-
- wxWindow* top =
- new wxFrame(mgTopWindowParent,
- -1,
- _T("TOP BBTK FRAME (YOU SHOULD NOT SEE ME !!)"));
- top->Hide();
-
- //if (mgTopWindowParent==0)
- Wx::SetTopWindow(top);
- }
- //=========================================================================
//=========================================================================
- void Wx::DestroyTopWindowIfNeeded()
+ void Wx::ProcessPendingEvents()
{
- if ( (mgNbWindowsAlive==0) &&
- (mgAutoDestroyTopWindow) &&
- (mgTopWindow != 0))
+ /*
+ if (Wx::GetTopWindow() != 0)
{
- bbtkDebugMessage("wx",1," --> Destructing bbtk top window"<<std::endl);
- mgTopWindow->Close();
- mgTopWindow = 0;
-
- DestroyWxAppIfNeeded();
+ Wx::GetTopWindow()->DestroyChildren();
}
- }
- //=========================================================================
-
- //=========================================================================
- void Wx::LoopUntilAllWindowsClose()
- {
- int i = 0;
- while (mgTopWindow != 0)
- {
- if (i % 100 == 0)
- {
- bbtkDebugMessage("wx",2,"Wx::Loop "<<i << std::endl);
- }
- i++;
- wxMilliSleep(10);
+ */
- }
+ /*
+ wxApp* a = (wxApp*)wxApp::GetInstance();
+ if (a==0) return;
+
+ std::cout << "$$$$$$$$$$$$$$ PROCESS PENDING "<<std::endl;
+ while (a->Pending())
+ a->Dispatch();
+ std::cout << "$$$$$$$$$$$$$$ PROCESS PENDING DONE"<<std::endl;
+ */
}
- //=========================================================================
+
//=========================================================================
wxWindow* Wx::GetTopWindow()
{
- Wx::CreateTopWindowIfNeeded();
return mgTopWindow;
}
//=========================================================================
- //=========================================================================
- bool Wx::TopWindowExists()
- {
- return (mgTopWindow!=0);
- }
- //=========================================================================
// BBTKWXSIG
//=========================================================================
//=========================================================================
// \BBTKWXSIG
- //=========================================================================
- void Wx::SetAutoDestroyTopWindow(bool b)
- {
- mgAutoDestroyTopWindow = b;
- }
- //=========================================================================
//=========================================================================
void Wx::SetTopWindow(wxWindow* w)
{
if ( mgTopWindow )
{
- bbtkGlobalError("wx::SetTopWindow : top window already set !");
+ bbtkGlobalError("Wx::SetTopWindow : top window already set !");
}
- mgTopWindow = w;
+ //mgTopWindow = w;
}
//=========================================================================
bbtkDebugMessage("wx",2,"* Number of windows alive = "<<mgNbWindowsAlive
<<std::endl);
- DestroyTopWindowIfNeeded();
- // BBTKWXSIG
- mgWxSignal();
- // \BBTKWXSIG
- }
- //=========================================================================
-
- //=========================================================================
- void Wx::IncNbWindowsShown()
- {
- mgNbWindowsShown++;
- bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
- <<std::endl);
- // BBTKWXSIG
- mgWxSignal();
- // \BBTKWXSIG
- }
- //=========================================================================
-
- //=========================================================================
- void Wx::DecNbWindowsShown()
- {
- mgNbWindowsShown--;
- bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
- <<std::endl);
-
- // DestroyTopWindowIfNeeded();
-
// BBTKWXSIG
mgWxSignal();
// \BBTKWXSIG
}
//=========================================================================
-
//=========================================================================
int Wx::GetNbWindowsAlive()
{
//=========================================================================
bool Wx::IsSomeWindowAlive()
{
- return (mgNbWindowsAlive>0);
- }
- //=========================================================================
-
-
- //=========================================================================
- int Wx::GetNbWindowsShown()
- {
- return mgNbWindowsShown;
- }
- //=========================================================================
-
- //=========================================================================
- bool Wx::IsSomeWindowShown()
- {
- return (mgNbWindowsShown>0);
+ return (mgNbWindowsAlive!=0);
}
//=========================================================================
//mCursor = new wxBusyCursor;
}
}
+ //=========================================================================
+ //=========================================================================
Wx::BusyCursor::~BusyCursor()
{
if (mCursor)
}
//=========================================================================
- /*
- //=========================================================================
- void Wx::ResetCursor()
- {
- if (!TopWindowExists()) return;
- bbtkDebugMessage("wx",9,"Wx::ResetCursor()"<<std::endl);
- while (wxIsBusy()) ::wxEndBusyCursor();
- }
- //=========================================================================
- //=========================================================================
- void Wx::BeginBusyCursor()
- {
- if (!TopWindowExists()) return;
- bbtkDebugMessage("wx",9,"Wx::BeginBusyCursor()"<<std::endl);
- ::wxBeginBusyCursor();
- }
- //=========================================================================
- //=========================================================================
- void Wx::EndBusyCursor()
- {
- if (!TopWindowExists()) return;
- bbtkDebugMessage("wx",9,"Wx::EndBusyCursor()"<<std::endl);
- ::wxEndBusyCursor();
- }
- //=========================================================================
- */
+
} // namespace bbtk
//=========================================================================
namespace bbtk
{
+ //=========================================================================
Wx::BusyCursor::BusyCursor()
{
}
Program: bbtk
Module: $RCSfile: bbtkWx.h,v $
Language: C++
- Date: $Date: 2009/04/08 07:56:11 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.11 $
=========================================================================*/
/* ---------------------------------------------------------------------
typedef Signal_type::slot_function_type Slot_function_type;
// \BBTKWXSIG
- /*
- static void ResetCursor();
- static void BeginBusyCursor();
- static void EndBusyCursor();
- */
-
- static void LoopUntilAllWindowsClose();
-
class BusyCursor
{
public:
wxBusyCursor* mCursor;
};
- static void SetTopWindowParent(wxWindow*);
- static void SetAutoDestroyTopWindow(bool);
-
- /// Returns the creation time parent of all bbtk windows
- /// (window can be reparented after creation)
- static wxWindow* GetTopWindow();
- static bool TopWindowExists();
+ static void ProcessPendingEvents();
+ /// Sets the parent of all bbtk windows
+ static void SetTopWindow(wxWindow*);
+ /// Returns the parent of all bbtk windows
+ static wxWindow* GetTopWindow();
+
+
static void IncNbWindowsAlive();
static void DecNbWindowsAlive();
static int GetNbWindowsAlive();
static bool IsSomeWindowAlive();
- static void IncNbWindowsShown();
- static void DecNbWindowsShown();
- static int GetNbWindowsShown();
- static bool IsSomeWindowShown();
-
- // BBTKWXSIG
+ // BBTKWXSIG
static void AddSignalObserver(Slot_function_type);
// \BBTKWXSIG
+
private:
static void CreateWxAppIfNeeded();
static void DestroyWxAppIfNeeded();
- static void CreateTopWindowIfNeeded();
- static void DestroyTopWindowIfNeeded();
-
- /// Sets the creation time parent of all bbtk windows
- static void SetTopWindow(wxWindow*);
}; // struct Wx
//==================================================================
Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.cxx,v $
Language: C++
- Date: $Date: 2009/05/19 10:19:23 $
- Version: $Revision: 1.40 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.41 $
=========================================================================*/
/* ---------------------------------------------------------------------
-
+
//=========================================================================
- // WxBlackBoxDialog
+ // WxFrame
//=========================================================================
+ //==================================================================
+ class WxFrame : public wxFrame
+ {
+ public:
+ WxFrame(WxBlackBox::Pointer b,
+ wxWindow *parent,
+ wxString title,
+ wxSize size);
+ ~WxFrame();
+ void OnCloseWindow(wxCloseEvent& event);
+
+
+ WxBlackBox::WeakPointer mBox;
+ DECLARE_EVENT_TABLE();
+
+ };
+
+ BEGIN_EVENT_TABLE(WxFrame, wxFrame)
+ // EVT_CLOSE(WxFrame::OnCloseWindow)
+ END_EVENT_TABLE();
+ //==================================================================
+
+ //==================================================================
+ WxFrame::WxFrame(WxBlackBox::Pointer b,
+ wxWindow *parent,
+ wxString title,
+ wxSize size)
+ :
+ wxFrame( parent,
+ -1,
+ title,
+ wxDefaultPosition,
+ size,
+ wxRESIZE_BORDER |
+ wxSYSTEM_MENU |
+ wxCLOSE_BOX |
+ wxMAXIMIZE_BOX |
+ wxMINIMIZE_BOX |
+ wxCAPTION
+ ),
+ mBox(b)
+ {
+ bbtkDebugMessage("widget",9,"["<<b->bbGetName()<<"] WxFrame()"
+ <<std::endl);
+ Wx::IncNbWindowsAlive();
+ b->bbSetWindow(this);
+ // Insert the widget into the window
+ wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+ b->bbUserCreateWidget(this);
+ wxWindow* widget = b->bbGetOutputWidget();
+ sizer->Add( widget, 1, wxALL|wxGROW, 2);
+ SetSizer(sizer);
+ Layout();
+ }
+ //==================================================================
+ //==================================================================
+ WxFrame::~WxFrame()
+ {
+ if (mBox.lock())
+ bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
+ <<"] $$$$$$$$$$$$$$$$$$$ ~WxFrame()"
+ <<std::endl);
+ else
+ bbtkDebugMessage("widget",9,"[DEAD] $$$$$$$$$$$$$$$$$$$$$ ~WxFrame()"<<std::endl);
+ //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
+ if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ Wx::DecNbWindowsAlive();
+ }
+ //==================================================================
+ //==================================================================
+ void WxFrame::OnCloseWindow(wxCloseEvent& event)
+ {
+ if (mBox.lock())
+ bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
+ <<"] $$$$$$$$$$$$$$$ WxFrame::OnCloseWindow()"<<std::endl);
+ else
+ bbtkDebugMessage("widget",9,"[DEAD] WxFrame::OnCloseWindow()"
+ <<std::endl);
+ if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ Wx::DecNbWindowsAlive();
+
+ bbtkDebugMessage("widget",9,
+ "$$$$$$$$$$$$$$$ Destroy !!!"<<std::endl);
+ // this->Destroy();
+ }
+ //==================================================================
+
+
+
+
+
+ //=========================================================================
+ // WxDialog
+ //=========================================================================
+
+ //==================================================================
+ // Dialog window which is modal
+ class BBTK_EXPORT WxDialog : public wxDialog
+ {
+ public:
+ WxDialog(WxBlackBox::Pointer box,
+ wxWindow *parent,
+ wxString title,
+ wxSize size);
+ ~WxDialog();
+ void OnCloseWindow(wxCloseEvent& event);
+
+
+ WxBlackBox::WeakPointer mBox;
+ DECLARE_EVENT_TABLE();
+
+ };
+
+ BEGIN_EVENT_TABLE(WxDialog, wxDialog)
+ EVT_CLOSE(WxDialog::OnCloseWindow)
+ END_EVENT_TABLE();
+ //==================================================================
+
//=========================================================================
- WxBlackBoxDialog::WxBlackBoxDialog(WxBlackBox::Pointer box,
- wxWindow *parent,
- wxString title,
- wxSize size)
+ WxDialog::WxDialog(WxBlackBox::Pointer b,
+ wxWindow *parent,
+ wxString title,
+ wxSize size)
:
wxDialog( parent,
-1,
wxMINIMIZE_BOX |
wxCAPTION
),
- Parent(box)
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxDialog::WxBlackBoxDialog("<<
- bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
- <<title<<",size)"<<std::endl);
- // Insert the widget into the window
- wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
- // Create the widget
- box->bbCreateWidgetAndEventHandler(this);
- wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget();
- sizer->Add( widget, 1, wxALL|wxEXPAND, 2);
- //SetAutoLayout(true);
- SetSizer(sizer);
- Layout();
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxDialog::bbShow()
- {
- if (bbIsShown()) return;
- bbtkDebugMessage("wx",5,"WxBlackBoxDialog::bbShow() ["
- <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
- Parent::bbShow();
- Show(false);
- SetReturnCode( wxDialog::ShowModal() );
- bbDestroy();
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxDialog::bbHide()
+ mBox(b)
{
- bbtkDebugMessage("wx",9,"WxBlackBoxDialog::bbHide()"<<std::endl);
- Parent::bbHide();
- Hide();
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxDialog::bbDestroy()
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxDialog::bbDestroy()"<<std::endl);
- wxDialog::Destroy();
- }
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxDialog::~WxBlackBoxDialog()
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxDialog::~WxBlackBoxDialog()"
+ bbtkDebugMessage("widget",9,"WxDialog::WxDialog ["<<b->bbGetName()<<"]"
<<std::endl);
- }
- //=========================================================================
-
-
-
-
-
- //=========================================================================
- // WxBlackBoxFrame
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxFrame::WxBlackBoxFrame(WxBlackBox::Pointer box,
- wxWindow *parent,
- wxString title,
- wxSize size)
- : wxFrame( parent,
- -1,
- title,
- wxDefaultPosition,
- size,
- wxRESIZE_BORDER |
- wxSYSTEM_MENU |
- wxCLOSE_BOX |
- wxMAXIMIZE_BOX |
- wxMINIMIZE_BOX |
- wxCAPTION
- ),
- Parent(box)
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxFrame::WxBlackBoxFrame("<<
- bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
- <<title<<",size)"<<std::endl);
+ Wx::IncNbWindowsAlive();
+ b->bbSetWindow(this);
// Insert the widget into the window
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
- box->bbCreateWidgetAndEventHandler(this);
- wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget();
- wxFrame* frame = (wxFrame*)this;
+ b->bbUserCreateWidget(this);
+ wxWindow* widget = b->bbGetOutputWidget();
sizer->Add( widget, 1, wxALL|wxGROW, 2);
- // frame->SetAutoLayout(true);
- frame->SetSizer(sizer);
- //frame->Fit();
- frame->Layout();
- }
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxFrame::~WxBlackBoxFrame()
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxFrame::~WxBlackBoxFrame()"
- <<std::endl);
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxFrame::bbShow()
- {
- if (bbIsShown()) return;
- bbtkDebugMessage("wx",5,"WxBlackBoxFrame::bbShow("
- <<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
- Parent::bbShow();
- wxFrame::Show();
- // This Update is ** MANDATORY **
- // to synchronize wxvtkRenderWindowInteractor objects
- // (force wx objects creation **NOW**)
-
-
-#if defined(_WIN32)
- wxFrame::Refresh();
-#endif
-
- wxFrame::Update();
- wxFrame::SetFocus();
- // if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow();
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxFrame::bbHide()
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxFrame::bbHide()"<<std::endl);
- Parent::bbHide();
- wxFrame::Hide();
- if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnHide();
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxFrame::bbDestroy()
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxFrame::bbDestroy()"<<std::endl);
- wxFrame::Destroy();
- }
- //=========================================================================
-
-
-
- //=========================================================================
- // WxBlackBoxWidgetEventHandler
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxWidgetEventHandler::
- WxBlackBoxWidgetEventHandler( WxBlackBox::Pointer box,
- wxWindow *widget )
- :
- mBox(box),
- mWindow(widget)
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::WxBlackBoxWidgetEventHandler("<<mBox.lock()->bbGetFullName()<<")"<<std::endl);
-
- mBox.lock()->bbSetWidgetEventHandler(this);
-
- Connect ( mWindow->GetId(),
- wxEVT_DESTROY,
- (wxObjectEventFunction)
- (void (wxEvtHandler::*)(wxWindowDestroyEvent& c))
- &WxBlackBoxWidgetEventHandler::OnWindowDestroy );
-
- mWindow->PushEventHandler(this);
-
- }
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler()
- {
- bbtkDebugMessage("wx",9,
- "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler() ["
- <<std::endl);
-
-
- Disconnect ( mWindow->GetId() );
-
- if (mBox.expired()) return;
- bbtkDebugMessage("wx",9,
- "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler() ["
- <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
-
- mBox.lock()->bbSetWidgetEventHandler(0);
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxWidgetEventHandler::OnWindowDestroy(wxWindowDestroyEvent&)
- {
- bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() []"<<std::endl);
- if (mBox.expired()) return;
- bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() alive ["
- <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
- mBox.lock()->bbSetOutputWidget(0);
+ SetSizer(sizer);
+ Layout();
}
//=========================================================================
+ //==================================================================
+ WxDialog::~WxDialog()
+ {
+ bbtkDebugMessage("widget",9,"WxDialog::~WxDialog()"<<std::endl);
+ //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
+ // if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ // Wx::DecNbWindowsAlive();
+ }
+ //==================================================================
+ //==================================================================
+ void WxDialog::OnCloseWindow(wxCloseEvent& event)
+ {
+ bbtkDebugMessage("widget",9,"WxDialog::OnCloseWindow()"<<std::endl);
+ if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ Wx::DecNbWindowsAlive();
+ this->Destroy();
+ }
+ //==================================================================
- //=========================================================================
+ //=========================================================================
// WxBlackBox
//=========================================================================
//=========================================================================
void WxBlackBox::bbUserSetDefaultValues()
{
- bbtkDebugMessage("Kernel",9,"WxBlackBox::bbUserSetDefaultValues()"<<std::endl);
- bbSetWidgetEventHandler(0);
+ bbtkBlackBoxDebugMessage("widget",5,"WxBlackBox::bbUserSetDefaultValues()"<<std::endl);
+ // bbSetWidgetEventHandler(0);
+ bbmWindow = 0;
}
//=========================================================================
//=========================================================================
void WxBlackBox::bbUserFinalizeProcessing()
{
- bbtkDebugMessage("wx",9,"WxBlackBox::bbUserFinalizeProcessing()"<<std::endl);
- if (bbGetWidgetEventHandler()!=0)
- {
- bbtkDebugMessage("wx",9,"Deleting Widget Event Handler"<<std::endl);
- delete bbGetWidgetEventHandler();
- }
-
+ bbtkBlackBoxDebugMessage("widget",5,"==> WxBlackBox::bbUserFinalizeProcessing()"<<std::endl);
+ bbDestroyWindow();
+ bbtkBlackBoxDebugMessage("widget",5,"<== WxBlackBox::bbUserFinalizeProcessing()"<<std::endl);
}
//==================================================================
/// Callback for creating a Dialog window (modal)
void WxBlackBox::bbCreateDialogWindow()
{
- WxBlackBoxDialog* w = 0;
- w = new WxBlackBoxDialog( GetThisPointer<WxBlackBox>(),
- Wx::GetTopWindow(),
- std2wx( bbGetInputWinTitle()
- + " - bbtk (c) CREATIS LRMN"),
- wxSize( bbGetInputWinWidth() ,
- bbGetInputWinHeight() ));
- w->Show(true);
- }
+ bbtkBlackBoxDebugMessage("widget",3,
+ "==> WxBlackBox::bbCreateDialogWindow() - parent = "
+ <<Wx::GetTopWindow()
+ <<std::endl);
+ WxDialog* w = 0;
+ w = new WxDialog( GetThisPointer<WxBlackBox>(),
+ Wx::GetTopWindow(),
+ std2wx( bbGetInputWinTitle()
+ + " - bbtk (c) CREATIS-LRMN"),
+ wxSize( bbGetInputWinWidth() ,
+ bbGetInputWinHeight() ) );
+ w->Show(false);
+ // w->ShowModal();
+ }
+ //=========================================================================
+
//==================================================================
//==================================================================
/// Callback for creating a Frame window
void WxBlackBox::bbCreateFrameWindow()
{
- WxBlackBoxFrame* w = 0;
- w = new WxBlackBoxFrame( GetThisPointer<WxBlackBox>(),
- Wx::GetTopWindow(),
- std2wx( bbGetInputWinTitle()
- + " - bbtk (c) CREATIS LRMN"),
- wxSize( bbGetInputWinWidth() ,
- bbGetInputWinHeight() ) );
+ bbtkBlackBoxDebugMessage("widget",3,
+ "==> WxBlackBox::bbCreateFrameWindow() - parent = "
+ <<Wx::GetTopWindow()
+ <<std::endl);
+ WxFrame* w = 0;
+ w = new WxFrame( GetThisPointer<WxBlackBox>(),
+ Wx::GetTopWindow(),
+ std2wx( bbGetInputWinTitle()
+ + " - bbtk (c) CREATIS-LRMN"),
+ wxSize( bbGetInputWinWidth() ,
+ bbGetInputWinHeight() ) );
w->Show();
+ }
+ //==================================================================
+
+ //==================================================================
+ void WxBlackBox::bbSetWindow(wxWindow* w)
+ {
+ bbtkBlackBoxDebugMessage("widget",9,"==> WxBlackBox::bbSetWindow("<<w<<")"<<std::endl);
+ if ((bbmWindow != 0)&&(w!=0))
+ {
+ std::cout << "ERRRRRRRROOOOR"<<std::endl;
+ }
+ bbmWindow = w;
}
//==================================================================
-
-
-
- //=========================================================================
- void WxBlackBox::bbCreateWidgetAndEventHandler(wxWindow* parent)
+ //==================================================================
+ void WxBlackBox::bbShowWindow()
{
- if (bbGetOutputWidget()==0)
+ if ((bbmWindow) && (!bbIsShown()))
{
- this->bbUserCreateWidget(parent);
- }
- // If Event Handler for the widget does not exist or is obsolete:
- // create it
- if (bbGetOutputWidget()!=0)
- {
- if (bbGetWidgetEventHandler()==0)
+ bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbShowWindow()"
+ <<std::endl);
+ if (bbGetInputWinDialog())
{
- bbtkDebugMessage("wx",3,
- "-> No widget event handler : creating one"
- <<std::endl);
- new WxBlackBoxWidgetEventHandler(GetThisPointer<WxBlackBox>(),
- bbGetOutputWidget());
+ ((WxDialog*)bbmWindow)->ShowModal();
}
- else if ( ! bbGetWidgetEventHandler()->IsHandlerOf
- ( bbGetOutputWidget() ) )
+ else
{
- bbtkDebugMessage("wx",3,
- "-> Obsolete widget event handler : re-creating one"
- <<std::endl);
- delete bbGetWidgetEventHandler();
- new WxBlackBoxWidgetEventHandler(GetThisPointer<WxBlackBox>(),
- bbGetOutputWidget());
- }
- // Sets the name of the wxWindow to the input WinTitle
- bbGetOutputWidget()->SetName(bbtk::std2wx(bbGetInputWinTitle()));
+ bbGetWindow()->Show();
+ bbSetShown(true);
+ }
+ }
+ }
+ //==================================================================
+
+ //==================================================================
+ void WxBlackBox::bbDestroyWindow()
+ {
+ bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
+ if (bbGetWindow()!=NULL)
+ {
+ // wxWindow* w = bbGetWindow();
+ //bbSetWindow(0);
+ // WE SHOULD DESTROY THE WINDOW WITH THE Close METHOD
+ // HOWEVER I
+ //w->Close(true);
+ //
+ delete bbGetWindow();
+ bbSetShown(false);
}
-
-
+ bbtkBlackBoxDebugMessage("widget",3,"<== WxBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
+
}
- //=========================================================================
-
-
- //==================================================================
- // void WxBlackBox::InitWindowManagerIfNeeded() { Wx::
- void WxBlackBox::IncNbWindowsAlive() { Wx::IncNbWindowsAlive(); }
- void WxBlackBox::DecNbWindowsAlive() { Wx::DecNbWindowsAlive(); }
- int WxBlackBox::GetNbWindowsAlive() { return Wx::GetNbWindowsAlive(); }
- bool WxBlackBox::IsSomeWindowAlive() { return Wx::IsSomeWindowAlive(); }
-
- void WxBlackBox::IncNbWindowsShown() { Wx::IncNbWindowsShown(); }
- void WxBlackBox::DecNbWindowsShown() { Wx::DecNbWindowsShown(); }
- int WxBlackBox::GetNbWindowsShown() { return Wx::GetNbWindowsShown(); }
- bool WxBlackBox::IsSomeWindowShown() { return Wx::GetNbWindowsShown(); }
- //==================================================================
-
+ //==================================================================
+
+
}//namespace bbtk
Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.h,v $
Language: C++
- Date: $Date: 2009/05/19 10:19:23 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.29 $
========================================================================*/
#define __bbtkWxBlackBox_h__
-#include "bbtkWx.h"
+
#include "bbtkWidgetBlackBox.h"
+#include "bbtkWx.h"
namespace bbtk
{
-
-
-
-
- //==================================================================
- // Forward declaration of the widget event handler class
- class WxBlackBoxWidgetEventHandler;
- //==================================================================
-
+
//==================================================================
/// Widget black boxes
virtual void bbCreateFrameWindow();
//==================================================================
-
-
- //==================================================================
- // virtual void InitWindowManagerIfNeeded();
- virtual void IncNbWindowsAlive();
- virtual void DecNbWindowsAlive();
- virtual int GetNbWindowsAlive();
- virtual bool IsSomeWindowAlive();
-
- virtual void IncNbWindowsShown();
- virtual void DecNbWindowsShown();
- virtual int GetNbWindowsShown();
- virtual bool IsSomeWindowShown();
- //==================================================================
+
+ //==================================================================
+ wxWindow* bbGetWindow() { return bbmWindow; }
+ void bbSetWindow(wxWindow*) ;
+ bool bbWindowIsCreated() { return (bbGetWindow() != 0); }
+ //==================================================================
-
//==================================================================
- void bbCreateWidgetAndEventHandler(wxWindow* parent);
+ virtual void bbShowWindow();
+ //==================================================================
+
//==================================================================
-
+ virtual void bbDestroyWindow();
//==================================================================
private:
- /// friendship
- friend class WxBlackBoxWidgetEventHandler;
- /// Sets the Widget Event Handler
- inline void bbSetWidgetEventHandler(WxBlackBoxWidgetEventHandler* w)
- { bbmWidgetEventHandler = w; }
- /// Gets the Widget Event Handler
- inline WxBlackBoxWidgetEventHandler* bbGetWidgetEventHandler()
- { return bbmWidgetEventHandler; }
- /// The WxBlackBoxWidgetEventHandler associated to the box
- WxBlackBoxWidgetEventHandler* bbmWidgetEventHandler;
+
+ wxWindow* bbmWindow;
+
};
//=================================================================
//=================================================================
// WxBlackBoxDescriptor declaration
- //
class WxBlackBoxDescriptor : public WidgetBlackBoxDescriptor<wxWindow>
BBTK_BEGIN_DESCRIBE_BLACK_BOX_BODY(WxBlackBox);
BBTK_NAME("WxBlackBox");
- //==================================================================
- // Dialog window which is modal
- class BBTK_EXPORT WxBlackBoxDialog : public wxDialog,
- public WidgetBlackBoxWindow<wxWindow>
- {
- public:
- typedef WidgetBlackBoxWindow<wxWindow> Parent;
- WxBlackBoxDialog(WxBlackBox::Pointer box,
- wxWindow *parent, wxString title, wxSize size);
- ~WxBlackBoxDialog();
- void bbShow();
- void bbHide();
- void bbDestroy();
- bool IsDialog() { return true; }
- bool IsFrame() { return false; }
- wxDialog* bbGetDialog() { return this; }
- };
- //==================================================================
-
- //==================================================================
- // Frame window which is not modal
- class BBTK_EXPORT WxBlackBoxFrame : public wxFrame,
- public WidgetBlackBoxWindow<wxWindow>
- {
- public:
- typedef WidgetBlackBoxWindow<wxWindow> Parent;
- WxBlackBoxFrame(WxBlackBox::Pointer box,
- wxWindow *parent, wxString title, wxSize size);
- ~WxBlackBoxFrame();
- void bbShow();
- void bbHide();
- void bbDestroy();
- bool IsDialog() { return false; }
- bool IsFrame() { return true; }
- wxFrame* bbGetFrame() { return this; }
- };
- //==================================================================
-
-
-
- //=================================================================
- // Handles the destroy events of a widget associated to a WxBlackBox
- // in order to signal the widget death to its associated box
- class BBTK_EXPORT WxBlackBoxWidgetEventHandler : public wxEvtHandler
- {
- public:
- /// Ctor with the box and widget
- WxBlackBoxWidgetEventHandler( WxBlackBox::Pointer box, wxWindow *widget );
- /// Dtor
- ~WxBlackBoxWidgetEventHandler();
- /// Returns true iff is the handler for that window
- bool IsHandlerOf( wxWindow* w ) { return mWindow == w; }
- // wxWindow* GetWxWindow() { return mWindow; }
- /// Method processing the destroy event of the widget
- void OnWindowDestroy(wxWindowDestroyEvent&);
- //
- //bool IsDead() { return mDead; }
-
- private:
- WxBlackBox::WeakPointer mBox;
- wxWindow* mWindow;
- //bool mDead;
- };
- //=================================================================
-
-
-
} //namespace bbtk
#endif //__bbtkWxBlackBox_h__
Program: bbtk
Module: $RCSfile: bbtkWxGUIConsole.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:15 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2009/05/28 08:12:06 $
+ Version: $Revision: 1.16 $
=========================================================================*/
/* ---------------------------------------------------------------------
// Set the parent window of all bbtk windows as a child of this
- bbtk::Wx::SetTopWindowParent(this);
+ // bbtk::Wx::SetTopWindowParent(this);
+ bbtk::Wx::SetTopWindow(this);
// Top Window Auto Destroys when no more black box window alive
// : this is the default
// bbtk::Wx::SetAutoDestroyTopWindow(true);
}
//================================================================
+ //================================================================
+ void WxGUIConsole::OnClose(wxCloseEvent& event)
+ {
+ bbtkDebugMessage("widget",9,"bbi::OnClose()"<<std::endl);
+ //Wx::SetWindowsHaveBeenDestroyedByParent();
+ //mInterpreter.reset();
+ wxWindowList& list = GetChildren();
+ wxWindowList::iterator iter;
+ for (iter = list.begin(); iter != list.end(); ++iter)
+ {
+ (*iter)->Close();
+ }
+ this->Destroy();
+ }
+ //================================================================
+
//================================================================
void WxGUIConsole::OnWxSignal()
{
- if ((!Wx::TopWindowExists())&&(!IsShown()))
+ if ((!bbtk::Wx::IsSomeWindowAlive())&&(!IsShown()))
{
bbtkDebugMessage("wx",2," --> bbtk top window destroyed and WxGUIConsole not shown => destructing"<<std::endl);
+ /*
+ wxWindowList& list = GetChildren();
+ wxWindowList::iterator iter;
+ for (iter = list.begin(); iter != list.end(); ++iter)
+ {
+ (*iter)->Close();
+ }
+ */
Close();
}
}
//================================================================
// Overloaded Show method to handle bbtk::Wx::TopWindow auto-destruction
+ // OBSOLETE !!!
bool WxGUIConsole::Show(bool show)
{
- bbtk::Wx::SetAutoDestroyTopWindow(!show);
+ // bbtk::Wx::SetAutoDestroyTopWindow(!show);
return wxFrame::Show(show);
}
//================================================================
//================================================================
BEGIN_EVENT_TABLE(WxGUIConsole, wxFrame)
+ EVT_CLOSE( WxGUIConsole::OnClose)
EVT_MENU(ID_Menu_Quit , WxGUIConsole::OnMenuQuit)
EVT_MENU(ID_Menu_About , WxGUIConsole::OnMenuAbout)
EVT_MENU(ID_Menu_EditConfig , WxGUIConsole::OnMenuEditConfig)
Program: bbtk
Module: $RCSfile: bbtkWxGUIConsole.h,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:15 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2009/05/28 08:12:07 $
+ Version: $Revision: 1.7 $
=========================================================================*/
/* ---------------------------------------------------------------------
// Overloaded Show method to handle bbtk::Wx::TopWindow auto-destruction
virtual bool Show(bool show = true);
+ void OnClose(wxCloseEvent& event);
+
private:
wxAuiManager m_mgr;
Program: bbtk
Module: $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
Language: C++
- Date: $Date: 2009/04/15 15:45:49 $
- Version: $Revision: 1.37 $
+ Date: $Date: 2009/05/28 08:12:07 $
+ Version: $Revision: 1.38 $
=========================================================================*/
/* ---------------------------------------------------------------------
#endif
// parent window of all bbtk windows will be a child of this
- Wx::SetTopWindowParent(this);
- // Add the method OnWxSignal as a Wx::Signal observer
+ // Wx::SetTopWindowParent(this);
+ Wx::SetTopWindow(this);
+ // Wx::SetAutoDestroyTopWindow(false);
+ // Add the method OnWxSignal as a Wx::Signal observer
//bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
//.PaneBorder(false));
//================================================================
WxGUIScriptingInterface::~WxGUIScriptingInterface()
{
+ bbtkDebugMessage("widget",9,"bbStudio::~bbStudio()"<<std::endl);
SavePerspective();
m_mgr.UnInit();
}
//================================================================
+ //================================================================
+ void WxGUIScriptingInterface::OnClose(wxCloseEvent& event)
+ {
+ bbtkDebugMessage("widget",9,"bbStudio::OnClose()"<<std::endl);
+ //Wx::SetWindowsHaveBeenDestroyedByParent();
+ //mInterpreter.reset();
+ wxWindowList& list = GetChildren();
+ wxWindowList::iterator iter;
+ for (iter = list.begin(); iter != list.end(); ++iter)
+ {
+ (*iter)->Close();
+ }
+ this->Destroy();
+ }
+ //================================================================
+
+
//================================================================
void WxGUIScriptingInterface::Open(const std::string& filename)
{
//================================================================
BEGIN_EVENT_TABLE(WxGUIScriptingInterface, wxFrame)
+ EVT_CLOSE( WxGUIScriptingInterface::OnClose)
EVT_MENU(ID_Menu_Quit, WxGUIScriptingInterface::OnMenuQuit)
EVT_MENU(ID_Menu_About, WxGUIScriptingInterface::OnMenuAbout)
EVT_MENU(ID_Menu_EditConfig, WxGUIScriptingInterface::OnMenuEditConfig)
Program: bbtk
Module: $RCSfile: bbtkWxGUIScriptingInterface.h,v $
Language: C++
- Date: $Date: 2009/04/15 15:45:49 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2009/05/28 08:12:07 $
+ Version: $Revision: 1.17 $
=========================================================================*/
/* ---------------------------------------------------------------------
void DoRegeneratePackageDoc(const std::string& pack);
void DoRegenerateBoxesLists();
+
+ void OnClose(wxCloseEvent& event);
private:
wxAuiManager m_mgr;
Interpreter::Pointer mInterpreter;
Program: bbtk
Module: $RCSfile: bbtkWxGUITextEditor.cxx,v $
Language: C++
- Date: $Date: 2009/04/15 15:45:49 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2009/05/28 08:12:07 $
+ Version: $Revision: 1.20 $
=========================================================================*/
/* ---------------------------------------------------------------------
SetSizer(sizer);
// parent window of all bbtk windows will be a child of this
- Wx::SetTopWindowParent(this);
+ // Wx::SetTopWindowParent(this);
+ Wx::SetTopWindow(this);
// Add the method OnWxSignal as a Wx::Signal observer
//bbtkAddWxSignalObserver(WxGUITextEditorWindow::OnWxSignal);
--- /dev/null
+author "laurent.guigues@creatis.insa-lyon.fr"
+description "Example of QLayoutSplit widget"
+category "example"
+
+load qt
+load std
+new QSlider s
+new QOutputText t
+connect s.Out t.In
+connect s.BoxChange t.BoxExecute
+set s.In 100
+set s.Min 10
+set s.Max 1000
+set s.WinHeight 100
+set s.WinWidth 100
+
+new QLayoutSplit l
+set l.Orientation Vertical
+connect s.Widget l.Widget1
+connect t.Widget l.Widget2
+new QSlider s2
+connect s2.Widget l.Widget3
+
+set l.Weight1 5
+set l.Weight2 1
+set l.Weight3 2
+
+exec l
Program: bbtk
Module: $RCSfile: bbvtkImagePlanes.cxx,v $
Language: C++
- Date: $Date: 2009/05/15 14:58:01 $
- Version: $Revision: 1.24 $
+ Date: $Date: 2009/05/28 08:12:16 $
+ Version: $Revision: 1.25 $
=========================================================================*/
/* ---------------------------------------------------------------------
};
//================================================================
- //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.24 $");
+ //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.25 $");
//================================================================
//---------------------------------------------------------------------
void ImagePlanes::bbUserFinalizeProcessing()
{
+
if (bbGetOutputPlaneX())
{
- bbGetOutputPlaneX()->SetInput(NULL);
- // if (mVtkCallback) bbGetOutputPlaneX()->RemoveObserver(mVtkCallback);
+
+ /*
+
+ bbGetOutputPlaneX()->RemoveObserver(mVtkCallback);
+ bbGetOutputPlaneY()->RemoveObserver(mVtkCallback);
+ bbGetOutputPlaneZ()->RemoveObserver(mVtkCallback);
+
+
bbGetOutputPlaneX()->Delete();
- }
- if (bbGetOutputPlaneY())
- {
- bbGetOutputPlaneY()->SetInput(NULL);
- // if (mVtkCallback) bbGetOutputPlaneY()->RemoveObserver(mVtkCallback);
bbGetOutputPlaneY()->Delete();
- }
- if (bbGetOutputPlaneZ())
- {
- bbGetOutputPlaneZ()->SetInput(NULL);
- // if (mVtkCallback) bbGetOutputPlaneZ()->RemoveObserver(mVtkCallback);
bbGetOutputPlaneZ()->Delete();
+ mVtkCallback->Delete();
+ */
+ //bbGetOutputPlaneX()->SetInput(NULL);
+ //bbGetOutputPlaneY()->SetInput(NULL);
+ //bbGetOutputPlaneZ()->SetInput(NULL);
+
}
- if (mVtkCallback)
- {
- // mVtkCallback->Delete();
- }
+
}
//---------------------------------------------------------------------
Program: bbtk
Module: $RCSfile: bbwxLayoutLine.cxx,v $
Language: C++
- Date: $Date: 2009/05/15 14:58:03 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2009/05/28 08:12:17 $
+ Version: $Revision: 1.9 $
=========================================================================*/
/* ---------------------------------------------------------------------
// when window is shown
void LayoutLine::OnShowWidget()
{
- bbUserOnShowWidget("Widget1");
- bbUserOnShowWidget("Widget2");
- bbUserOnShowWidget("Widget3");
- bbUserOnShowWidget("Widget4");
- bbUserOnShowWidget("Widget5");
- bbUserOnShowWidget("Widget6");
- bbUserOnShowWidget("Widget7");
- bbUserOnShowWidget("Widget8");
- bbUserOnShowWidget("Widget9");
}
}//namespace bbwx
Program: bbtk
Module: $RCSfile: bbwxLayoutSplit.cxx,v $
Language: C++
- Date: $Date: 2009/05/15 14:58:03 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2009/05/28 08:12:17 $
+ Version: $Revision: 1.12 $
=========================================================================*/
/* ---------------------------------------------------------------------
// std::cout << "pos = "<<pos<<std::endl;
win->SetSashPosition(pos,true);
- bbUserOnShowWidget("Widget1");
- bbUserOnShowWidget("Widget2");
+
}
Program: bbtk
Module: $RCSfile: bbwxLayoutTab.cxx,v $
Language: C++
- Date: $Date: 2009/05/15 14:58:03 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2009/05/28 08:12:17 $
+ Version: $Revision: 1.11 $
=========================================================================*/
/* ---------------------------------------------------------------------
// when window is shown
void LayoutTab::OnShowWidget()
{
- //bbGetOutputWidget()->Show();
wxNotebook* w = (wxNotebook*)bbGetOutputWidget();
if (w)
{
w->SetSelection(0);
for (unsigned int i=0; i<w->GetPageCount(); ++i) w->AdvanceSelection();
}
- bbUserOnShowWidget("Widget1");
- bbUserOnShowWidget("Widget2");
- bbUserOnShowWidget("Widget3");
- bbUserOnShowWidget("Widget4");
- bbUserOnShowWidget("Widget5");
- bbUserOnShowWidget("Widget6");
- bbUserOnShowWidget("Widget7");
- bbUserOnShowWidget("Widget8");
- bbUserOnShowWidget("Widget9");
}
Program: bbtk
Module: $RCSfile: bbwxvtkViewer2D.cxx,v $
Language: C++
- Date: $Date: 2009/05/15 14:58:07 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2009/05/28 08:12:18 $
+ Version: $Revision: 1.36 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
bbtkMessage("Output", 2, "Viewer2D : Orientation was not 0< <2 "<<std::endl);
orientation=2; // Why not?
}
- // mBox->bbIsShown() is necessary to be sure that the wxWindow is already
+ std::cout << "slicepre = "<<std::endl;
+ // mBox->bbIsShown() is necessary to be sure that the wxWindow is already
// created and displayed.
// Else when slice != 0 we get an X Window System error with wxGTK
+
+ std::cout << "shown = "<<mBox->bbIsShown()<<std::endl;
if (
(backImageData!=NULL)&&
(mBox->bbIsShown()))
{
int z = mBox->bbGetInputSlice();
- // std::cout << "slice = "<<z<<std::endl;
+ std::cout << "slice = "<<z<<std::endl;
int ext[6];
backImageData->GetWholeExtent(ext);
/*
Program: bbtk
Module: $RCSfile: bbwxvtkViewer3D.cxx,v $
Language: C++
- Date: $Date: 2009/05/15 14:58:08 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2009/05/28 08:12:18 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//-------------------------------------------------------------------------
Viewer3DWidget::~Viewer3DWidget()
{
+ mBox->DisableObservers();
+ mBox->bbSetOutputWidget(NULL);
renderwindow->Delete();
renderer->Delete();
interactorstyle->Delete();
//-----------------------------------------------------------------
void Viewer3D::bbUserFinalizeProcessing()
- {
- }
+ {
+ DisableObservers();
+ }
+
+ void Viewer3D::DisableObservers()
+ {
+ Viewer3DWidget* w = (Viewer3DWidget*)bbGetOutputWidget();
+ if (w!=NULL)
+ {
+ vtkRenderWindowInteractor *interactor = w->GetInteractor();
+ if (interactor!=NULL)
+ {
+ if (bbGetInputObs1()!=NULL)
+ {
+ if (bbGetInputObs1()->GetInteractor()!=NULL)
+ bbGetInputObs1()->EnabledOff();
+ }
+ if (bbGetInputObs2()!=NULL)
+ {
+ if (bbGetInputObs2()->GetInteractor()!=NULL)
+ //bbGetInputObs2()->SetInteractor(NULL);
+ bbGetInputObs2()->EnabledOff();
+ }
+ if (bbGetInputObs3()!=NULL)
+ {
+ if (bbGetInputObs3()->GetInteractor()!=NULL)
+ //bbGetInputObs3()->SetInteractor(NULL);
+ bbGetInputObs3()->EnabledOff();
+ }
+ if (bbGetInputObs4()!=NULL)
+ {
+ if (bbGetInputObs4()->GetInteractor()!=NULL)
+ //bbGetInputObs4()->SetInteractor(NULL);
+ bbGetInputObs4()->EnabledOff();
+ }
+ if (bbGetInputObs5()!=NULL)
+ {
+ if (bbGetInputObs5()->GetInteractor()!=NULL)
+ //bbGetInputObs5()->SetInteractor(NULL);
+ bbGetInputObs5()->EnabledOff();
+ }
+ }
+ }
+ }
//--------------------------------------------------------------------------
void Viewer3D::Process()
{
-
+ if (!bbIsShown()) return;
//EED
// Viewer3DWidget* w = (Viewer3DWidget*)bbGetOutputWidget();
// if (w) w->Update();
bbtkDebugMessageInc("Core",9,"Viewer3D::CreateWidget()"<<std::endl);
- Viewer3DWidget* w = new Viewer3DWidget(this,parent,
- //bbGetWxParent(),
- bbGetInputStereo());
- //EED w->Update();
- //...
+ Viewer3DWidget* w = new Viewer3DWidget(this,
+ parent,
+ //bbGetWxParent(),
+ bbGetInputStereo());
+ //EED w->Update();
+ //...
bbSetOutputWidget(w);
// when window is shown
void Viewer3D::OnShowWidget()
{
-
+ Process();
// Viewer3DWidget* w = (Viewer3DWidget*)bbGetOutputWidget();
// if (w) w->Update();
}
Program: bbtk
Module: $RCSfile: bbwxvtkViewer3D.h,v $
Language: C++
- Date: $Date: 2009/05/15 14:58:08 $
- Version: $Revision: 1.13 $
+ Date: $Date: 2009/05/28 08:12:18 $
+ Version: $Revision: 1.14 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
virtual void Refresh(bool eraseBackground = true, const wxRect* rect = NULL);
private:
- Viewer3D *mBox;
+ Viewer3D* mBox;
vtkRenderer *renderer;
vtkRenderWindow *renderwindow;
vtkInteractorStyleTrackballCamera *interactorstyle;
void CreateWidget(wxWindow*);
void OnShowWidget();
+ void DisableObservers();
+
protected:
- bool firsttime;
+ bool firsttime;
};
//=================================================================