ICP  1
newicp.cpp
Go to the documentation of this file.
1 // newicp.cpp : Defines the entry point for the console application.
2 //
3 #include "stdafx.h"
4 #include "isisraw.h"
5 #include "isisinstrumentcontrol.h"
6 #include "labview_xml.h"
7 
8 int readLabviewXMLfromFile(const char* filename);
9 
10 
11 int _tmain(int argc, _TCHAR* argv[])
12 {
13  DAEstatus status;
14  std::string s;
15  CoInitialize(NULL);
16  LabviewXML lvxml(status);
17  lvxml.loadFromFile("c:\\test.xml", status);
18  lvxml.setValue("To 1","1240.0", status);
19  lvxml.getValue("To 2",s, status);
20  lvxml.saveToFile("c:\\test.txt", status);
21  lvxml.saveToString(s, status);
22  lvxml.close();
23  CoUninitialize();
24  return 0;
26  inst.readTables("c:\\newicp\\wir_025.dat",
27  "c:\\newicp\\det_cal_025.dat",
28  "c:\\newicp\\spec_mid-tubes_025.dat",
29  status);
30 // inst.flushCRPT(status);
31  inst.setLinearTimeChannelRange(0,100.0, 20000.0, 100.0, status);
32  inst.beginRun(status);
33 // inst.pauseRun(status);
34  int i;
35  ISISRAW raw_file, raw_file2;
36  FILE* input_file;
37 // input_file = fopen("c:\\map06245.raw","rb");
38 // raw_file.ioRAW(input_file, true);
39 // fclose(input_file);
40  FILE* output_file = fopen("c:\\freddie.raw","w+b");
41  raw_file.ioRAW(output_file, false);
42  fclose(output_file);
43  input_file = fopen("c:\\freddie.raw","rb");
44  raw_file2.ioRAW(input_file, true);
45  fclose(input_file);
46  for(i=0; i< raw_file.i_mon; i++)
47  {
48  std::cout << raw_file.mdet[i] << std::endl;
49  std::cout << raw_file.monp[i] << std::endl;
50  }
51  for(i=raw_file.i_det-100; i< raw_file.i_det; i++)
52  {
53  std::cout << raw_file.spec[i] << std::endl;
54  }
55  Sleep(120000);
56  return 0;
57 }
58 #if 0
59  isisU16_t data16;
60  isisU32_t data32;
61  DAE1Sim* dae = new DAE1Sim();
62  dae->open("VXI0::MEMACC");
63  dae->getRawFrames(&data32);
64  cerr << "Raw frames are " << dec << data32 << endl;
66  dae->startRun(false);
67 // dae->RIO16(1234, &data16, 1);
68  cerr << dae->isRunning() << endl;
69  dae->close();
70  delete dae;
71  return 0;
72 #endif
73 
int ioRAW(FILE *file, bool from_file)
Definition: isisraw.cpp:639
int setValue(const char *name, const char *value, DAEstatus &status)
int loadFromFile(const char *filename, DAEstatus &status)
int setLinearTimeChannelRange(int range_number, float start, float end, float step, DAEstatus &status)
int * monp
Definition: isisraw.h:274
int readTables(const char *wiring, const char *detector, const char *spectra, DAEstatus &status)
bool isRunning(DAEstatus &status)
Definition: isisdae.cpp:1129
unsigned long isisU32_t
Definition: isisvme_types.h:8
isis32_t open(const char *dae_name, DAEstatus &status)
Definition: isisdae.cpp:613
int getValue(const char *name, char *value, int max_len, bool write_null, DAEstatus &status)
int readLabviewXMLfromFile(const char *filename)
static ISISDAE * dae
Definition: daeset.cpp:7
int beginRun(DAEstatus &status)
int resetRunController(DAEstatus &status)
Definition: isisdae.cpp:987
int saveToString(std::string &s, DAEstatus &status)
int i_det
Definition: isisraw.h:269
int startRun(bool clear_counters, int run_number, time_t &start_time, DAEstatus &status)
Definition: isisdae.cpp:843
int getRawFrames(isisU32_t *value, DAEstatus &status)
Definition: isisdae.cpp:997
unsigned short isisU16_t
Definition: isisvme_types.h:7
int saveToFile(const char *filename, DAEstatus &status)
int i_mon
Definition: isisraw.h:270
int close()
Definition: labview_xml.h:70
isis32_t close(DAEstatus &status)
Definition: isisdae.cpp:710
int * mdet
Definition: isisraw.h:273
int * spec
Definition: isisraw.h:275
int _tmain(int argc, _TCHAR *argv[])
Definition: newicp.cpp:11