Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
FunNameStack.h File Reference
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include "wcpplib/stream/prstream.h"
#include "wcpplib/util/inlinec.h"

Go to the source code of this file.

Classes

class  ExcFromSpexit
 
class  FunNameStack
 
class  FunNameStack_Assist
 
class  FunNameWatch
 
class  GenError
 

Macros

#define stackprt(stream)   stream << FunNameStack::instance()
 
#define mfunname(string)
 
#define mfunname1(string)
 
#define mfunname2(string)
 
#define mfunname3(string)
 
#define mfunname4(string)
 
#define mfunname5(string)
 
#define mfunnamep(string)
 
#define mfunnamep1(string)
 
#define mfunnamep2(string)
 
#define mfunnamep3(string)
 
#define mfunnamep4(string)
 
#define mfunnamep5(string)
 
#define DO_CHECKS
 
#define check_econd(condition, add, stream)
 
#define check_wcond(condition, add, stream)
 
#define check_econd1(condition, a1, stream)
 
#define check_wcond1(condition, a1, stream)
 
#define check_econd2(condition, a1, a2, stream)
 
#define check_wcond2(condition, a1, a2, stream)
 
#define check_econd3(condition, a1, a2, a3, stream)
 
#define check_wcond3(condition, a1, a2, a3, stream)
 
#define check_econd4(condition, a1, a2, a3, a4, stream)
 
#define check_wcond4(condition, a1, a2, a3, a4, stream)
 
#define check_econd11(a, signb, stream)
 
#define check_wcond11(a, signb, stream)
 
#define check_econd12(a, sign, b, stream)
 
#define check_wcond12(a, sign, b, stream)
 
#define check_econd11a(a, signb, add, stream)
 
#define check_wcond11a(a, signb, add, stream)
 
#define check_econd12a(a, sign, b, add, stream)
 
#define check_wcond12a(a, sign, b, add, stream)
 
#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
 
#define check_wcond21(a, sign1_b1_sign0, sign2_b2, stream)
 
#define check_econd23(a, sign1, b1, sign0, sign2, b2, stream)
 
#define check_wcond23(a, sign1, b1, sign0, sign2, b2, stream)
 
#define check_econd24(a1, sign1, b1, sign0, a2, sign2, b2, stream)
 
#define check_wcond24(a1, sign1, b1, sign0, a2, sign2, b2, stream)
 
#define spexit(stream)
 

Functions

void spexit_action (std::ostream &file)
 
std::ostream & operator<< (std::ostream &file, const FunNameStack &f)
 
std::ostream & operator<< (std::ostream &file, const FunNameWatch &f)
 

Variables

int s_throw_exception_in_spexit
 
int s_exit_without_core
 
const int pqname = 1000
 

Macro Definition Documentation

◆ check_econd

#define check_econd (   condition,
  add,
  stream 
)
Value:
if (condition) { \
stream << "ERROR:\n"; \
stream << '\n' << #condition << '\n'; \
stream << add; \
spexit(stream); \
}

Definition at line 292 of file FunNameStack.h.

◆ check_econd1

#define check_econd1 (   condition,
  a1,
  stream 
)
Value:
if (condition) { \
stream << "ERROR:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << '\n'; \
spexit(stream); \
}

Definition at line 306 of file FunNameStack.h.

◆ check_econd11

#define check_econd11 (   a,
  signb,
  stream 
)
Value:
if (a signb) { \
stream << "ERROR:\n"; \
stream << '\n' << #a << #signb << '\n'; \
stream << #a << '=' << (a) << '\n'; \
spexit(stream); \
}

Definition at line 366 of file FunNameStack.h.

◆ check_econd11a

#define check_econd11a (   a,
  signb,
  add,
  stream 
)
Value:
if (a signb) { \
stream << "ERROR:\n"; \
stream << '\n' << #a << #signb << '\n'; \
stream << #a << '=' << (a) << '\n'; \
stream << add; \
spexit(stream); \
}

Definition at line 395 of file FunNameStack.h.

◆ check_econd12

#define check_econd12 (   a,
  sign,
  b,
  stream 
)
Value:
if (a sign b) { \
stream << "ERROR:\n"; \
stream << '\n' << #a << #sign << #b << '\n'; \
stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
spexit(stream); \
}

Definition at line 380 of file FunNameStack.h.

◆ check_econd12a

