-
Notifications
You must be signed in to change notification settings - Fork 0
/
osctest.cc
157 lines (120 loc) · 3.47 KB
/
osctest.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// Yo, Emacs! This is -*- C++ -*-
//
// $Id: osctest.cc,v 1.3 2002/06/26 14:20:16 dwchin Exp $
//
// Author: David Chin <[email protected]>
//
// 2477 Randall Lab, Univ. of Michigan
// 500 E. University Ave.
// Ann Arbor, MI 48109
// +1-734-764-5146
// +1-734-730-1274
//
// Written based on idea by K. Riles <[email protected]>
#include "OperStateCondList.hh"
#include "DatEnv.hh"
using namespace std;
class osctest
: public DatEnv
{
public:
int maxFrame;
osctest(int argc, const char *argv[]);
~osctest();
void ProcessData();
private:
int mFrameCount;
OperStateCondList mOsclist;
int mDebug;
};
#ifndef __CINT__
#include <fstream>
#include <iostream>
#include <cstdlib>
#include "TSeries.hh"
#include "FSeries.hh"
#include "Dacc.hh"
// Generate main routine
EXECDAT(osctest);
#endif // !def __CINT__
// Constructor
osctest::osctest(int argc, const char *argv[])
: DatEnv(argc, argv),
maxFrame(999999),
mOsclist(getDacc(),3)
{
std::string configfile;
for (int i = 0; i < argc; ++i) {
if (strcmp(argv[i], "-config") == 0) {
if (++i == argc)
break;
configfile = argv[i];
}
}
cout << "Starting osctest from config file '"
<< configfile << "'...." << endl;
if (configfile.length() == 0)
configfile = "osctest.config";
// Set debug level
mDebug = 2;
// Set time stride
float tStep = 1.0;
mIn.setStride(tStep);
// Initialize frame counter
mFrameCount = 0;
// Read in config file
mOsclist.readConfig(configfile);
// Set debug level of X_arm_lock_acquired
//mOsclist.setDebug("X_arm_lock_acquired", 3);
if (mDebug > 2)
cout << "WHERE ARE WE? Line #" << __LINE__ << endl;
OperStateCondList::const_iterator iter = mOsclist.begin();
for ( ; iter != mOsclist.end(); ++iter) {
cout << (*iter).first << ": ";
(*iter).second->printInfo();
}
if (mDebug > 0) {
cout << mIn.getTime() << endl;
mIn.list(cout); // list added channels
if (mDebug > 2)
cout << "DONE WITH OSCTEST CONSTRUCTOR!" << endl;
}
}
// Destructor
osctest::~osctest()
{
cout << "osctest is done" << endl;
}
// Frame processing function
void osctest::ProcessData()
{
if (mDebug > 2)
cout << "HERE WE ARE! Line#" << __LINE__ << endl;
++mFrameCount;
cout << "Entered ProcessData() with frame count = "
<< mFrameCount << endl;
OperStateCondList::iterator iter = mOsclist.begin();
for (; iter != mOsclist.end(); ++iter) {
std::cout << "'" << (*iter).first << "'\t" << std::endl;
if ((*iter).second->satisfied() == true)
std::cout << "\tsatisfied" << std::endl;
else
std::cout << "\t\tNOT satisfied" << std::endl;
}
std::cout << std::endl;
/*
std::cout << "CUBAAN!" << std::endl;
std::string foo = "Foo";
if (mOsclist.satisfied(foo + "Bar")) {
std::cout << foo + "Bar" << " = satisfied" << std::endl;
} else {
std::cout << foo + "Bar" << " = NOT satisfied" << std::endl;
}
*/
// cout << "Foo watchedQuantity = "
// << mOsclist.watchedQuantity("Foo") << endl;
// cout << "TestAbsPowAbove watchedQuantity = "
// << mOsclist.watchedQuantity("TestAbsPowAbove") << endl;
// cout << "SHORT watchedQuantity = "
// << mOsclist.watchedQuantity("SHORT") << endl;
}