more secure string operations
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleStatus.cxx
CommitLineData
4a6b108b 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
3301427a 18Revision 1.4 2006/10/02 16:38:39 jgrosseo
19update (alberto):
20fixed memory leaks
21storing of objects that failed to be stored to the grid before
22interfacing of shuttle status table in daq system
23
2bb7b766 24Revision 1.3 2006/08/29 09:16:05 jgrosseo
25small update
26
85a80aa9 27Revision 1.2 2006/08/15 10:50:00 jgrosseo
28effc++ corrections (alberto)
29
4f0ab988 30Revision 1.1 2006/07/20 13:20:13 jgrosseo
31introducing status management: The processing per subdetector is divided into several steps,
32after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
33can keep track of the number of failures and skips further processing after a certain threshold is
34exceeded. These thresholds can be configured in LDAP.
35
4a6b108b 36*/
37
38//
39// This class stores the status of the Shuttle processing for a given run and a given detector
40//
41// This class stores the status of the processing, the number of retries and the timestamp of the last action
42// The detector and run number are stored using the CDB framework
43//
44//
45
46#include "AliShuttleStatus.h"
47
48ClassImp(AliShuttleStatus)
49
2bb7b766 50//______________________________________________________________________________________________
4a6b108b 51AliShuttleStatus::AliShuttleStatus() : TObject(),
52 fTimeStamp(0),
53 fStatus(kInvalid),
54 fCount(0)
55{
56 // default constructor
57}
58
2bb7b766 59//______________________________________________________________________________________________
4a6b108b 60AliShuttleStatus::AliShuttleStatus(Status status) : TObject(),
61 fTimeStamp(0),
62 fStatus(status),
63 fCount(1)
64{
65 // constructor
66
67 fTimeStamp = time(0);
68}
69
2bb7b766 70//______________________________________________________________________________________________
4f0ab988 71AliShuttleStatus::AliShuttleStatus(const AliShuttleStatus& c) :
72TObject(c), fTimeStamp(0),
73fStatus(kInvalid),
74fCount(1)
4a6b108b 75{
76 // copy constructor
77
78 ((AliShuttleStatus &)c).Copy(*this);
79}
80
2bb7b766 81//______________________________________________________________________________________________
4a6b108b 82AliShuttleStatus::~AliShuttleStatus()
83{
84 // destructor
85}
86
2bb7b766 87//______________________________________________________________________________________________
4a6b108b 88AliShuttleStatus &AliShuttleStatus::operator=(const AliShuttleStatus &c)
89{
90 // assigment operator
91
92 if (this != &c)
93 ((AliShuttleStatus &) c).Copy(*this);
94
95 return *this;
96}
97
2bb7b766 98//______________________________________________________________________________________________
4a6b108b 99void AliShuttleStatus::Copy(TObject& c) const
100{
101 // copy function
102
103 AliShuttleStatus& target = (AliShuttleStatus &) c;
104
105 target.fTimeStamp = fTimeStamp;
106 target.fStatus = fStatus;
107 target.fCount = fCount;
108}
109
2bb7b766 110//______________________________________________________________________________________________
4a6b108b 111void AliShuttleStatus::SetStatus(Status status)
112{
113 // sets a new status, add the same time the timestamp is set to now
114
115 fStatus = status;
116 fTimeStamp = time(0);
117}
118
2bb7b766 119//______________________________________________________________________________________________
4a6b108b 120const char* AliShuttleStatus::GetStatusName(Status status)
121{
122 // returns a name (string) of the status
123
124 switch (status)
125 {
126 case kInvalid: return "Invalid";
127 case kStarted: return "Started";
128 case kDCSStarted: return "DCSStarted";
129 case kDCSError: return "DCSError";
130 case kPPStarted: return "PPStarted";
3301427a 131 case kPPTimeOut: return "PPTimeOut";
132 case kPPOutOfMemory: return "PPOutOfMemory";
4a6b108b 133 case kPPError: return "PPError";
3301427a 134 case kPPDone: return "PPDone";
135 case kStoreStarted: return "StoreStarted";
136 case kStoreError: return "StoreError";
4a6b108b 137 case kDone: return "Done";
138 case kFailed: return "Failed";
5e993b6f 139 case kStoreDelayed: return "StoreDelayed";
140 case kFXSError: return "FXSError";
ffa25f20 141 case kSkipped: return "Skipped";
5ca8f352 142 case kOCDBError: return "OCDBError";
4a6b108b 143 }
144
145 return 0;
146}