From: Claire Mouton Date: Mon, 18 Mar 2013 15:25:48 +0000 (+0100) Subject: Feature #1947 Added a box allowing to convert a double to an int. X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a1092b94b5caf377eb392e3d69910f9591de49f7;p=bbtk.git Feature #1947 Added a box allowing to convert a double to an int. --- diff --git a/packages/std/src/bbstdDoubleToInt.cxx b/packages/std/src/bbstdDoubleToInt.cxx new file mode 100644 index 0000000..6c41981 --- /dev/null +++ b/packages/std/src/bbstdDoubleToInt.cxx @@ -0,0 +1,70 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#include "bbstdDoubleToInt.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,DoubleToInt) +BBTK_BLACK_BOX_IMPLEMENTATION(DoubleToInt,bbtk::AtomicBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void DoubleToInt::Process() +{ + +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') + bbSetOutputOut( (int)bbGetInputIn() ); + +} +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void DoubleToInt::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputIn(0); + +} +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void DoubleToInt::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// if any + + +} +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void DoubleToInt::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbstd + + diff --git a/packages/std/src/bbstdDoubleToInt.h b/packages/std/src/bbstdDoubleToInt.h new file mode 100644 index 0000000..1359598 --- /dev/null +++ b/packages/std/src/bbstdDoubleToInt.h @@ -0,0 +1,45 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#ifndef __bbstdDoubleToInt_h_INCLUDED__ +#define __bbstdDoubleToInt_h_INCLUDED__ +#include "bbstd_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbstd +{ + +class bbstd_EXPORT DoubleToInt + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(DoubleToInt,bbtk::AtomicBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== + BBTK_DECLARE_INPUT(In,double); + BBTK_DECLARE_OUTPUT(Out,double); + BBTK_PROCESS(Process); + void Process(); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(DoubleToInt,bbtk::AtomicBlackBox); +BBTK_NAME("DoubleToInt"); +BBTK_AUTHOR("Claire Mouton"); +BBTK_DESCRIPTION("Converts a double to an int"); +BBTK_CATEGORY(""); +BBTK_INPUT(DoubleToInt,In,"First input",double,""); +BBTK_OUTPUT(DoubleToInt,Out,"First output",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(DoubleToInt); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +} +// EO namespace bbstd + +#endif // __bbstdDoubleToInt_h_INCLUDED__ +