cfl_utils.cpp
Go to the documentation of this file.
1 /** @file cfl_utils.cpp C-level utility functions */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2006 Bernd Opitz
6  Copyright (C) 2008-2010 Thomas Moor
7  Exclusive copyright is granted to Klaus Schmidt
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 
23 */
24 
25 
26 #include "cfl_utils.h"
27 
28 
29 // Debug includes
30 #include "cfl_attributes.h"
31 #include "cfl_registry.h"
32 #include "cfl_types.h"
33 #include "cfl_elementary.h"
34 
35 
36 // c++ file io
37 #include <fstream>
38 
39 
40 namespace faudes {
41 
42 // ToStringInteger(number)
43 std::string ToStringInteger(Int number) {
44  if(number>= std::numeric_limits<Int>::max()) return "inf";
45  if(number<= std::numeric_limits<Int>::min()+1) return "-inf";
46  std::string res;
47  std::stringstream sstr;
48  sstr << number;
49  sstr >> res;
50  return res;
51 }
52 
53 // ToStringInteger16(number)
54 std::string ToStringInteger16(Int number) {
55  std::string res;
56  std::stringstream sstr;
57  sstr << "0x" << std::setbase(16) << number;
58  sstr >> res;
59  return res;
60 }
61 
62 // ToStringFloat(number)
63 // todo: check range, prevent sci notation
64 std::string ToStringFloat(Float number) {
65  if(number>= std::numeric_limits<Float>::max()) return "inf";
66  if(number<= -1*std::numeric_limits<Float>::max()) return "-inf";
67  std::stringstream sstr;
68  if(number == static_cast<Float>( static_cast<Int>(number) )) {
69  sstr << static_cast<Int>(number);
70  } else {
71  sstr << std::fixed;
72  sstr << number;
73  }
74  std::string res;
75  sstr >> res;
76  return res;
77 }
78 
79 // ExpandString(rString, len)
80 std::string ExpandString(const std::string& rString, unsigned int len) {
81  std::string res;
82  res = rString;
83  std::string::size_type xtra = (std::string::size_type) len - rString.length();
84  if ((xtra > 0) && (xtra < 10000)) {
85  res.append(xtra, ' ');
86  }
87  return res;
88 }
89 
90 // CollapseString(rString, len)
91 std::string CollapsString(const std::string& rString, unsigned int len) {
92  if(len <=1) return rString;
93  if(rString.length() <= len) return rString;
94  int chead = len/2;
95  int ctail = len-chead;
96  return rString.substr(0,chead) + "..." + rString.substr(rString.length()-ctail,ctail);
97 }
98 
99 // ToIdx(rString)
100 Idx ToIdx(const std::string& rString) {
101  char * end;
102  unsigned long ul = strtoul (rString.c_str(), &end, 0);
103  unsigned long idxmax = std::numeric_limits<Idx>::max();
104  if(ul > idxmax) {
105  throw Exception("atoidx", "Idx overflow", 600);
106  }
107  return (Idx) ul;
108 }
109 
110 // ToLOwerCase(rString(
111 std::string ToLowerCase(const std::string& rString) {
112  std::string res=rString;
113  std::transform(res.begin(), res.end(), res.begin(),
114  [](unsigned char c){ return std::tolower(c); });
115  return res;
116 }
117 
118 
119 
120 // String Substitution
121 std::string StringSubstitute(const std::string& rString,const std::string& rFrom,const std::string& rTo) {
122  // prep result
123  std::string res;
124  std::size_t pos=0;
125  // loop over occurences of "from"
126  while(pos<rString.length()) {
127  std::size_t next=rString.find(rFrom,pos);
128  if(next==std::string::npos) break;
129  res.append(rString.substr(pos, next-pos));
130  res.append(rTo);
131  pos=next+rFrom.length();
132  }
133  // get end
134  if(pos<rString.length())
135  res.append(rString.substr(pos));
136  // done
137  return res;
138 }
139 
140 // VersionString()
141 std::string VersionString() {
142  return std::string(FAUDES_VERSION);
143 }
144 
145 // FluginsString()
146 std::string PluginsString() {
147  return std::string(FAUDES_PLUGINS);
148 }
149 
150 // ContributorsString()
151 std::string ContributorsString() {
152  return
153  "Ramon Barakat, Ruediger Berndt, Christian Breindl, Christine Baier, Tobias Barthel, Christoph Doerr, Marc Duevel, Norman Franchi, Stefan Goetz, Rainer Hartmann, Jochen Hellenschmidt, Stefan Jacobi, Matthias Leinfelder, Tomas Masopust, Michael Meyer, Andreas Mohr, Thomas Moor, Mihai Musunoi, Bernd Opitz, Katja Pelaic, Irmgard Petzoldt, Sebastian Perk, Thomas Rempel, Daniel Ritter, Berno Schlein, Ece Schmidt, Klaus Schmidt, Anne-Kathrin Schmuck, Sven Schneider, Matthias Singer, Yiheng Tang, Ulas Turan, Christian Wamser, Zhengying Wang, Thomas Wittmann, Shi Xiaoxun, Yang Yi, Jorgos Zaddach, Hao Zhou, Christian Zwick, et al";
154 }
155 
156 #define XLITSTR(x) LITSTR(x)
157 #define LITSTR(x) #x
158 
159 // ContributorsString()
160 std::string BuildString() {
161  std::string res;
162 #ifdef FAUDES_BUILDENV
163  res = res + std::string(XLITSTR(FAUDES_BUILDENV));
164 #else
165  res = res + std::string("generic");
166 #endif
167 #ifdef FAUDES_BUILDTIME
168  res = res + std::string(" ") + std::string(XLITSTR(FAUDES_BUILDTIME));
169 #else
170  res = res + std::string(" ") + std::string(FAUDES_CONFIG_TIMESTAMP);
171 #endif
172  return res;
173 }
174 
175 
176 // ProcessDot(infile,outfile,format)
177 void ProcessDot(const std::string& rDotFile,
178  const std::string& rOutFile, const std::string& rOutFormat, const std::string& rDotExec)
179 {
180  std::string format=rOutFormat;
181  // guess format from filename
182  if(format=="") {
183  if(rOutFile.rfind('.')+1 < rOutFile.size()) {
184  format=rOutFile.substr(rOutFile.rfind('.')+1);
185  }
186  }
187  // test format
188  if (format == "canon");
189  else if (format == "dot");
190  else if (format == "xdot");
191  else if (format == "cmap");
192  else if (format == "dia");
193  else if (format == "fig");
194  else if (format == "gd");
195  else if (format == "gd2");
196  else if (format == "gif");
197  else if (format == "hpgl");
198  else if (format == "imap");
199  else if (format == "cmapx");
200  else if (format == "ismap");
201  else if (format == "jpg");
202  else if (format == "jpeg");
203  else if (format == "mif");
204  else if (format == "mp");
205  else if (format == "pcl");
206  else if (format == "pic");
207  else if (format == "plain");
208  else if (format == "plain-ext");
209  else if (format == "png");
210  else if (format == "ps");
211  else if (format == "ps2");
212  else if (format == "svg");
213  else if (format == "svgz");
214  else if (format == "vrml");
215  else if (format == "vtx");
216  else if (format == "wbmp");
217  else if (format == "eps");
218  else if (format == "pdf");
219  else {
220  std::stringstream errstr;
221  errstr << "Dot output format \"" << format << "\" unknown";
222  throw Exception("faudes::ProcessDot", errstr.str(), 3);
223  }
224  std::string dotcommand = rDotExec + " -T"+format+" \""+rDotFile+"\" -o \""+rOutFile+"\"";
225  if(system(dotcommand.c_str()) != 0) {
226  throw Exception("faudes::ProcessDot",
227  "Error in running " + dotcommand, 3);
228  }
229 }
230 
231 
232 // CreateTempFile(void)
233 // todo: sys dependant, report, investigate threads
234 std::string CreateTempFile(void) {
235  char filename[]= "faudes_temp_XXXXXX";
236  std::string res;
237 #ifdef FAUDES_POSIX
238  // use mkstemp on recent Posix systems
239  int filedes = -1;
240  filedes= mkstemp(filename);
241  if(filedes==-1) {
242  FD_DF("faudes::CreateTempFile(): error");
243  return res;
244  }
245  close(filedes);
246  res=std::string(filename);
247 #endif
248 #ifdef FAUDES_WINDOWS
249  // mimique mkstemp on Windows/MinGW
250  /*
251  int filedes = -1;
252  #define _S_IREAD 256
253  #define _S_IWRITE 128
254  mktemp(filename);
255  filedes=open(filename,O_RDWR|O_BINARY|O_CREAT|O_EXCL|_O_SHORT_LIVED, _S_IREAD|_S_IWRITE);
256  if(filedes==-1) {
257  FD_DF("faudes::CreateTempFile(): error");
258  return "";
259  }
260  close(filedes);
261  res=std::string(filename);
262  */
263  // win32 API
264  char* tmpname = _mktemp(filename);
265  FILE* file;
266  if(tmpname==NULL) {
267  FD_DF("faudes::CreateTempFile(): error");
268  return res;
269  }
270  fopen_s(&file,tmpname,"w");
271  if(file==NULL) {
272  FD_DF("faudes::CreateTempFile(): error");
273  return "";
274  }
275  fclose(file);
276  res=std::string(tmpname);
277 #endif
278  FD_DF("faudes::CreateTempFile(): " << res);
279  return(res);
280 }
281 
282 // ExtractPath
283 std::string ExtractDirectory(const std::string& rFullPath) {
284  std::string res="";
285  std::size_t seppos = rFullPath.find_last_of(faudes_pathseps());
286  if(seppos==std::string::npos) return res;
287  res=rFullPath.substr(0,seppos+1);
288  return res;
289 }
290 
291 // ExtractFilename
292 std::string ExtractFilename(const std::string& rFullPath) {
293  std::string res=rFullPath;
294  std::size_t seppos = rFullPath.find_last_of(faudes_pathseps());
295  if(seppos==std::string::npos) return res;
296  res=rFullPath.substr(seppos+1);
297  return res;
298 }
299 
300 // ExtractBasename
301 std::string ExtractBasename(const std::string& rFullPath) {
302  std::string res=rFullPath;
303  std::size_t seppos = res.find_last_of(faudes_pathseps());
304  if(seppos!=std::string::npos) {
305  res=res.substr(seppos+1);
306  }
307  std::size_t dotpos = res.find_last_of(".");
308  if(dotpos!=std::string::npos) {
309  res=res.substr(0,dotpos);
310  }
311  return res;
312 }
313 
314 // ExtractSuffix
315 std::string ExtractSuffix(const std::string& rFullPath) {
316  std::string res=rFullPath;
317  std::size_t seppos = res.find_last_of(faudes_pathseps());
318  if(seppos!=std::string::npos) {
319  res=res.substr(seppos+1);
320  }
321  std::size_t dotpos = res.find_last_of(".");
322  if(dotpos!=std::string::npos)
323  if(dotpos +1 < res.size()) {
324  return res.substr(dotpos+1,res.size()-dotpos-1);
325  }
326  return std::string();
327 }
328 
329 // PrependPath
330 std::string PrependPath(const std::string& rLeft, const std::string& rRight) {
331  // bail out in trivial args
332  if(rLeft=="")
333  return std::string(rRight);
334  if(rRight=="")
335  return std::string(rLeft);
336  // system default
337  char sepchar=faudes_pathsep().at(0);
338  // user overwrite by left argument
339  std::size_t seppos;
340  seppos=rLeft.find_last_of(faudes_pathseps());
341  if(seppos!=std::string::npos)
342  sepchar=rLeft.at(seppos);
343  // go doit
344  std::string res=rLeft;
345  if(res.at(res.length()-1)!=sepchar)
346  res.append(1,sepchar);
347  if(rRight.at(0)!=sepchar){
348  res.append(rRight);
349  return res;
350  }
351  if(rRight.length()<=1) {
352  return res;
353  }
354  res.append(rRight,1,std::string::npos);
355  return res;
356 }
357 
358 // Test directory
359 bool DirectoryExists(const std::string& rDirectory) {
360 #ifdef FAUDES_POSIX
361  DIR *thedir;
362  thedir=opendir(rDirectory.c_str());
363  if(thedir) closedir(thedir);
364  return thedir!= 0;
365 #endif
366 #ifdef FAUDES_WINDOWS
367  DWORD fattr = GetFileAttributesA(faudes_extpath(rDirectory).c_str());
368  return
369  (fattr!=INVALID_FILE_ATTRIBUTES) && (fattr & FILE_ATTRIBUTE_DIRECTORY);
370 #endif
371  return false;
372 }
373 
374 // scan directory
375 std::set< std::string > ReadDirectory(const std::string& rDirectory) {
376  std::set< std::string > res;
377 #ifdef FAUDES_POSIX
378  DIR *thedir;
379  struct dirent *theent;
380  thedir=opendir(rDirectory.c_str());
381  if(!thedir) return res;
382  while((theent=readdir(thedir))) {
383  std::string fname(theent->d_name);
384  if(fname==".") continue;
385  if(fname=="..") continue;
386  res.insert(fname);
387  }
388  closedir(thedir);
389 #endif
390 #ifdef FAUDES_WINDOWS
391  HANDLE hf;
392  WIN32_FIND_DATA data;
393  hf = FindFirstFile((rDirectory+"\\*.*").c_str(), &data);
394  if (hf != INVALID_HANDLE_VALUE) {
395  do {
396  std::string fname(data.cFileName);
397  if(fname==".") continue;
398  if(fname=="..") continue;
399  res.insert(fname);
400  } while (FindNextFile(hf, &data));
401  FindClose(hf);
402  }
403 #endif
404  return res;
405 }
406 
407 
408 
409 
410 
411 // Test file
412 bool FileExists(const std::string& rFilename) {
413  std::fstream fp;
414  fp.open(rFilename.c_str(), std::ios::in | std::ios::binary);
415  return fp.good();
416 }
417 
418 // Delete file
419 bool FileDelete(const std::string& rFilename) {
420  return remove(rFilename.c_str()) == 0;
421 }
422 
423 // Copy file
424 bool FileCopy(const std::string& rFromFile, const std::string& rToFile) {
425  std::ifstream froms(rFromFile.c_str(), std::ios::binary);
426  std::ofstream tos(rToFile.c_str(), std::ios::binary);
427  tos << froms.rdbuf();
428  tos.flush();
429  return !(froms.fail() || tos.fail());
430 }
431 
432 // ConsoleOut class
433 // Note: console-out is not re-entrant; for multithreaded applications
434 // you must derive a class that has built-in mutexes;
435 ConsoleOut::ConsoleOut(void) : pStream(NULL), mVerb(1) {
436  pInstance=this;
437 }
439  if(pStream) { pStream->flush(); delete pStream; }
440  if(this==smpInstance) smpInstance=NULL;
441 }
443  if(!smpInstance) smpInstance= new ConsoleOut();
444  return smpInstance->pInstance;
445 }
447  std::string fname = smpInstance->pInstance->Filename();
449  smpInstance->pInstance=out;
451  smpInstance->pInstance->ToFile(fname);
452 }
453 void ConsoleOut::ToFile(const std::string& filename) {
454  if(pStream) { pStream->flush(); delete pStream; }
455  pStream=NULL;
456  mFilename=filename;
457  if(mFilename=="") return;
458  pStream = new std::ofstream();
459  pStream->open(mFilename.c_str(),std::ios::app);
460 }
461 void ConsoleOut::Write(const std::string& message,long int cntnow, long int cntdone, int verb) {
462  DoWrite(message,cntnow,cntdone,verb);
463 }
464 void ConsoleOut::DoWrite(const std::string& message,long int cntnow, long int cntdone, int verb) {
465  (void) cntnow; (void) cntdone;
466  if(mVerb<verb) return;
467  std::ostream* sout=pStream;
468  if(!sout) sout=&std::cout; // tmoor: used to be std::cerr, using std::cout to facilitate emscripten/js
469  *sout << message;
470  sout->flush();
471 }
472 
473 // global instance
475 
476 /** API wrapper Print at verbosity */
477 void Print(int v, const std::string& message) {
478  // print
479  std::ostringstream line;
480  line << "FAUDES_PRINT: " << message << std::endl;
481  faudes::ConsoleOut::G()->Write(line.str(),0,0,v);
482  // still do loop callback
483  LoopCallback();
484 }
485 void Print(const std::string& message) {
486  Print(1,message);
487 }
488 
489 /** API wrapper get/set verbosity */
490 void Verbosity(int v) {
492 }
493 int Verbosity(void) {
494  return faudes::ConsoleOut::G()->Verb();
495 }
496 
497 
498 // debugging: objectcount
499 std::map<std::string,long int>* ObjectCount::mspMax=NULL;
500 std::map<std::string,long int>* ObjectCount::mspCount=NULL;
501 bool ObjectCount::msDone=false;
503  mspCount= new std::map<std::string,long int>();
504  mspMax= new std::map<std::string,long int>();
505  msDone=true;
506 }
507 void ObjectCount::Init(void) {
508  if(!msDone) ObjectCount();
509 }
510 void ObjectCount::Inc(const std::string& rTypeName) {
511  if(!msDone) ObjectCount();
512  long int cnt = ((*mspCount)[rTypeName]+=1);
513  if((*mspMax)[rTypeName]<cnt) (*mspMax)[rTypeName]=cnt;
514 }
515 void ObjectCount::Dec(const std::string& rTypeName) {
516  if(!msDone) ObjectCount();
517  (*mspCount)[rTypeName]-=1;
518 }
519 
520 
521 // debugging: report on exit function
522 void ExitFunction(void){
523 #ifdef FAUDES_DEBUG_CODE
524  FAUDES_WRITE_CONSOLE("faudes::ExitFunction():");
525  // be sure its up and running
527  // get rid of all registry prototypes
528  //TypeRegistry::G()->ClearAll();
529  //FunctionRegistry::G()->Clear();
530  // prepare report
531  std::map<std::string,long int>::iterator cit;
532  cit=ObjectCount::mspCount->begin();
533  for(;cit!=ObjectCount::mspCount->end();cit++) {
534  FAUDES_WRITE_CONSOLE( cit->first << ": #" << ToStringInteger(cit->second) <<
535  " (max #" << (*ObjectCount::mspMax)[cit->first] << ")");
536  }
537 #endif
538 }
539 
540 
541 #ifdef FAUDES_DEBUG_CODE
542 // report on exit install
543 class ExitFunctionInstall {
544 private:
545  static bool mDone;
546  static ExitFunctionInstall mInstance;
547  ExitFunctionInstall(void) {
548  if(mDone) return;
549  FAUDES_WRITE_CONSOLE("ExitFunctionInstall()");
550  std::atexit(ExitFunction);
551  mDone=true;
552  }
553 };
554 // exit function: global data
555 bool ExitFunctionInstall::mDone=false;
556 ExitFunctionInstall ExitFunctionInstall::mInstance;
557 #endif
558 
559 // test protocol: token writer and file
561 std::string gTestProtocolFr;
562 
563 // test protocol: setup
564 std::string TestProtocol(const std::string& rSource) {
565  if(gTestProtocolTw) return gTestProtocolFr;
566  // set up filename
567  std::string filename=rSource;
568  // fix empty source
569  if(filename=="") filename="faudes_dump";
570  // remove directory
571  filename=ExtractFilename(filename);
572  // remove extension
573  std::string::size_type pos=0;
574  for(;pos<filename.length();pos++)
575  if(filename.at(pos)=='.') filename.at(pos)='_';
576  // append extension
577  filename.append(".prot");
578  // record nominal case
579  gTestProtocolFr=filename;
580  // prepend prefix
581  filename.insert(0,"tmp_");
582  // initialise token writer
583  gTestProtocolTw= new TokenWriter(filename);
584  // report filename
585  return gTestProtocolFr;
586 }
587 
588 // test protocol: dump
589 void TestProtocol(const std::string& rMessage, const Type& rData, bool full) {
590  if(!gTestProtocolTw) return;
591  gTestProtocolTw->WriteComment("%%% test mark: " + rMessage);
592  if(full) rData.Write(*gTestProtocolTw);
593  else rData.SWrite(*gTestProtocolTw);
597  *gTestProtocolTw << "\n";
598 }
599 void TestProtocol(const std::string& rMessage, bool data) {
600  Boolean fbool(data);
601  TestProtocol(rMessage,fbool,true);
602 }
603 void TestProtocol(const std::string& rMessage, long int data) {
604  Integer fint(data);
605  TestProtocol(rMessage,fint,true);
606 }
607 void TestProtocol(const std::string& rMessage, const std::string& rData) {
608  String fstr(rData);
609  TestProtocol(rMessage,fstr,true);
610 }
611 
612 // test protocol: compare
613 bool TestProtocol(void) {
614  // bail out on no protocol
615  if(!gTestProtocolTw) return true;
616  // close protocol file
617  std::string prot=gTestProtocolTw->FileName();
618  delete gTestProtocolTw;
619  gTestProtocolTw=NULL;
620  // open protocol
621  std::fstream fp;
622  fp.open(prot.c_str(), std::ios::in | std::ios::binary);
623  if(!fp.good()) {
624  FAUDES_WRITE_CONSOLE("TestProtocol(): could not open protocol \"" << prot << "\"");
625  return false;
626  }
627  // open reference
628  std::string ref=gTestProtocolFr;
629  std::fstream fr;
630  fr.open(ref.c_str(), std::ios::in | std::ios::binary);
631  if(!fr.good()) {
632  ref="data"+faudes_pathsep()+ref;
633  fr.clear(); // mingw's runtime will not clear on open
634  fr.open(ref.c_str(), std::ios::in | std::ios::binary);
635  }
636  if(!fr.good()) {
637  FAUDES_WRITE_CONSOLE("TestProtocol(): could not open/find reference \"" << gTestProtocolFr << "\"");
638  return true;
639  }
640  // perform comparision
641  int dline=-1;
642  int cline=1;
643  try{
644  while(true) {
645  // read next char
646  char cp = fp.get();
647  char cr= fr.get();
648  // eof
649  if(fp.eof() && fr.eof()) { break; }
650  if(!fp.good() || !fr.good()) { dline=cline; break;}
651  // cheap normalize cr/lf: ignore \r (assume no double \r
652  if( cp=='\r' && cr =='\r') continue;
653  if( cp=='\r' && fp.eof()){ dline=cline; break;}
654  if( cp=='\r') cp = fp.get();
655  if( cr=='\r' && fr.eof()){ dline=cline; break;}
656  if( cr=='\r') cr = fr.get();
657  // count lines
658  if( cr=='\n') cline++;
659  // sense mitmatch
660  if( cp!= cr ){dline=cline; break;}
661  }
662  } catch(std::ios::failure&) {
663  throw Exception("TestProtocol()", "io error at line " + ToStringInteger(cline), 1);
664  }
665  // done
666  if(dline>=0) {
667  FAUDES_WRITE_CONSOLE("TestProtocol(): using reference " << ref << "");
668  FAUDES_WRITE_CONSOLE("TestProtocol(): found difference at line " << dline << "");
669  }
670  return dline== -1;
671 }
672 
673 
674 
675 // declare loop callback
676 static bool (*gBreakFnct)(void)=0;
677 
678 // set loop callback
679 void LoopCallback( bool pBreak(void)) {
680  gBreakFnct=pBreak;
681 }
682 
683 // do loop callback
684 // note: this function is meant to be "quiet" during normal
685 // operation in order not to mess up console logging
686 void LoopCallback(void){
687  if(!gBreakFnct) return;
688  if(! (*gBreakFnct)() ) return;
689  throw Exception("LoopCallback", "break on application request", 110);
690 }
691 
692 } // namespace faudes
#define FAUDES_WRITE_CONSOLE(message)
#define FD_DF(message)
const std::string & faudes_pathseps(void)
const std::string & faudes_pathsep(void)
std::string faudes_extpath(const std::string &rPath)
#define XLITSTR(x)
Definition: cfl_utils.cpp:156
static ConsoleOut * G(void)
Definition: cfl_utils.cpp:442
ConsoleOut * pInstance
Definition: cfl_utils.h:363
std::ofstream * pStream
Definition: cfl_utils.h:357
static ConsoleOut * smpInstance
Definition: cfl_utils.h:365
virtual void DoWrite(const std::string &message, long int cntnow=0, long int cntdone=0, int verb=1)
Definition: cfl_utils.cpp:464
virtual ~ConsoleOut(void)
Definition: cfl_utils.cpp:438
const std::string & Filename(void)
Definition: cfl_utils.h:342
void Verb(int verb)
Definition: cfl_utils.h:346
virtual void Write(const std::string &message, long int cntnow=0, long int cntdone=0, int verb=1)
Definition: cfl_utils.cpp:461
std::string mFilename
Definition: cfl_utils.h:359
void Redirect(ConsoleOut *out)
Definition: cfl_utils.cpp:446
void ToFile(const std::string &filename)
Definition: cfl_utils.cpp:453
static bool msDone
Definition: cfl_utils.h:393
static void Init(void)
Definition: cfl_utils.cpp:507
static void Inc(const std::string &rTypeName)
Definition: cfl_utils.cpp:510
static void Dec(const std::string &rTypeName)
Definition: cfl_utils.cpp:515
static std::map< std::string, long int > * mspCount
Definition: cfl_utils.h:391
static std::map< std::string, long int > * mspMax
Definition: cfl_utils.h:390
std::string FileName(void) const
void WriteComment(const std::string &rComment)
void Write(const Type *pContext=0) const
Definition: cfl_types.cpp:145
void SWrite(TokenWriter &rTw) const
Definition: cfl_types.cpp:262
uint32_t Idx
std::string VersionString()
Definition: cfl_utils.cpp:141
std::string ExtractDirectory(const std::string &rFullPath)
Definition: cfl_utils.cpp:283
void LoopCallback(bool pBreak(void))
Definition: cfl_utils.cpp:679
std::string PrependPath(const std::string &rLeft, const std::string &rRight)
Definition: cfl_utils.cpp:330
Idx ToIdx(const std::string &rString)
Definition: cfl_utils.cpp:100
TokenWriter * gTestProtocolTw
Definition: cfl_utils.cpp:560
void ProcessDot(const std::string &rDotFile, const std::string &rOutFile, const std::string &rOutFormat, const std::string &rDotExec)
Definition: cfl_utils.cpp:177
std::string CreateTempFile(void)
Definition: cfl_utils.cpp:234
bool FileCopy(const std::string &rFromFile, const std::string &rToFile)
Definition: cfl_utils.cpp:424
std::string PluginsString()
Definition: cfl_utils.cpp:146
std::string ExpandString(const std::string &rString, unsigned int len)
Definition: cfl_utils.cpp:80
static bool(* gBreakFnct)(void)=0
Definition: cfl_utils.cpp:676
std::string BuildString()
Definition: cfl_utils.cpp:160
bool FileDelete(const std::string &rFilename)
Definition: cfl_utils.cpp:419
std::string ToStringFloat(Float number)
Definition: cfl_utils.cpp:64
std::string ExtractFilename(const std::string &rFullPath)
Definition: cfl_utils.cpp:292
std::string ToStringInteger16(Int number)
Definition: cfl_utils.cpp:54
double Float
std::string ContributorsString()
Definition: cfl_utils.cpp:151
std::string ToStringInteger(Int number)
Definition: cfl_utils.cpp:43
std::set< std::string > ReadDirectory(const std::string &rDirectory)
Definition: cfl_utils.cpp:375
void Verbosity(int v)
Definition: cfl_utils.cpp:490
std::string StringSubstitute(const std::string &rString, const std::string &rFrom, const std::string &rTo)
Definition: cfl_utils.cpp:121
std::string ToLowerCase(const std::string &rString)
Definition: cfl_utils.cpp:111
void Print(int v, const std::string &message)
Definition: cfl_utils.cpp:477
std::string gTestProtocolFr
Definition: cfl_utils.cpp:561
std::string ExtractBasename(const std::string &rFullPath)
Definition: cfl_utils.cpp:301
bool DirectoryExists(const std::string &rDirectory)
Definition: cfl_utils.cpp:359
std::string TestProtocol(const std::string &rSource)
Definition: cfl_utils.cpp:564
void ExitFunction(void)
Definition: cfl_utils.cpp:522
bool FileExists(const std::string &rFilename)
Definition: cfl_utils.cpp:412
std::string ExtractSuffix(const std::string &rFullPath)
Definition: cfl_utils.cpp:315
std::string CollapsString(const std::string &rString, unsigned int len)
Definition: cfl_utils.cpp:91
long int Int

libFAUDES 2.33h --- 2025.06.18 --- c++ api documentaion by doxygen