#define check_econd12a (   a,
  sign,
  b,
  add,
  stream 
)
Value:
if (a sign b) { \
stream << "ERROR:\n"; \
stream << '\n' << #a << #sign << #b << '\n'; \
stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
stream << add; \
spexit(stream); \
}

Definition at line 411 of file FunNameStack.h.

◆ check_econd2

#define check_econd2 (   condition,
  a1,
  a2,
  stream 
)
Value:
if (condition) { \
stream << "ERROR:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #a2 << '=' << (a2) << '\n'; \
spexit(stream); \
}

Definition at line 320 of file FunNameStack.h.

◆ check_econd21

#define check_econd21 (   a,
  sign1_b1_sign0,
  sign2_b2,
  stream 
)
Value:
if(a sign1_b1_sign0 a sign2_b2) { \
stream << "ERROR:\n"; \
stream << '\n' << #a << #sign1_b1_sign0 << #a << #sign2_b2 << '\n'; \
stream << #a << '=' << (a) << '\n'; \
spexit(stream); \
}

Definition at line 428 of file FunNameStack.h.

◆ check_econd23

#define check_econd23 (   a,
  sign1,
  b1,
  sign0,
  sign2,
  b2,
  stream 
)
Value:
if(a sign1 b1 sign0 a sign2 b2) { \
stream << "ERROR:\n"; \
stream << '\n' << #a << #sign1 << #b1 << #sign0 << #a << #sign2 << #b2 \
<< '\n'; \
stream << #a << '=' << (a) << ' ' << #b1 << '=' << (b1) << ' ' << #b2 \
<< '=' << (b2) << '\n'; \
spexit(stream); \
}

Definition at line 443 of file FunNameStack.h.

◆ check_econd24

#define check_econd24 (   a1,
  sign1,
  b1,
  sign0,
  a2,
  sign2,
  b2,
  stream 
)
Value:
if(a1 sign1 b1 sign0 a2 sign2 b2) { \
stream << "ERROR:\n"; \
stream << '\n' << #a1 << #sign1 << #b1 << #sign0 << #a2 << #sign2 << #b2 \
<< '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #b1 << '=' << (b1) << '\n'; \
stream << #a2 << '=' << (a2) << ' ' << #b2 << '=' << (b2) << '\n'; \
spexit(stream); \
}

Definition at line 462 of file FunNameStack.h.

◆ check_econd3

#define check_econd3 (   condition,
  a1,
  a2,
  a3,
  stream 
)
Value:
if (condition) { \
stream << "ERROR:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #a2 << '=' << (a2) << ' ' << #a3 \
<< '=' << (a3) << '\n'; \
spexit(stream); \
}

Definition at line 334 of file FunNameStack.h.

◆ check_econd4

#define check_econd4 (   condition,
  a1,
  a2,
  a3,
  a4,
  stream 
)
Value:
if (condition) { \
stream << "ERROR:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #a2 << '=' << (a2) << ' ' << #a3 \
<< '=' << (a3) << ' ' << #a4 << '=' << (a4) << '\n'; \
spexit(stream); \
}

Definition at line 350 of file FunNameStack.h.

◆ check_wcond

#define check_wcond (   condition,
  add,
  stream 
)
Value:
if (condition) { \
stream << "WARNING:\n"; \
stream << '\n' << #condition << '\n'; \
stream << add; \
}

Definition at line 299 of file FunNameStack.h.

◆ check_wcond1

#define check_wcond1 (   condition,
  a1,
  stream 
)
Value:
if (condition) { \
stream << "WARNING:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << '\n'; \
}

Definition at line 313 of file FunNameStack.h.

◆ check_wcond11

#define check_wcond11 (   a,
  signb,
  stream 
)
Value:
if (a signb) { \
stream << "WARNING:\n"; \
stream << '\n' << #a << #signb << '\n'; \
stream << #a << '=' << (a) << '\n'; \
}

Definition at line 373 of file FunNameStack.h.

◆ check_wcond11a

#define check_wcond11a (   a,
  signb,
  add,
  stream 
)
Value:
if (a signb) { \
stream << "WARNING:\n"; \
stream << '\n' << #a << #signb << '\n'; \
stream << #a << '=' << (a) << '\n'; \
stream << add; \
}

Definition at line 403 of file FunNameStack.h.

◆ check_wcond12

