include std
new Add a
-set a.In1 1
-set a.In2 2
+ set a.In1 1
+ set a.In2 2
# In a print command, any string enclosed between dollars
-# is interpreted as an output of a box (of the form 'box.output').
+# is interpreted as an output of a box (of the form 'boxName.outputName').
# Before printing, bbi substitutes it by the value of the output.
# There must be an adaptor to string for that type of output.
-print $a.Out$
+
+print "The result is : $a.Out$"
+
+# Warning --> an implicit \n is postponed to the string
+
+print "That's all "
+print "folks"
+description "std::ASCII box example. Shows how to use it. "
+category "example"
+
load std
load wx
+#
new ASCII asciiA
set asciiA.In "72 105 33"
+// --> default is 0
+// set asciiB.type 0
new ASCII asciiB
set asciiB.In "SOS"
--- /dev/null
+description "std::PrependDataPath box example. Also shows how to invoke the default data path. "
+category "example"
+
+include std
+
+#Use it as a 'normal' box, thought it's written as a bbs script
+new PrependDataPath pdp
+ set pdp.In "MyDataFile"
+
+print "Full path name : $pdp.Out"
load std
+# --- Box Description ---
define PrependDataPath std
author "jpr@creatis.insa-lyon.fr"
description "Prepends the input string file 'last name' with the default DataPath found in bbtk_config_xml"
category "misc"
+# --- ---
# For getting default Data Path
new Configuration c
load std
+# --- Black Box Description ---
define PrependPackageDataPath std
author "laurent.guigues at creatis.insa-lyon.fr"
description "Prepends the input file name 'In' with the path to the data directory of the package 'Package'"
category "misc"
+# --- ---
# For getting bbtk Data Path
new Configuration c
new MakeFileName mfn2
connect c.DataPath mfn1.Directory
- connect mfn1.Out mfn2.Directory
+ connect mfn1.Out mfn2.Directory
- # inputs / outputs
- input In mfn2.File "Last Filename"
+# --- inputs / outputs ---
+ input In mfn2.File "Last Filename"
input Package mfn1.File "Package name"
- output Out mfn2.Out "Full path Filename"
+ output Out mfn2.Out "Full path Filename"
+# --- ---
endefine
}
void ASCII::bbUserCopyConstructor()
- {
-
+ {
}
void ASCII::bbUserDestructor()
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ASCII,bbtk::AtomicBlackBox);
BBTK_NAME("ASCII");
- BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr");
+ BBTK_AUTHOR("eduardo.davila [at] creatis [dot] insa-lyon.fr");
BBTK_DESCRIPTION("ascii codes sequence to string - string to ascii codes sequence");
BBTK_CATEGORY("misc");
//====================================================================
// Add the instanciated adaptors to the package
- //typedef unsigned char uchar;
BBTK_ADD_TEMPLATE2_BLACK_BOX_TO_PACKAGE(std,Cast,double,int8_t);
BBTK_ADD_TEMPLATE2_BLACK_BOX_TO_PACKAGE(std,Cast,int8_t,double);
void ConcatStrings::DoProcess()
{
- bbSetOutputOut( bbGetInputIn1() +
- bbGetInputIn2() +
- bbGetInputIn3() +
- bbGetInputIn4() +
- bbGetInputIn5() +
- bbGetInputIn6() +
- bbGetInputIn7() +
- bbGetInputIn8() +
- bbGetInputIn9() +
- bbGetInputIn10() );
+ bbSetOutputOut( bbGetInputIn1() +
+ bbGetInputIn2() +
+ bbGetInputIn3() +
+ bbGetInputIn4() +
+ bbGetInputIn5() +
+ bbGetInputIn6() +
+ bbGetInputIn7() +
+ bbGetInputIn8() +
+ bbGetInputIn9() +
+ bbGetInputIn10() );
}
}
// EO namespace bbstd
BBTK_BEGIN_DESCRIBE_BLACK_BOX(Configuration,bbtk::AtomicBlackBox);
BBTK_NAME("Configuration");
- BBTK_AUTHOR("jpr@creatis.insa-lyon.fr");
+ BBTK_AUTHOR("jpr@creatis.insa-lyon [dot] fr");
BBTK_CATEGORY("misc");
BBTK_DESCRIPTION("Gets configuration informations");
BBTK_OUTPUT(Configuration,BinPath,"Binaries path",std::string,"directory name");
<description>Divides its inputs</description>
<category>math</category>
- <input name="In1" type="double" description="Numerator"/>
- <input name="In2" type="double" description="Denominator"/>
+ <input name="In1" type="double" description="Numerator"/>
+ <input name="In2" type="double" description="Denominator"/>
<output name="Out" type="double" description="Result"/>
<process><PRE>
class ExecBbiCommand
:
- public bbtk::AtomicBlackBox
+ public bbtk::AtomicBlackBox
{
+ public:
BBTK_BLACK_BOX_INTERFACE(ExecBbiCommand,bbtk::AtomicBlackBox);
BBTK_DECLARE_INPUT(In,std::string);
- // BBTK_DECLARE_OUTPUT(Out,std::string);
BBTK_PROCESS(DoProcess);
void DoProcess();
-
+
protected:
virtual void bbUserConstructor();
-
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ExecBbiCommand,bbtk::AtomicBlackBox);
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
BBTK_DESCRIPTION("Executes bbi commands");
BBTK_INPUT(ExecBbiCommand,In,"bbi commands separated by ';' , use '' to indicate strings ex. help 'graph' ",std::string,"");
- // BBTK_OUTPUT(ExecBbiCommand,Out,"Concatenated string",std::string);
BBTK_END_DESCRIBE_BLACK_BOX(ExecBbiCommand);
-
+
} // EO namespace bbstd
#endif // __bbstdExecBbiCommand_h_INCLUDED__
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,uint16_t);
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,int32_t);
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,uint32_t);
+///\todo : diff between uint32_t and long?
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,long);
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,float);
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,double);
}
// EO namespace bbstd
-
-
/// Construction with the pointer on the Set method
MagicBoxSetFunctor(SetMethodPointerType s) :
- mSetMethodPointer(s)
- {}
+ mSetMethodPointer(s)
+ {
+ }
/// Concrete application of the Set method of object o
void Set(bbtk::AtomicBlackBox* o, const bbtk::Data& d)
public bbtk::AtomicBlackBox
{
BBTK_BLACK_BOX_INTERFACE(MakeFileName,bbtk::AtomicBlackBox);
- BBTK_DECLARE_INPUT(Directory,std::string);
- BBTK_DECLARE_INPUT(File,std::string);
- BBTK_DECLARE_INPUT(Extent,std::string);
- BBTK_DECLARE_OUTPUT(Out,std::string);
+ BBTK_DECLARE_INPUT(Directory, std::string);
+ BBTK_DECLARE_INPUT(File, std::string);
+ BBTK_DECLARE_INPUT(Extent, std::string);
+ BBTK_DECLARE_OUTPUT(Out, std::string);
BBTK_PROCESS(DoProcess);
void DoProcess();
BBTK_CATEGORY("misc");
BBTK_DESCRIPTION("Makes a kosher file name");
BBTK_INPUT(MakeFileName,Directory,"Directory Name",std::string,"directory name");
- BBTK_INPUT(MakeFileName,File,"File Name",std::string,"file name");
- BBTK_INPUT(MakeFileName,Extent,"Extention",std::string,"file extension");
+ BBTK_INPUT(MakeFileName,File, "File Name", std::string,"file name");
+ BBTK_INPUT(MakeFileName,Extent, "Extention", std::string,"file extension");
BBTK_OUTPUT(MakeFileName,Out,"Full File Name",std::string,"file name");
BBTK_END_DESCRIBE_BLACK_BOX(MakeFileName);
template <class T>
class Relay
:
- public bbtk::AtomicBlackBox
+ public bbtk::AtomicBlackBox
{
BBTK_TEMPLATE_BLACK_BOX_INTERFACE(Relay,bbtk::AtomicBlackBox,T);
BBTK_DECLARE_INPUT(In,T);
bbtk::AtomicBlackBox);
//====================================================================
-
-
-
//====================================================================
// Template specialization of decode_item
template <> int8_t StringToVector<int8_t> ::decode_item(const std::string& s)
BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(VectorToString,
bbtk::AtomicBlackBox);
//====================================================================
-
-
-
- /*
- //====================================================================
- // Template specialization of encode_item
- template <> int8_t VectorToString<int8_t> ::encode_item(const std::string& s)
- {
- return (int8_t)atoi ( s.c_str() );
- }
-
- template <> uint8_t VectorToString<uint8_t> ::encode_item(const std::string& s)
- {
- return (uint8_t)atoi ( s.c_str() );
-}
-
-template <> int16_t VectorToString<int16_t> ::encode_item(const std::string& s)
-{
- return (int16_t)atoi ( s.c_str() );
-}
-
-template <> uint16_t VectorToString<uint16_t> ::encode_item(const std::string& s)
-{
- return (uint16_t)atoi ( s.c_str() );
-}
-
-template <> int32_t VectorToString<int32_t> ::encode_item(const std::string& s)
-{
- return (int32_t)atoi ( s.c_str() );
-}
-
-template <> uint32_t VectorToString<uint32_t> ::encode_item(const std::string& s)
-{
- return (uint32_t)atoi ( s.c_str() );
-}
-
-template <> long VectorToString<long> ::encode_item(const std::string& s)
-{
- return (long)atoi ( s.c_str() );
-}
-
-template <> float VectorToString<float> ::encode_item(const std::string& s)
-{
- return (float)atof ( s.c_str() );
-}
-
-template <> double VectorToString<double> ::encode_item(const std::string& s)
-{
- return atof ( s.c_str() );
-}
-
-template <> std::string VectorToString<std::string> ::encode_item(const std::string& s)
-{
- return s;
-}
- */
//====================================================================