EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ValContext.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ValContext.cxx
1 #include "ValContext.h"
2 
3 
5 
6 
8  : fDetector(Detector::kUnknown),
9  fSimFlag(SimFlag::kUnknown),
10  fTimeStamp()
11 {
12  // Default constructor (unknown experiment, simflag, timestamp=now)
13 }
14 
16 
17 
18 
19 
20 //_____________________________________________________________________________
21 std::ostream& operator<<(std::ostream& os, const ValContext& vldc)
22 {
23  if (os.good()) {
24  if (os.tie()) { os.tie()->flush(); } // instead of opfx
25  os << vldc.AsString();
26  }
27  // instead of os.osfx()
28  if (os.flags() & std::ios::unitbuf) { os.flush(); }
29  return os;
30 }
31 
32 //_____________________________________________________________________________
34  const SimFlag::SimFlag_t mcFlag,
35  const ValTimeStamp& tstamp)
36  : TObject(),
37  fDetector(detector),
38  fSimFlag(mcFlag),
39  fTimeStamp(tstamp)
40 {
41  // normal constructor
42 }
43 
44 //_____________________________________________________________________________
45 const char* ValContext::AsString(Option_t* option) const
46 {
47  // Return a formatted string of the contents of this object
48  // User should copy result because it points to a
49  // statically allocated string.
50 
51  static char newstring[80] = " ";
52 
53  switch (option[0]) {
54  case 'c':
55  case 'C':
56  sprintf(newstring,"{%c%c %s}",
59  fTimeStamp.AsString("c"));
60  break;
61  default:
62  sprintf(newstring,"{%6.6s|%6.6s|%s}",
65  fTimeStamp.AsString("c"));
66  }
67 
68  return newstring;
69 }
70 
71 //_____________________________________________________________________________
72 void ValContext::Print(Option_t* option) const
73 {
74  printf("%s\n",AsString(option));
75 }
76 
77 //_____________________________________________________________________________
78 Bool_t ValContext::IsNull() const
79 {
80  // Return true if this was initialized by default ctor
81  // we can only test detector type and simflag
83 
84 }
85 
86 //_____________________________________________________________________________
87