#define check_wcond12 (   a,
  sign,
  b,
  stream 
)
Value:
if (a sign b) { \
stream << "WARNING:\n"; \
stream << '\n' << #a << #sign << #b << '\n'; \
stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
}

Definition at line 387 of file FunNameStack.h.

◆ check_wcond12a

#define check_wcond12a (   a,
  sign,
  b,
  add,
  stream 
)
Value:
if (a sign b) { \
stream << "WARNING:\n"; \
stream << '\n' << #a << #sign << #b << '\n'; \
stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
stream << add; \
}

Definition at line 419 of file FunNameStack.h.

◆ check_wcond2

#define check_wcond2 (   condition,
  a1,
  a2,
  stream 
)
Value:
if (condition) { \
stream << "WARNING:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #a2 << '=' << (a2) << '\n'; \
}

Definition at line 327 of file FunNameStack.h.

◆ check_wcond21

#define check_wcond21 (   a,
  sign1_b1_sign0,
  sign2_b2,
  stream 
)
Value:
if(a sign1_b1_sign0 a sign2_b2) { \
stream << "WARNING:\n"; \
stream << '\n' << #a << #sign1_b1_sign0 << #a << #sign2_b2 << '\n'; \
stream << #a << '=' << (a) << '\n'; \
}

Definition at line 435 of file FunNameStack.h.

◆ check_wcond23

#define check_wcond23 (   a,
  sign1,
  b1,
  sign0,
  sign2,
  b2,
  stream 
)
Value:
if(a sign1 b1 sign0 a sign2 b2) { \
stream << "WARNING:\n"; \
stream << '\n' << #a << #sign1 << #b1 << #sign0 << #a << #sign2 << #b2 \
<< '\n'; \
stream << #a << '=' << (a) << ' ' << #b1 << '=' << (b1) << ' ' << #b2 \
<< '=' << (b2) << '\n'; \
}

Definition at line 452 of file FunNameStack.h.

◆ check_wcond24

#define check_wcond24 (   a1,
  sign1,
  b1,
  sign0,
  a2,
  sign2,
  b2,
  stream 
)
Value:
if(a1 sign1 b1 sign0 a2 sign2 b2) { \
stream << "WARNING:\n"; \
stream << '\n' << #a1 << #sign1 << #b1 << #sign0 << #a2 << #sign2 << #b2 \
<< '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #b1 << '=' << (b1) << '\n'; \
stream << #a2 << '=' << (a2) << ' ' << #b2 << '=' << (b2) << '\n'; \
}

Definition at line 471 of file FunNameStack.h.

◆ check_wcond3

#define check_wcond3 (   condition,
  a1,
  a2,
  a3,
  stream 
)
Value:
if (condition) { \
stream << "WARNING:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #a2 << '=' << (a2) << ' ' << #a3 \
<< '=' << (a3) << '\n'; \
}

Definition at line 342 of file FunNameStack.h.

◆ check_wcond4

#define check_wcond4 (   condition,
  a1,
  a2,
  a3,
  a4,
  stream 
)
Value:
if (condition) { \
stream << "WARNING:\n"; \
stream << '\n' << #condition << '\n'; \
stream << #a1 << '=' << (a1) << ' ' << #a2 << '=' << (a2) << ' ' << #a3 \
<< '=' << (a3) << ' ' << #a4 << '=' << (a4) << '\n'; \
}

Definition at line 358 of file FunNameStack.h.

◆ DO_CHECKS

#define DO_CHECKS

Definition at line 97 of file FunNameStack.h.

◆ mfunname

#define mfunname (   string)

Definition at line 67 of file FunNameStack.h.

◆ mfunname1

#define mfunname1 (   string)

Definition at line 68 of file FunNameStack.h.

◆ mfunname2

#define mfunname2 (   string)

Definition at line 69 of file FunNameStack.h.

◆ mfunname3

#define mfunname3 (   string)

Definition at line 70 of file FunNameStack.h.

◆ mfunname4

#define mfunname4 (   string)

Definition at line 71 of file FunNameStack.h.

◆ mfunname5

#define mfunname5 (   string)

Definition at line 72 of file FunNameStack.h.

◆ mfunnamep

#define mfunnamep (   string)
Value:
static const char* FunNameIIII = string; \
FunNameWatch funnw(FunNameIIII)

Definition at line 77 of file FunNameStack.h.

◆ mfunnamep1

