]> Creatis software - bbtk.git/blob - packages/std/src/bbstdStringWriter.cxx
#2997 BBTK Feature New Normal - Read Lines String box in package std
[bbtk.git] / packages / std / src / bbstdStringWriter.cxx
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
6  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9  #
10  #  This software is governed by the CeCILL-B license under French law and
11  #  abiding by the rules of distribution of free software. You can  use,
12  #  modify and/ or redistribute the software under the terms of the CeCILL-B
13  #  license as circulated by CEA, CNRS and INRIA at the following URL
14  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15  #  or in the file LICENSE.txt.
16  #
17  #  As a counterpart to the access to the source code and  rights to copy,
18  #  modify and redistribute granted by the license, users are provided only
19  #  with a limited warranty  and the software's author,  the holder of the
20  #  economic rights,  and the successive licensors  have only  limited
21  #  liability.
22  #
23  #  The fact that you are presently reading this means that you have had
24  #  knowledge of the CeCILL-B license and that you accept its terms.
25  # ------------------------------------------------------------------------ */
26
27
28 //=====
29 // 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)
30 //===== 
31 #include "bbstdStringWriter.h"
32 #include "bbstdPackage.h"
33
34 namespace bbstd
35 {
36
37 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,StringWriter)
38 BBTK_BLACK_BOX_IMPLEMENTATION(StringWriter,bbtk::AtomicBlackBox);
39 //===== 
40 // 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)
41 //===== 
42 void StringWriter::Process()
43 {
44
45         if (bbGetInputFileName()!="")
46         {
47                 FILE *ff = fopen(bbGetInputFileName().c_str(),"w");
48                 if (ff!=NULL)
49                 {
50                         if (bbGetInputIn0()!="") { fprintf(ff,"%s\n",bbGetInputIn0().c_str()); }
51                         if (bbGetInputIn1()!="") { fprintf(ff,"%s\n",bbGetInputIn1().c_str()); }
52                         if (bbGetInputIn2()!="") { fprintf(ff,"%s\n",bbGetInputIn2().c_str()); }
53                         if (bbGetInputIn3()!="") { fprintf(ff,"%s\n",bbGetInputIn3().c_str()); }
54                         if (bbGetInputIn4()!="") { fprintf(ff,"%s\n",bbGetInputIn4().c_str()); }
55                         if (bbGetInputIn5()!="") { fprintf(ff,"%s\n",bbGetInputIn5().c_str()); }
56                         if (bbGetInputIn6()!="") { fprintf(ff,"%s\n",bbGetInputIn6().c_str()); }
57                         if (bbGetInputIn7()!="") { fprintf(ff,"%s\n",bbGetInputIn7().c_str()); }
58                         if (bbGetInputIn8()!="") { fprintf(ff,"%s\n",bbGetInputIn8().c_str()); }
59                         if (bbGetInputIn9()!="") { fprintf(ff,"%s\n",bbGetInputIn9().c_str()); }
60                         fclose(ff);
61                 }
62         }
63   
64 }
65 //===== 
66 // 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)
67 //===== 
68 void StringWriter::bbUserSetDefaultValues()
69 {
70
71 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
72 //    Here we initialize the input 'In' to 0
73         bbSetInputIn0("");
74         bbSetInputIn1("");
75         bbSetInputIn2("");
76         bbSetInputIn3("");
77         bbSetInputIn4("");
78         bbSetInputIn5("");
79         bbSetInputIn6("");
80         bbSetInputIn7("");
81         bbSetInputIn8("");
82         bbSetInputIn9("");
83         bbSetInputFileName("");
84   
85 }
86 //===== 
87 // 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)
88 //===== 
89 void StringWriter::bbUserInitializeProcessing()
90 {
91
92 //  THE INITIALIZATION METHOD BODY :
93 //    Here does nothing 
94 //    but this is where you should allocate the internal/output pointers 
95 //    if any 
96
97   
98 }
99 //===== 
100 // 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)
101 //===== 
102 void StringWriter::bbUserFinalizeProcessing()
103 {
104
105 //  THE FINALIZATION METHOD BODY :
106 //    Here does nothing 
107 //    but this is where you should desallocate the internal/output pointers 
108 //    if any
109   
110 }
111 }
112 // EO namespace bbstd
113
114