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