Take switched off super modules into account
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleStatus.cxx
... / ...
CommitLineData
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$
18*/
19
20//
21// This class stores the status of the Shuttle processing for a given run and a given detector
22//
23// This class stores the status of the processing, the number of retries and the timestamp of the last action
24// The detector and run number are stored using the CDB framework
25//
26//
27
28#include "AliShuttleStatus.h"
29
30ClassImp(AliShuttleStatus)
31
32AliShuttleStatus::AliShuttleStatus() : TObject(),
33 fTimeStamp(0),
34 fStatus(kInvalid),
35 fCount(0)
36{
37 // default constructor
38}
39
40AliShuttleStatus::AliShuttleStatus(Status status) : TObject(),
41 fTimeStamp(0),
42 fStatus(status),
43 fCount(1)
44{
45 // constructor
46
47 fTimeStamp = time(0);
48}
49
50AliShuttleStatus::AliShuttleStatus(const AliShuttleStatus& c) : TObject(c)
51{
52 // copy constructor
53
54 ((AliShuttleStatus &)c).Copy(*this);
55}
56
57AliShuttleStatus::~AliShuttleStatus()
58{
59 // destructor
60}
61
62AliShuttleStatus &AliShuttleStatus::operator=(const AliShuttleStatus &c)
63{
64 // assigment operator
65
66 if (this != &c)
67 ((AliShuttleStatus &) c).Copy(*this);
68
69 return *this;
70}
71
72void AliShuttleStatus::Copy(TObject& c) const
73{
74 // copy function
75
76 AliShuttleStatus& target = (AliShuttleStatus &) c;
77
78 target.fTimeStamp = fTimeStamp;
79 target.fStatus = fStatus;
80 target.fCount = fCount;
81}
82
83void AliShuttleStatus::SetStatus(Status status)
84{
85 // sets a new status, add the same time the timestamp is set to now
86
87 fStatus = status;
88 fTimeStamp = time(0);
89}
90
91const char* AliShuttleStatus::GetStatusName(Status status)
92{
93 // returns a name (string) of the status
94
95 switch (status)
96 {
97 case kInvalid: return "Invalid";
98 case kStarted: return "Started";
99 case kDCSStarted: return "DCSStarted";
100 case kDCSError: return "DCSError";
101 case kPPStarted: return "PPStarted";
102 case kPPError: return "PPError";
103 case kPPDone: return "PPDone";
104 case kDone: return "Done";
105 case kFailed: return "Failed";
106 }
107
108 return 0;
109}