Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HistoryStage.cc
Go to the documentation of this file.
1 /***************************************************************************
2  HistoryStage.cpp - description
3  -------------------
4  begin : ven set 2 2005
5  copyright : (C) 2005 by Stefano Longo
6  email : Stefano.Longo@lnl.infn.it
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "HistoryStage.hh"
19 #include "HistoryLine.hh"
20 #include "HistoryLogLine.hh"
21 #include "TObjString.h"
22 
23 CWB::HistoryStage::HistoryStage(char** HistoryTypes, int TypeNumber, char* Name, char* Comment, TDatime* Time) {
24  TTimeStamp CreationTT;
25 
26  Init();
27  CreationDate_Sec = CreationTT.GetSec();
28  CreationDate_NSec = CreationTT.GetNanoSec();
29  if ((HistoryTypes != NULL) && (TypeNumber > 0)){
30  for (int i = 0; i < TypeNumber; i++) {
31  if (HistoryTypes[i] == NULL) HistoryStageException(kBreak, "CWB::HistoryStage::HistoryStage", "HistoryTypes[%i] is NULL", i);
32  this->HistoryTypes.AddLast(new TObjString(HistoryTypes[i]));
33  }
34  }
35 
36  if (Name != NULL) SetName(Name);
37  if (Comment != NULL) SetComment(Comment);
38  if (Time != NULL) {
39  this->Date = Time->GetDate();
40  this->Time = Time->GetTime();
41  }
42  else {
43  TDatime tmpTime;
44  this->Date = tmpTime.GetDate();
45  this->Time = tmpTime.GetTime();
46  }
47 }
48 
49 CWB::HistoryStage::HistoryStage(const TList& HistoryTypes, char* Name, char* Comment, TDatime* Time) {
50  TTimeStamp CreationTT;
51 
52  Init();
53  CreationDate_Sec = CreationTT.GetSec();
54  CreationDate_NSec = CreationTT.GetNanoSec();
55  if (Name == NULL) HistoryStageException(kBreak, "CWB::HistoryStage::HistoryStage", "Name is NULL");
56 
57  for (int i = 0; i < HistoryTypes.GetSize(); i++) {
58  TObjString *tmpString = static_cast<TObjString*>(HistoryTypes.At(i));
59  this->HistoryTypes.AddLast(tmpString);
60  }
61 
62  if (Name != NULL) SetName(Name);
63  if (Comment != NULL) SetComment(Comment);
64  if (Time != NULL) {
65  this->Date = Time->GetDate();
66  this->Time = Time->GetTime();
67  }
68  else {
69  TDatime tmpTime;
70  this->Date = tmpTime.GetDate();
71  this->Time = tmpTime.GetTime();
72  }
73 }
74 
75 CWB::HistoryStage::HistoryStage(char** HistoryTypes, int TypeNumber, char* Name, char* Comment, int Date, int Time) {
76  TTimeStamp CreationTT;
77 
78  Init();
79  CreationDate_Sec = CreationTT.GetSec();
80  CreationDate_NSec = CreationTT.GetNanoSec();
81  if (HistoryTypes == NULL) HistoryStageException(kBreak, "CWB::HistoryStage::HistoryStage", "HistoryType is NULL");
82  if (Name == NULL) HistoryStageException(kBreak, "CWB::HistoryStage::HistoryStage", "Name is NULL");
83 
84  for (int i = 0; i < TypeNumber; i++) {
85  if (HistoryTypes[i] == NULL) HistoryStageException(kBreak, "CWB::HistoryStage::HistoryStage", "HistoryTypes[%i] is NULL", i);
86  this->HistoryTypes.AddLast(new TObjString(HistoryTypes[i]));
87  }
88  SetName(Name);
89  SetComment(Comment);
90  this->Date = Date;
91  this->Time = Time;
92 }
93 
94 CWB::HistoryStage::HistoryStage(const TList& HistoryTypes, char* Name, char* Comment, int Date, int Time) {
95  TTimeStamp CreationTT;
96 
97  CreationDate_Sec = CreationTT.GetSec();
98  CreationDate_NSec = CreationTT.GetNanoSec();
99  if (Name == NULL) HistoryStageException(kBreak, "HistoryStage::HistoryStage", "Name is NULL");
100 
101  for (int i = 0; i < HistoryTypes.GetSize(); i++) {
102  TObjString *tmpString = static_cast<TObjString*>(HistoryTypes.At(i));
103  this->HistoryTypes.AddLast(tmpString);
104  }
105 
106  SetName(Name);
107  SetComment(Comment);
108  this->Date = Date;
109  this->Time = Time;
110 }
111 
113  int i;
114 
115  this->Date = HistoryStage.Date;
116  this->Time = HistoryStage.Time;
117  this->NameLength = HistoryStage.NameLength;
118  if (HistoryStage.Name != NULL) this->Name = strdup(HistoryStage.Name);
119  else this->Name = NULL;
120  this->CommentLength = HistoryStage.CommentLength;
121  if (HistoryStage.Comment != NULL) this->Comment = strdup(HistoryStage.Comment);
122  else this->Comment = NULL;
123 
124  for (i = 0; i < HistoryStage.HistoryTypes.GetSize(); i++) {
125  this->HistoryTypes.AddLast(new TObjString(*static_cast<TObjString*>(HistoryStage.HistoryTypes.At(i))));
126  }
127  for (i = 0; i < HistoryStage.History.GetSize(); i++) {
128  this->History.AddLast(new HistoryLine(*static_cast<HistoryLine*>(HistoryStage.History.At(i))));
129  }
130  for (i = 0; i < HistoryStage.Logs.GetSize(); i++) {
131  this->Logs.AddLast(new HistoryLogLine(*static_cast<HistoryLogLine*>(HistoryStage.Logs.At(i))));
132  }
133  this->SortOrder = HistoryStage.SortOrder;
134  this->AscendingOrder = HistoryStage.AscendingOrder;
135  this->CreationDate_Sec = HistoryStage.CreationDate_Sec;
136  this->CreationDate_NSec = HistoryStage.CreationDate_NSec;
137 }
138 
140  Destroy();
141 }
142 
143 char*
145  if (Name == NULL) HistoryStageException(kBreak, "HistoryStage::SetName", "Name is NULL");
146  NameSet(Name);
147 
148  return Name;
149 }
150 
151 char*
153  if (Comment == NULL) HistoryStageException(kBreak, "HistoryStage::SetComment", "Comment is NULL");
154  CommentSet(Comment);
155 
156  return Comment;
157 }
158 
159 void
161  this->Date = Time->GetDate();
162  this->Time = Time->GetTime();
163 }
164 
165 void
166 CWB::HistoryStage::SetTime(int Date, int Time) {
167  this->Date = Date;
168  this->Time = Time;
169 }
170 
171 void
172 CWB::HistoryStage::SetTypes(char** HistoryTypes, int TypeNumber) {
173  int i;
174  char* StrApp;
175  HistoryLine* HistoryLineApp;
176 
177  if (HistoryTypes == NULL) HistoryStageException(kBreak, "HistoryStage::SetTypes", "HistoryType is NULL");
178 
179  this->HistoryTypes.Delete();
180 
181  for (i = 0; i < TypeNumber; i++) {
182  this->HistoryTypes.AddLast(new TObjString(HistoryTypes[i]));
183  }
184 
185  for (i = 0; i < History.GetSize(); i++) {
186  HistoryLineApp = static_cast<HistoryLine*>(History.At(i));
187  StrApp = HistoryLineApp->GetHistoryType();
188  if (!TypeAllowed(StrApp)) History.Remove(HistoryLineApp);
189  delete StrApp;
190  }
191 }
192 
193 char*
195  int i;
196  HistoryLine* TempHistory = NULL;
197  char *TempString = NULL;
198 
199  if (!TypeAllowed(Type))
200  HistoryStageException(kBreak, "CWB::HistoryStage::SetTypeComment", "Type %s not allowed", Type);
201 
202  if (!TypeAlreadyPresent(Type))
203  HistoryStageException(kBreak, "CWB::HistoryStage::SetTypeComment", "Type %s not present yet", Type);
204 
205  for(i = 0; i < History.GetSize(); i++) {
206  TempHistory = static_cast<HistoryLine*>(History.At(i));
207  TempString = TempHistory->GetHistoryType();
208  if (strcmp(TempString, Type) == 0) TempHistory->SetHistoryComment(Comment);
209  delete TempString;
210  }
211 
212  return Comment;
213 }
214 
215 char*
217  if (Name == NULL) return NULL;
218  else return strdup(Name);
219 }
220 
221 char*
223  if (Comment == NULL) return NULL;
224  else return strdup(Comment);
225 }
226 
227 int
229  return Date;
230 }
231 
232 int
234  return Time;
235 }
236 
237 TDatime*
239  return new TDatime(Date, Time);
240 }
241 
242 char*
244  int i;
245  HistoryLine* TempHistory = NULL;
246  char *TempString = NULL, *TempComment = NULL;
247 
248  if (!TypeAllowed(Type))
249  HistoryStageException(kBreak, "CWB::HistoryStage::GetTypeComment", "Type %s not allowed", Type);
250 
251  if (!TypeAlreadyPresent(Type))
252  HistoryStageException(kBreak, "CWB::HistoryStage::GetTypeComment", "Type %s not present yet", Type);
253 
254  for(i = 0; i < History.GetSize(); i++) {
255  TempHistory = static_cast<HistoryLine*>(History.At(i));
256  TempString = TempHistory->GetHistoryType();
257  if (strcmp(TempString, Type) == 0) TempComment = TempHistory->GetHistoryComment();
258  delete TempString;
259  }
260 
261  return TempComment;
262 }
263 
264 void
265 CWB::HistoryStage::AddLog(char* LogMsg, TDatime* Time) {
266  HistoryLogLine* TempLog;
267 
268  TempLog = new HistoryLogLine(LogMsg, Time);
269  TempLog->SetSortOrder(SortOrder);
270  if (AscendingOrder) TempLog->SetAscendingSortOrder();
271  else TempLog->SetDescendantSortOrder();
272  Logs.AddLast(TempLog);
273 }
274 
275 void
276 CWB::HistoryStage::AddLog(char* LogMsg, int Date, int Time) {
277  HistoryLogLine* TempLog;
278 
279  TempLog = new HistoryLogLine(LogMsg, Date, Time);
280  TempLog->SetSortOrder(SortOrder);
281  if (AscendingOrder) TempLog->SetAscendingSortOrder();
282  else TempLog->SetDescendantSortOrder();
283 
284  Logs.AddLast(TempLog);
285 }
286 
287 void
288 CWB::HistoryStage::AddHistory(char* Type, char* History, char* Comment, bool Replace) {
289  HistoryLine* TempHistory;
290  char* StrApp;
291  int i;
292 
293  if (!TypeAllowed(Type)) HistoryStageException(kBreak, "CWB::HistoryStage::AddHistory", "Type not allowed");
294  if (TypeAlreadyPresent(Type)) {
295  if (!Replace) HistoryStageException(kBreak, "CWB::HistoryStage::AddHistory", "Type already present");
296  else {
297  for (i = 0; i < this->History.GetSize(); i++) {
298  StrApp = static_cast<HistoryLine*>(this->History.At(i))->GetHistoryType();
299  if (strcmp(StrApp, Type) == 0) {
300  this->History.Remove(this->History.At(i));
301  }
302  delete StrApp;
303  }
304  }
305  }
306 
307  TempHistory = new HistoryLine(Type, Comment, History);
308  TempHistory->SetSortOrder(SortOrder);
309  if (AscendingOrder) TempHistory->SetAscendingSortOrder();
310  else TempHistory->SetDescendantSortOrder();
311  this->History.AddLast(TempHistory);
312 }
313 
314 int
316  return History.GetSize();
317 }
318 
319 int
321  return Logs.GetSize();
322 }
323 
324 char*
326  if ((index < 0) || (index >= History.GetSize())) HistoryStageException(kBreak, "CWB::HistoryStage::GetHistoryEntry", "Index (%i) out of bounds", index);
327  else return static_cast<HistoryLine*>(History.At(index))->GetHistoryStr();
328  return NULL;
329 }
330 
331 char*
333  if ((index < 0) || (index >= History.GetSize())) HistoryStageException(kBreak, "CWB::HistoryStage::GetHistoryEntryType", "Index (%i) out of bounds", index);
334  else return static_cast<HistoryLine*>(History.At(index))->GetHistoryType();
335  return NULL;
336 }
337 
338 char*
340  if ((index < 0) || (index >= Logs.GetSize())) HistoryStageException(kBreak, "CWB::HistoryStage::GetLogEntry", "Index (%i) out of bounds", index);
341  else return static_cast<HistoryLogLine*>(Logs.At(index))->GetLogStr();
342  return NULL;
343 }
344 
345 int
347  if ((index < 0) || (index >= Logs.GetSize())) HistoryStageException(kBreak, "CWB::HistoryStage::GetLogEntryDate", "Index (%i) out of bounds", index);
348  else return static_cast<HistoryLogLine*>(Logs.At(index))->GetLogDate();
349  return 0;
350 }
351 
352 int
354  if ((index < 0) || (index >= Logs.GetSize())) HistoryStageException(kBreak, "CWB::HistoryStage::GetLogEntryTime", "Index (%i) out of bounds", index);
355  else return static_cast<HistoryLogLine*>(Logs.At(index))->GetLogTime();
356  return 0;
357 }
358 
359 TDatime*
361  if ((index < 0) || (index >= Logs.GetSize())) HistoryStageException(kBreak, "CWB::HistoryStage::GetLogEntryDatime", "Index (%i) out of bounds", index);
362  else return static_cast<HistoryLogLine*>(Logs.At(index))->GetLogDatime();
363  return NULL;
364 }
365 
366 char*
368  int i;
369  char* StrApp;
370 
371  if (!TypeAllowed(Type)) HistoryStageException(kBreak, "CWB::HistoryStage::GetHistory", " Illegal Type");
372 
373  for (i = 0; i < History.GetSize(); i++) {
374  StrApp = static_cast<HistoryLine*>(History.At(i))->GetHistoryType();
375  if (strcmp(StrApp, Type) == 0) {
376  delete StrApp;
377  return static_cast<HistoryLine*>(History.At(i))->GetHistoryStr();
378  }
379  delete StrApp;
380  }
381  return NULL;
382 }
383 
384 void
386  Logs.Sort(Ascending);
387 }
388 
389 bool
391  char* StrApp;
392 
393  //for (int i = 0; i < TypeNumber; i++) {
394  for (int i = 0; i < History.GetSize(); i++) {
395  StrApp = static_cast<HistoryLine*>(History.At(i))->GetHistoryType();
396  if (strcmp(StrApp, Type) == 0) {
397  //delete StrApp;
398  return true;
399  }
400  //delete StrApp;
401  }
402  return false;
403 }
404 
405 bool
407  //for (int i = 0; i < TypeNumber; i++) {
408  for (int i = 0; i < HistoryTypes.GetSize(); i++) {
409  //if (strcmp(Type, HistoryTypes[i]) == 0) return true;
410  if (strcmp(Type, static_cast<TObjString*>(HistoryTypes.At(i))->GetName()) == 0) return true;
411  }
412  return false;
413 }
414 
415 void
417  Print();
418 }
419 
420 void
422  TDatime tmpTime(Date, Time);
423  int i;
424 
425  cout << "Stage Time : " << tmpTime.GetYear() << "/" << tmpTime.GetMonth() << "/" << tmpTime.GetDay() << " - ";
426  cout << tmpTime.GetHour() << ":" << tmpTime.GetMinute() << ":" << tmpTime.GetSecond() << endl;
427  cout << Name << "'s History" << endl;
428 
429  for (i = 0; i < History.GetSize(); i++) {
430  static_cast<HistoryLine*>(History.At(i))->Print();
431  }
432 
433  cout << Name << "'s Logs" << endl;
434  for (i = 0; i < Logs.GetSize(); i++) {
435  static_cast<HistoryLogLine*>(Logs.At(i))->Print();
436  }
437 }
438 
439 bool
441  return true;
442 }
443 
444 int
445 CWB::HistoryStage::Compare(const TObject* Obj) const{
446  char* StrTmp = NULL;
447  int Result;
448 
449  switch(SortOrder) {
450  case InsertionOrder :
451  if (this->CreationDate_Sec < static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->CreationDate_Sec) Result = -1;
452  else if (this->CreationDate_Sec > static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->CreationDate_Sec) Result = 1;
453  else if (this->CreationDate_NSec < static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->CreationDate_NSec) Result = -1;
454  else if (this->CreationDate_NSec > static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->CreationDate_NSec) Result = 1;
455  else Result = 0;
456  break;
457  case ElementDate :
458  if (this->Date < static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->Date) Result = -1;
459  else if (this->Date > static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->Date) Result = 1;
460  else Result = 0;
461  break;
462  case Alphabetical :
463  StrTmp = static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->GetName();
464  Result = strcmp(this->Name, StrTmp);
465  delete StrTmp;
466  if (Result == 0) {
467  StrTmp = static_cast<HistoryStage*>(const_cast<TObject*>(Obj))->GetComment();
468  Result = strcmp(this->Comment, StrTmp);
469  delete StrTmp;
470  }
471  break;
472  default :
473 // HistoryStageException(kBreak, "CWB::HistoryStage::Compare", "Sort order not supported");
474  exit(1);
475  break;
476  }
477 
478  return Result;
479 }
480 
481 char*
482 CWB::HistoryStage::AddType(char* TypeName) {
483  if (TypeAllowed(TypeName))
484  HistoryStageException(kBreak, "CWB::HistoryStage::AddType", "Type %s already present", TypeName);
485 
486  HistoryTypes.AddLast(new TObjString(TypeName));
487 
488  return TypeName;
489 }
490 
491 char*
493  HistoryLine* tmpHistory;
494  TObjString* TempString;
495  char* StrApp;
496  int i;
497 
498  if (!TypeAllowed(TypeName))
499  HistoryStageException(kBreak, "CWB::HistoryStage::RemoveType", "Type %s not present", TypeName);
500 
501  for (i = 0; i < HistoryTypes.GetSize(); i++) {
502  TempString = static_cast<TObjString*>(HistoryTypes.At(i));
503  if (strcmp(TempString->GetName(), TypeName) == 0) HistoryTypes.Remove(TempString);
504  }
505 
506  for (i = 0; i < History.GetSize(); i++) {
507  tmpHistory = static_cast<HistoryLine*>(History.At(i));
508  StrApp = tmpHistory->GetHistoryType();
509  if (!TypeAllowed(StrApp)) History.Remove(tmpHistory);
510  delete StrApp;
511  }
512 
513  return TypeName;
514 }
515 
518  int i;
519 
520  this->SortOrder = SortOrder;
521  for (i = 0; i < History.GetSize(); i++) {
522  static_cast<HistoryLine*>(History.At(i))->SetSortOrder(SortOrder);
523  }
524  for (i = 0; i < Logs.GetSize(); i++) {
525  static_cast<HistoryLogLine*>(Logs.At(i))->SetSortOrder(SortOrder);
526  }
527  return this->SortOrder;
528 }
529 
532  return SortOrder;
533 }
534 
535 bool
537  if (SortOrder == InsertionOrder) return true;
538  else return false;
539 }
540 
541 bool
543  if (SortOrder == ElementDate) return true;
544  else return false;
545 }
546 
547 bool
549  if (SortOrder == Alphabetical) return true;
550  else return false;
551 }
552 
553 bool
555  int i;
556 
557  AscendingOrder = true;
558  for (i = 0; i < History.GetSize(); i++) {
559  static_cast<HistoryLine*>(History.At(i))->SetAscendingSortOrder();
560  }
561  for (i = 0; i < Logs.GetSize(); i++) {
562  static_cast<HistoryLogLine*>(Logs.At(i))->SetAscendingSortOrder();
563  }
564  return AscendingOrder;
565 }
566 
567 bool
569  int i;
570 
571  AscendingOrder = false;
572  for (i = 0; i < History.GetSize(); i++) {
573  static_cast<HistoryLine*>(History.At(i))->SetDescendantSortOrder();
574  }
575  for (i = 0; i < Logs.GetSize(); i++) {
576  static_cast<HistoryLogLine*>(Logs.At(i))->SetDescendantSortOrder();
577  }
578  return AscendingOrder;
579 }
580 
581 bool
583  return AscendingOrder;
584 }
585 
586 bool
588  return !AscendingOrder;
589 }
590 
591 void
593  History.Sort(AscendingOrder);
594  Logs.Sort(AscendingOrder);
595 }
596 
597 TTimeStamp
599  TTimeStamp CreationTT(CreationDate_Sec, CreationDate_NSec);
600  return CreationTT;
601 }
602 
603 void
605  NameLength = 0;
606  Name = NULL;
607 
608  /*
609  CommentLength = 0;
610  Comment = NULL;
611  */
612 
613  CommentLength = 1; //Da correggere: non serializzare stringhe nulle, serializzare stringhe [0]=0
614  Comment = new char[1];
615  Comment[0]=0;
616  SortOrder = DEFAULT_SORT_ORDER;
617  AscendingOrder = DEFAULT_ASCENDING;
618 }
619 
620 void
622  if (Name != NULL) delete Name;
623  if (Comment != NULL) delete Name;
624 }
625 
626 void
628 
629  if (this->Name != NULL) delete this->Name;
630 
631  if (Name != NULL) {
632  NameLength = strlen(Name) + 1;
633  this->Name = new char[NameLength];
634  strcpy(this->Name, Name);
635  }
636  else {
637  NameLength = 1;
638  this->Name = new char[1];
639  this->Name[0] = 0;
640  }
641 }
642 
643 void
645  if (this->Comment != NULL) delete this->Comment;
646 
647  if (Comment != NULL) {
648  CommentLength = strlen(Comment) + 1;
649  this->Comment = new char[CommentLength];
650  strcpy(this->Comment, Comment);
651  }
652  else {
653  CommentLength = 1;
654  this->Comment = new char[1];
655  this->Comment[0] = 0;
656  }
657 }
658 
659 void CWB::HistoryStage::Streamer(TBuffer &R__b)
660 {
661  // Stream an object of class HistoryStage.
662  TDatime CreationDatime;
663  TTimeStamp CreationTT;
664 
665  UInt_t R__s, R__c;
666  if (R__b.IsReading()) {
667  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
668  TObject::Streamer(R__b);
669  R__b >> Date;
670  R__b >> Time;
671  HistoryTypes.Streamer(R__b);
672  R__b >> NameLength;
673  delete [] Name;
674  Name = new char[NameLength];
675  R__b.ReadFastArray(Name,NameLength);
676  History.Streamer(R__b);
677  Logs.Streamer(R__b);
678  if (R__v > 1) {
679  R__b >> CommentLength;
680  delete [] Comment;
681  Comment = new char[CommentLength];
682  R__b.ReadFastArray(Comment,CommentLength);
683  R__b >> (Int_t&)SortOrder;
684  R__b >> AscendingOrder;
685  if (R__v == 1) {
686  CreationDatime.Streamer(R__b);
687  CreationTT.Set(CreationDatime.GetYear(), CreationDatime.GetMonth(), CreationDatime.GetDay(), CreationDatime.GetHour(), CreationDatime.GetMinute(), CreationDatime.GetSecond(), 0, true, 0);
688  CreationDate_Sec = CreationTT.GetSec();
689  CreationDate_NSec = CreationTT.GetNanoSec();
690  }
691  else {
692  R__b >> CreationDate_Sec;
693  R__b >> CreationDate_NSec;
694  R__b.CheckByteCount(R__s, R__c, CWB::HistoryStage::IsA());
695  }
696  }
697  else {
698  CommentLength = 0;
699  Comment = NULL;
700  SortOrder = DEFAULT_SORT_ORDER;
701  AscendingOrder = DEFAULT_ASCENDING;
702  CreationDate_Sec = CreationTT.GetSec();
703  CreationDate_NSec = CreationTT.GetNanoSec();
704  }
705  } else {
706  R__c = R__b.WriteVersion(CWB::HistoryStage::IsA(), kTRUE);
707  TObject::Streamer(R__b);
708  R__b << Date;
709  R__b << Time;
710  HistoryTypes.Streamer(R__b);
711  R__b << NameLength;
712  R__b.WriteFastArray(Name,NameLength);
713  History.Streamer(R__b);
714  Logs.Streamer(R__b);
715  R__b << CommentLength;
716  R__b.WriteFastArray(Comment,CommentLength);
717  R__b << (Int_t)SortOrder;
718  R__b << AscendingOrder;
719  R__b << CreationDate_Sec;
720  R__b << CreationDate_NSec;
721  R__b.SetByteCount(R__c, kTRUE);
722  }
723 }
724 
725 void
726 CWB::HistoryStage::HistoryStageException(int type, const char *location, const char *msgfmt, ...) {
727  cout << location << " " << msgfmt << endl;
728  exit(1);
729 }
char * GetHistoryType()
Definition: HistoryLine.cc:77
bool SetDescendantSortOrder()
void HistoryStageException(int type, const char *location, const char *msgfmt,...)
#define DEFAULT_SORT_ORDER
TDatime * GetLogEntryDatime(int index)
void Init()
Definition: ChirpMass.C:280
bool SetAscendingSortOrder()
Definition: HistoryLine.cc:165
void NameSet(char *Name)
bool TypeAllowed(char *Type)
plot hist2D SetName("WSeries-1")
char * RemoveType(char *TypeName)
SortOrderType
SortOrderType SetSortOrder(SortOrderType SortOrder)
SortOrderType SetSortOrder(SortOrderType SortOrder)
bool SetDescendantSortOrder()
Definition: HistoryLine.cc:171
virtual void Browse(TBrowser *b)
bool IsSortOrderInsertion()
char * GetHistoryComment()
Definition: HistoryLine.cc:83
i drho i
void SetTypes(char **HistoryTypes, int TypeNumber)
void SetTime(TDatime *Time)
HistoryStage(char **HistoryTypes=NULL, int TypeNumber=0, char *Name=NULL, char *Comment=NULL, TDatime *Time=NULL)
Definition: HistoryStage.cc:23
MDC Print()
SortOrderType SetSortOrder(SortOrderType SortOrder)
Definition: HistoryLine.cc:135
bool IsSortOrderAlphabetical()
int Compare(const TObject *Obj) const
char * SetName(char *Name)
void AddLog(char *LogMsg, TDatime *Time=NULL)
TDatime * GetDatime()
char * GetHistory(char *Type)
char * GetHistoryEntryType(int index)
SortOrderType SortOrder
bool GetDescendantSortOrder()
char * AddType(char *TypeName)
char * GetHistoryEntry(int index)
TTimeStamp GetCreationTimeStamp()
bool SetAscendingSortOrder()
char * SetComment(char *Comment)
wavearray< int > index
int GetLogEntryDate(int index)
bool IsSortable() const
void AddHistory(char *Type, char *History, char *Comment=NULL, bool Replace=false)
SortOrderType GetSortOrder()
int GetLogEntryTime(int index)
strcpy(RunLabel, RUN_LABEL)
#define DEFAULT_ASCENDING
bool GetAscendingSortOrder()
char * GetLogEntry(int index)
bool TypeAlreadyPresent(char *Type)
char * SetTypeComment(char *Type, char *Comment)
char * SetHistoryComment(char *Comment)
Definition: HistoryLine.cc:65
char * GetTypeComment(char *Type)
Type
Definition: FrDisplay.cc:105
void SortLogs(bool Ascending=true)
void Sort()
Definition: History.cc:637
void CommentSet(char *Comment)
exit(0)