[Clam-devel] PATCH: GuiOnly option cleanups
Zach Welch
zach-clam-devel at splitstring.com
Wed Apr 18 02:56:26 PDT 2007
Pau Arumi wrote:
[snip]
> And waiting for a small clean up as talked at irc. Thanks!
Pau,
Here is the patch we discussed, complete with a commit message:
ControlPrinter GuiOnly attribute clean-ups:
* Remove redundant mGuiOnly member variable.
* Change the default configuration setting of GuiOnly to true.
* Consolidate dynamic attribute instantiation in ConcreteConfigure.
Cheers,
Zach
-------------- next part --------------
Index: CLAM/src/Processing/Controls/ControlPrinter.cxx
===================================================================
--- CLAM/src/Processing/Controls/ControlPrinter.cxx (revision 10019)
+++ CLAM/src/Processing/Controls/ControlPrinter.cxx (working copy)
@@ -18,17 +18,15 @@
UpdateData();
SetIdentifier( "ControlPrinter" );
SetNumberOfInputs(1.);
- SetGuiOnly(false);
+ SetGuiOnly(true);
}
ControlPrinter::ControlPrinter()
- : mGuiOnly(false)
{
Configure( mConfig );
}
ControlPrinter::ControlPrinter( const ControlPrinterConfig& cfg )
- : mGuiOnly(false)
{
Configure( cfg );
}
@@ -40,15 +38,18 @@
bool ControlPrinter::ConcreteConfigure( const ProcessingConfig& cfg )
{
RemoveOldControls();
+
CopyAsConcreteConfig( mConfig, cfg );
- if (!mConfig.HasNumberOfInputs())
+
+ mConfig.AddAll();
+ mConfig.UpdateData();
+
+ int nInputs = int(mConfig.GetNumberOfInputs());
+ if (nInputs < 1)
{
- mConfig.AddNumberOfInputs();
- mConfig.UpdateData();
mConfig.SetNumberOfInputs(1.);
+ nInputs = 1;
}
- int nInputs = int(mConfig.GetNumberOfInputs());
- if (nInputs < 1) nInputs = 1;
if (nInputs == 1)
{
// preserve old port name
@@ -63,20 +64,13 @@
mConfig.GetIdentifier(), this);
}
- if (!mConfig.HasGuiOnly())
- {
- mConfig.AddGuiOnly();
- mConfig.UpdateData();
- }
- if (mConfig.GetGuiOnly())
- mGuiOnly = true;
return true;
}
bool ControlPrinter::Do()
{
- if (mGuiOnly)
+ if (mConfig.GetGuiOnly())
return true;
std::string separator = "";
Index: CLAM/src/Processing/Controls/ControlPrinter.hxx
===================================================================
--- CLAM/src/Processing/Controls/ControlPrinter.hxx (revision 10019)
+++ CLAM/src/Processing/Controls/ControlPrinter.hxx (working copy)
@@ -57,8 +57,6 @@
bool Do();
protected:
void RemoveOldControls();
- private:
- bool mGuiOnly;
};
}
More information about the clam-devel
mailing list