39 #include "TObjString.h" 42 TTimeStamp CreationTT;
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]));
54 if (Name != NULL)
SetName(Name);
57 this->
Date = Time->GetDate();
58 this->Time = Time->GetTime();
62 this->
Date = tmpTime.GetDate();
63 this->Time = tmpTime.GetTime();
68 TTimeStamp CreationTT;
75 for (
int i = 0;
i < HistoryTypes.GetSize();
i++) {
76 TObjString *tmpString =
static_cast<TObjString*
>(HistoryTypes.At(
i));
77 this->HistoryTypes.AddLast(tmpString);
80 if (Name != NULL)
SetName(Name);
83 this->
Date = Time->GetDate();
84 this->Time = Time->GetTime();
88 this->
Date = tmpTime.GetDate();
89 this->Time = tmpTime.GetTime();
94 TTimeStamp CreationTT;
99 if (HistoryTypes == NULL)
HistoryStageException(kBreak,
"CWB::HistoryStage::HistoryStage",
"HistoryType is NULL");
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]));
113 TTimeStamp CreationTT;
119 for (
int i = 0;
i < HistoryTypes.GetSize();
i++) {
120 TObjString *tmpString =
static_cast<TObjString*
>(HistoryTypes.At(
i));
121 this->HistoryTypes.AddLast(tmpString);
136 if (HistoryStage.
Name != NULL) this->
Name = strdup(HistoryStage.
Name);
137 else this->
Name = NULL;
142 for (i = 0; i < HistoryStage.
HistoryTypes.GetSize(); i++) {
145 for (i = 0; i < HistoryStage.
History.GetSize(); i++) {
148 for (i = 0; i < HistoryStage.
Logs.GetSize(); i++) {
179 this->
Date = Time->GetDate();
180 this->Time = Time->GetTime();
195 if (HistoryTypes == NULL)
HistoryStageException(kBreak,
"HistoryStage::SetTypes",
"HistoryType is NULL");
197 this->HistoryTypes.Delete();
199 for (i = 0; i < TypeNumber; i++) {
200 this->HistoryTypes.AddLast(
new TObjString(HistoryTypes[i]));
203 for (i = 0; i <
History.GetSize(); i++) {
215 char *TempString = NULL;
223 for(i = 0; i <
History.GetSize(); i++) {
235 if (
Name == NULL)
return NULL;
236 else return strdup(
Name);
241 if (
Comment == NULL)
return NULL;
264 char *TempString = NULL, *TempComment = NULL;
272 for(i = 0; i <
History.GetSize(); i++) {
275 if (strcmp(TempString, Type) == 0) TempComment = TempHistory->
GetHistoryComment();
290 Logs.AddLast(TempLog);
302 Logs.AddLast(TempLog);
313 if (!Replace)
HistoryStageException(kBreak,
"CWB::HistoryStage::AddHistory",
"Type already present");
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));
325 TempHistory =
new HistoryLine(Type, Comment, History);
329 this->History.AddLast(TempHistory);
339 return Logs.GetSize();
344 if ((index < 0) || (index >=
History.GetSize()))
HistoryStageException(kBreak,
"CWB::HistoryStage::GetHistoryEntry",
"Index (%i) out of bounds", index);
351 if ((index < 0) || (index >=
History.GetSize()))
HistoryStageException(kBreak,
"CWB::HistoryStage::GetHistoryEntryType",
"Index (%i) out of bounds", index);
358 if ((index < 0) || (index >=
Logs.GetSize()))
HistoryStageException(kBreak,
"CWB::HistoryStage::GetLogEntry",
"Index (%i) out of bounds", index);
365 if ((index < 0) || (index >=
Logs.GetSize()))
HistoryStageException(kBreak,
"CWB::HistoryStage::GetLogEntryDate",
"Index (%i) out of bounds", index);
372 if ((index < 0) || (index >=
Logs.GetSize()))
HistoryStageException(kBreak,
"CWB::HistoryStage::GetLogEntryTime",
"Index (%i) out of bounds", index);
379 if ((index < 0) || (index >=
Logs.GetSize()))
HistoryStageException(kBreak,
"CWB::HistoryStage::GetLogEntryDatime",
"Index (%i) out of bounds", index);
391 for (i = 0; i <
History.GetSize(); i++) {
393 if (strcmp(StrApp, Type) == 0) {
404 Logs.Sort(Ascending);
414 if (strcmp(StrApp, Type) == 0) {
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;
447 for (i = 0; i <
History.GetSize(); i++) {
451 cout <<
Name <<
"'s Logs" << endl;
452 for (i = 0; i <
Logs.GetSize(); i++) {
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;
482 Result = strcmp(this->
Name, StrTmp);
486 Result = strcmp(this->
Comment, StrTmp);
512 TObjString* TempString;
520 TempString =
static_cast<TObjString*
>(
HistoryTypes.At(i));
521 if (strcmp(TempString->GetName(), TypeName) == 0)
HistoryTypes.Remove(TempString);
524 for (i = 0; i <
History.GetSize(); i++) {
539 for (i = 0; i <
History.GetSize(); i++) {
542 for (i = 0; i <
Logs.GetSize(); i++) {
576 for (i = 0; i <
History.GetSize(); i++) {
579 for (i = 0; i <
Logs.GetSize(); i++) {
590 for (i = 0; i <
History.GetSize(); i++) {
593 for (i = 0; i <
Logs.GetSize(); i++) {
647 if (this->Name != NULL)
delete this->
Name;
656 this->Name =
new char[1];
663 if (this->Comment != NULL)
delete this->
Comment;
665 if (Comment != NULL) {
668 strcpy(this->Comment, Comment);
672 this->Comment =
new char[1];
673 this->Comment[0] = 0;
677 void CWB::HistoryStage::Streamer(TBuffer &R__b)
680 TDatime CreationDatime;
681 TTimeStamp CreationTT;
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);
693 R__b.ReadFastArray(
Name,NameLength);
700 R__b.ReadFastArray(
Comment,CommentLength);
704 CreationDatime.Streamer(R__b);
705 CreationTT.Set(CreationDatime.GetYear(), CreationDatime.GetMonth(), CreationDatime.GetDay(), CreationDatime.GetHour(), CreationDatime.GetMinute(), CreationDatime.GetSecond(), 0,
true, 0);
712 R__b.CheckByteCount(R__s, R__c, CWB::HistoryStage::IsA());
724 R__c = R__b.WriteVersion(CWB::HistoryStage::IsA(), kTRUE);
725 TObject::Streamer(R__b);
730 R__b.WriteFastArray(
Name,NameLength);
734 R__b.WriteFastArray(
Comment,CommentLength);
739 R__b.SetByteCount(R__c, kTRUE);
745 cout << location <<
" " << msgfmt << endl;
bool SetDescendantSortOrder()
void HistoryStageException(int type, const char *location, const char *msgfmt,...)
#define DEFAULT_SORT_ORDER
TDatime * GetLogEntryDatime(int index)
bool SetAscendingSortOrder()
bool TypeAllowed(char *Type)
char * RemoveType(char *TypeName)
SortOrderType SetSortOrder(SortOrderType SortOrder)
SortOrderType SetSortOrder(SortOrderType SortOrder)
bool SetDescendantSortOrder()
virtual void Browse(TBrowser *b)
bool IsSortOrderInsertion()
int Compare(const TObject *Obj) const
char * GetHistoryComment()
bool SetDescendantSortOrder()
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)
SortOrderType SetSortOrder(SortOrderType SortOrder)
bool IsSortOrderAlphabetical()
char * SetName(char *Name)
void AddLog(char *LogMsg, TDatime *Time=NULL)
char * GetHistory(char *Type)
char * GetHistoryEntryType(int index)
bool GetDescendantSortOrder()
char * AddType(char *TypeName)
char * GetHistoryEntry(int index)
TTimeStamp GetCreationTimeStamp()
bool SetAscendingSortOrder()
bool SetAscendingSortOrder()
char * SetComment(char *Comment)
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)
char * GetTypeComment(char *Type)
void SortLogs(bool Ascending=true)
void CommentSet(char *Comment)