]> Creatis software - bbtk.git/commitdiff
Cosmetics
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 25 Jun 2008 17:09:28 +0000 (17:09 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 25 Jun 2008 17:09:28 +0000 (17:09 +0000)
19 files changed:
packages/std/bbs/appli/exampleAdd.bbs
packages/std/bbs/appli/exampleAscii.bbs
packages/std/bbs/appli/examplePrependDataPath.bbs [new file with mode: 0644]
packages/std/bbs/boxes/bbPrependDataPath.bbs
packages/std/bbs/boxes/bbPrependPackageDataPath.bbs
packages/std/src/bbstdASCII.cxx
packages/std/src/bbstdASCII.h
packages/std/src/bbstdCast.cxx
packages/std/src/bbstdConcatStrings.cxx
packages/std/src/bbstdConfiguration.h
packages/std/src/bbstdDiv.xml
packages/std/src/bbstdExecBbiCommand.h
packages/std/src/bbstdGetVectorElement.cxx
packages/std/src/bbstdMagicBox.cxx
packages/std/src/bbstdMagicBox.h
packages/std/src/bbstdMakeFileName.h
packages/std/src/bbstdRelay.h
packages/std/src/bbstdStringToVector.cxx
packages/std/src/bbstdVectorToString.cxx

index 67a1b7b..d98b0aa 100644 (file)
@@ -3,11 +3,17 @@ category "example"
 
 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"
index 4049bdd..f17bd94 100644 (file)
@@ -1,8 +1,14 @@
+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"
diff --git a/packages/std/bbs/appli/examplePrependDataPath.bbs b/packages/std/bbs/appli/examplePrependDataPath.bbs
new file mode 100644 (file)
index 0000000..758ea42
--- /dev/null
@@ -0,0 +1,10 @@
+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"
index 0f6335e..9a4cdf2 100755 (executable)
@@ -1,9 +1,11 @@
 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
index cc26257..e231db1 100755 (executable)
@@ -1,9 +1,11 @@
 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
@@ -13,11 +15,12 @@ define PrependPackageDataPath std
   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
 
index c24da54..55be188 100644 (file)
@@ -58,8 +58,7 @@ namespace bbstd
   }
   
   void ASCII::bbUserCopyConstructor()
-  {
-    
+  {    
   }
   
   void ASCII::bbUserDestructor()
index b246ae9..4ed0405 100644 (file)
@@ -28,7 +28,7 @@ namespace bbstd
   
   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");
index a579cfd..59176d2 100644 (file)
@@ -11,7 +11,6 @@ namespace bbstd
   
   //====================================================================
   // 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);
index 098c95c..ee1cdfe 100644 (file)
@@ -23,16 +23,16 @@ namespace bbstd
   
   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
index 9f3aced..35efb37 100644 (file)
@@ -25,7 +25,7 @@ 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");
index 7a6ccfa..5a09058 100644 (file)
@@ -6,8 +6,8 @@
   <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>
index 8bf3f56..212cbba 100755 (executable)
@@ -8,17 +8,16 @@ namespace bbstd
 
   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);
@@ -26,9 +25,8 @@ namespace bbstd
   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__
index d7a1896..e78650e 100644 (file)
@@ -18,6 +18,7 @@ BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,int16_t);
 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);
index f11eb89..19e534b 100644 (file)
@@ -8,5 +8,3 @@ namespace bbstd
   
 }
 // EO namespace bbstd
-
-
index 55f0d7c..b336342 100644 (file)
@@ -39,8 +39,9 @@ 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)
index d9d6eab..d7129f9 100644 (file)
@@ -10,10 +10,10 @@ namespace bbstd
   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();
 
@@ -28,8 +28,8 @@ namespace bbstd
   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);
index c0ef92d..cc0334f 100644 (file)
@@ -9,7 +9,7 @@ namespace bbstd
   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);
index 0d1f506..b3ceb3e 100644 (file)
@@ -9,9 +9,6 @@ namespace bbstd
                                         bbtk::AtomicBlackBox);
   //====================================================================
   
-  
-  
-  
   //====================================================================
   // Template specialization of decode_item
   template <> int8_t StringToVector<int8_t> ::decode_item(const std::string& s)
index d6c164d..f95c8bc 100644 (file)
@@ -8,62 +8,6 @@ namespace bbstd
   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;
-}
-  */
 
 //====================================================================