English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Launcher: TCodeFile.h Source File
Uranie / Launcher  v4.10.0
/* @license-end */
TCodeFile.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2024 CEA/DES
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published
6 // by the Free Software Foundation, either version 3 of the License, or any
7 // later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 // $Id$
19 // $Author$
20 // $Date$
21 // $Revision$
22 // $State$
24 
41 #ifndef TCODEFILE_H
42 #define TCODEFILE_H
43 
44 #include <stdlib.h>
45 #include <iostream>
46 #include <vector>
47 #include <algorithm> // std::find
48 using std::cout;
49 using std::endl;
50 using std::vector;
51 
52 // ROOT
53 #include "Rtypes.h"
54 #include "TString.h"
55 
56 // URANIE
57 #include "Launcher.h"
58 #include "TAttribute.h"
59 #include "UEntry.h"
60 
61 //STL
62 #include <vector>
63 
64 #ifdef WIN32
65 #define FULLPATHFILE(base, file) TString::Format("%s\\%s", base, file)
66 #else
67 #define FULLPATHFILE(base, file) TString::Format("%s/%s", base, file)
68 #endif
69 
70 namespace URANIE
71 {
72 namespace Launcher
73 {
74 
75 class TCodeFile: public TNamed
76 {
77 public:
78  vector<URANIE::DataServer::TAttribute *> _attributes;
80  TString _sFileName;
81  Bool_t _blog;
82 
83  TString _cComments;
84  TString _cSeparators;
85  TString _cFieldSeparator;
86 public:
87  //---------------------------------------------
91 
93  TCodeFile(TString str);
95  virtual ~TCodeFile();
97 
98  //---------------------------------------------
102 
105  virtual void addAttribute(URANIE::DataServer::TAttribute*);
107 
108  //---------------------------------------------
112  TString getFileName()
113  {
114  return _sFileName;
115  }
116 
117  void setCommentCharacter(const char* str)
118  {
119  _cComments = str;
120  }
121  const char* getCommentCharacter()
122  {
123  return _cComments;
124  }
129  void setSeparatorCharacter(const char* str);
130 
131  const char* getSeparatorCharacter()
132  {
133  return _cSeparators;
134  }
135 
136  void setFieldSeparatorCharacter(const char* str);
137 
139  {
140  return _cFieldSeparator;
141  }
142 
143  URANIE::DataServer::TAttribute * getAttribute(Int_t ind);
144 
145  Int_t getAttributesNumber() const;
146 
147  Int_t getNAttributes() const
148  {
149  return getAttributesNumber();
150  }
151 
152  inline void setVectorProperties( TString beg, TString delim, TString end)
153  {
154  _svecbeg = beg;
155  _svecdel = delim;
156  _svecend = end;
157  }
158  inline void setStringProperties( TString beg, TString end)
159  {
160  _sstrbeg = beg;
161  _sstrend = end;
162  }
163 
164  inline void getBegEndProperties( URANIE::DataServer::TAttribute *att, TString &beg, TString &end)
165  {
166  if( att->getDataType()==URANIE::DataServer::TAttribute::kVector)
167  {
168  beg = _svecbeg;
169  end = _svecend;
170  }
171  else if( att->getDataType()==URANIE::DataServer::TAttribute::kString)
172  {
173  beg = _sstrbeg;
174  end = _sstrend;
175  }
176  else
177  {
178  beg = "";
179  end = "";
180  }
181  }
182 
188  Bool_t isAttribute(TString sAttributeName);
189 
191 
192  //---------------------------------------------
196  void setLog()
197  {
198  _blog = kTRUE;
199  }
200  void unsetLog()
201  {
202  _blog = kFALSE;
203  }
204  void changeLog()
205  {
206  _blog = _blog ? kFALSE : kTRUE;
207  }
208  Bool_t getLog()
209  {
210  return _blog;
211  }
212  virtual void printLog(Option_t *option = "");
214 
215  ClassDef(URANIE::Launcher::TCodeFile, ID_LAUNCHER)
216  //Classe de
217 };
218 
219 } // Fin du namespace Launcher
220 } // Fin du namespace URANIE
221 #endif
Definition: TCluster.h:66
void setFieldSeparatorCharacter(const char *str)
void setSeparatorCharacter(const char *str)
void unsetLog()
Definition: TCodeFile.h:200
virtual void printLog(Option_t *option="")
void getBegEndProperties(URANIE::DataServer::TAttribute *att, TString &beg, TString &end)
Definition: TCodeFile.h:164
TString _svecbeg
Definition: TCodeFile.h:79
void setLog()
Definition: TCodeFile.h:196
const char * getFieldSeparatorCharacter()
Definition: TCodeFile.h:138
TCodeFile(TString str)
Default constructor.
Bool_t getLog()
Definition: TCodeFile.h:208
void setVectorProperties(TString beg, TString delim, TString end)
Definition: TCodeFile.h:152
TString _cFieldSeparator
the separator to be used in between fields
Definition: TCodeFile.h:85
TString _cComments
The set of comment character.
Definition: TCodeFile.h:83
const char * getCommentCharacter()
Definition: TCodeFile.h:121
virtual ~TCodeFile()
Default destructor.
const char * getSeparatorCharacter()
Definition: TCodeFile.h:131
TString _svecend
Definition: TCodeFile.h:79
void setStringProperties(TString beg, TString end)
Definition: TCodeFile.h:158
void changeLog()
Definition: TCodeFile.h:204
TString _cSeparators
The set of separator character.
Definition: TCodeFile.h:84
TString _sstrbeg
Definition: TCodeFile.h:79
Bool_t isAttribute(TString sAttributeName)
Verify is the attribute given by the name is is the list of attribute.
TString _sFileName
The name of file.
Definition: TCodeFile.h:80
vector< URANIE::DataServer::TAttribute * > _attributes
Vector of attributes.
Definition: TCodeFile.h:78
Int_t getNAttributes() const
Definition: TCodeFile.h:147
TString _sstrend
string used for the beginning, end and delimitation of vectors and strings
Definition: TCodeFile.h:79
Description of the class TCodeFile.
Definition: TCodeFile.h:75
TString getFileName()
Definition: TCodeFile.h:112
void setCommentCharacter(const char *str)
Definition: TCodeFile.h:117
Int_t getAttributesNumber() const
URANIE::DataServer::TAttribute * getAttribute(Int_t ind)
TString _svecdel
Definition: TCodeFile.h:79
virtual void addAttribute(URANIE::DataServer::TAttribute *)
Add the attribute in the file.
Bool_t _blog
Boolean for edit the log.
Definition: TCodeFile.h:81