#define mfunnamep1 (   string)
Value:
static const char* FunNameIIII1 = string; \
FunNameWatch funnw1(FunNameIIII1)

Definition at line 80 of file FunNameStack.h.

◆ mfunnamep2

#define mfunnamep2 (   string)
Value:
static const char* FunNameIIII2 = string; \
FunNameWatch funnw2(FunNameIIII2)

Definition at line 83 of file FunNameStack.h.

◆ mfunnamep3

#define mfunnamep3 (   string)
Value:
static const char* FunNameIIII3 = string; \
FunNameWatch funnw3(FunNameIIII3)

Definition at line 86 of file FunNameStack.h.

◆ mfunnamep4

#define mfunnamep4 (   string)
Value:
static const char* FunNameIIII4 = string; \
FunNameWatch funnw4(FunNameIIII4)

Definition at line 89 of file FunNameStack.h.

◆ mfunnamep5

#define mfunnamep5 (   string)
Value:
static const char* FunNameIIII5 = string; \
FunNameWatch funnw5(FunNameIIII5)

Definition at line 92 of file FunNameStack.h.

◆ spexit

#define spexit (   stream)
Value:
{ \
stackprt(stream); \
stream << "File is " << __FILE__ << " , line number is " << __LINE__ \
<< '\n'; \
spexit_action(stream); \
}

Definition at line 536 of file FunNameStack.h.

◆ stackprt

#define stackprt (   stream)    stream << FunNameStack::instance()

Definition at line 44 of file FunNameStack.h.

Function Documentation

◆ operator<<() [1/2]

std::ostream & operator<< ( std::ostream &  file,
const FunNameStack f 
)

Definition at line 667 of file FunNameStack.cpp.

476 {
477 if (f.s_act == 1) {
478#ifdef USE_BOOST_MULTITHREADING
479 file << "FunNameStack: s_init=" << f.s_init << '\n';
480 long nret, qret;
481 NameStack* ns = f.get_thread_stack_q(nret, qret);
482 file << " id=" << ns->id << " qname=" << ns->qname << '\n';
483 file << "At the time of scanning there were " << qret << " threads \n"
484 << "registered in FunNameStack system.\n";
485 file << "The current one appeared nth: " << nret << '\n';
486 int n;
487 for (n = 0; n < ns->qname; n++) {
488 //file << " n =" << std::setw(3) << n << " " << f.name[n] << '\n';
489 file << std::setw(3) << n << " " << ns->name[n] << " \n";
490 }
491#else
492 file << "FunNameStack: s_init=" << f.s_init << " qname=" << f.qname << '\n';
493 int n;
494 for (n = 0; n < f.qname; n++) {
495 //file << " n =" << std::setw(3) << n << " " << f.name[n] << '\n';
496 file << std::setw(3) << n << " " << f.name[n] << " \n";
497 }
498#endif
499 }
500 return file;
501}

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  file,
const FunNameWatch f 
)

Definition at line 503 of file FunNameStack.cpp.

503 {
504 f.hdr(file);
505 return file;
506}
std::ostream & hdr(std::ostream &file) const
Definition: FunNameStack.h:718

◆ spexit_action()

void spexit_action ( std::ostream &  file)

Definition at line 314 of file FunNameStack.cpp.

314 {
315 file << "spexit_action: the streams will be now flushed\n";
316 file.flush();
317 mcout.flush();
318 mcerr.flush();
320 if (s_exit_without_core == 1) {
321 file << "spexit_action: the exit(1) function is called\n";
322 exit(1);
323 } else {
324 file << "spexit_action: the abort function is called\n";
325 abort();
326 }
327 } else {
328 file << "spexit_action: an exception is now called\n";
329 throw ExcFromSpexit();
330 }
331}
int s_exit_without_core
int s_throw_exception_in_spexit
#define mcout
Definition: prstream.h:133
#define mcerr
Definition: prstream.h:135

Variable Documentation

◆ pqname

const int pqname = 1000

Definition at line 544 of file FunNameStack.h.

Referenced by FunNameStack::FunNameStack().

◆ s_exit_without_core

int s_exit_without_core
extern

Definition at line 64 of file FunNameStack.cpp.

Referenced by spexit_action().

◆ s_throw_exception_in_spexit

int s_throw_exception_in_spexit
extern

Definition at line 63 of file FunNameStack.cpp.

Referenced by spexit_action().