Logo coherent WaveBurst  
Library Reference Guide
Logo
HistoryTest.C
Go to the documentation of this file.
1 //
2 // Test History Class
3 // Author : Gabriele Vedovato
4 
5 
6 {
7 
8 /* Al costruttore vanno passati nome e numero degli stages e dei tipi ammessi per ognuno dei precedenti.
9  L'elenco degli stage e dei tipi attualmente deve essere un vettore di stringhe
10 */
11 
12 char* Stages[2];
13 Stages[0] = new char[256];
14 Stages[1] = new char[256];
15 char* Types[3];
16 Types[0] = new char[256];
17 Types[1] = new char[256];
18 Types[2] = new char[256];
19 strcpy(Stages[0], "FME 1");
20 strcpy(Stages[1], "FME 2");
21 strcpy(Types[0], "Tipo 1");
22 strcpy(Types[1], "Tipo 2");
23 strcpy(Types[2], "Tipo 3");
24 
25 CWB::History HistoryTest(Stages, 2, Types, 3);
26 
27 /* Al solito sono presenti una schiera di metodi per verificare se uno Stage/Tipo e' ammesso
28  (StageAllowed(char* Name)/TypeAllowed(char* Name)), se e' gia' presente (StageAlreadyPresent(char* Name)), etc
29  A titolo di esempio:
30 */
31 
32 cout << HistoryTest.StageAllowed((char*)"FME 1") << endl;
33 cout << HistoryTest.StageAllowed((char*)"FME 3") << endl;
34 cout << HistoryTest.StageAlreadyPresent((char*)"FME 1") << endl;
35 cout << HistoryTest.StageAlreadyPresent((char*)"FME 3") << endl;
36 
37 /* L'aggiunta di informazioni di Log avviene mediante il metodo
38  void AddLog(char* Stage, char* Log, TDatime* Time = NULL)
39  oppure
40  void AddLog(char* Stage, char* Log, TDatime* Time = NULL)
41  In cui deve essere indicato lo stage di appartenenza e il testo del Log.
42  Il log viene annotato con la data specificata, altrimenti con l'ora di sistema corrispondente all'inserimento
43 */
44 
45 
46 HistoryTest.AddLog((char*)"FME 1", (char*)"LOG1");
47 HistoryTest.AddLog((char*)"FME 1", (char*)"LOG2");
48 HistoryTest.AddLog((char*)"FME 2", (char*)"LOG3");
49 
50 /*
51  L'inserimento di voci dell'History avviene mediante il metodo
52  void AddHistory(char* Stage, char* Type, char* History, TDatime* Time = NULL)
53  oppure
54  void AddHistory(char* Stage, char* Type, char* History, int Date, int Time)
55  con le stesse modalita' del Log
56 */
57 
58 HistoryTest.AddHistory((char*)"FME 2", (char*)"Tipo 1", (char*)"HIST1");
59 
60 /*
61  Per visualizzare l'History e' possibile chiamare il metodo Print (utilizzato anche Browse),
62 */
63 
65 
66 /*
67  Altrimenti e' possibile richiamare le singole voci appartenentu ad uno stage/tipo con il metodo GetHistory.
68  Richiamato con la stringa rappresentante lo stage e il tipo, questo ritornera' una copia
69  della stringa corrispondente all'History oppure, se la voce non e' presente, NULL.
70  Ad esempio:
71 */
72 
73 cout << HistoryTest.GetHistory((char*)"FME 2", (char*)"Tipo 1") << endl;
74 
75 }
Stages[0]
Definition: HistoryTest.C:13
void Print()
Definition: History.cc:315
bool StageAlreadyPresent(char *Name)
Definition: History.cc:107
CWB::History HistoryTest(Stages, 2, Types, 3)
bool StageAllowed(char *Name)
Definition: History.cc:99
void AddLog(char *Stage, char *Log, TDatime *Time=NULL)
Definition: History.cc:187
strcpy(Stages[0], "FME 1")
char * GetHistory(char *StageName, char *Type)
Definition: History.cc:273
char * Types[3]
Definition: HistoryTest.C:15
void AddHistory(char *Stage, char *Type, char *History, TDatime *Time=NULL)
Definition: History.cc:225