PAASS
Software suite to Acquire and Analyze Data from Pixie16
utkscanor.cpp
Go to the documentation of this file.
1 #include <iostream>
2 
3 #include <cstring>
4 
5 // Local files
6 #include "DetectorDriver.hpp"
7 #include "GetArguments.hpp"
8 #include "ScanorInterface.hpp"
9 #include "UtkScanInterface.hpp"
10 
11 // Define the name of the program.
12 #ifndef PROGRAM_NAME
13 #define PROGRAM_NAME "utkscanor"
14 #endif
15 
16 using std::cout;
17 using std::endl;
18 
20 
23 extern "C" void startup_() {
24  cout << "utkscanor.cpp : Instancing the UtkScanInterface" << endl;
25  scanner = new UtkScanInterface();
26 
27  // Set the output message prefix.
28  cout << "utkscan.cpp : Setting the Program Name" << endl;
29  scanner->SetProgramName(std::string(PROGRAM_NAME));
30 
31  // Initialize the scanner and handle command line arguments from SCANOR
32  cout << "utkscan.cpp : Performing the setup routine" << endl;
33  scanner->Setup(GetNumberArguments(), GetArguments());
34 
35  //Set the unpacker object based off what the ScanInterface object created
37 }
38 
42 extern "C" void drrsub_(uint32_t &iexist) {
43  try {
44  drrmake_();
46  endrr_();
47  } catch (std::exception &e) {
48  // Any exceptions will be intercepted here
49  cout << "Exception caught at Initialize:" << endl;
50  cout << "\t" << e.what() << endl;
51  }
52 }
53 
54 // Catch the exit call from scanor and clean up c++ objects CRT
55 extern "C" void cleanup_() {
56  // Do some cleanup.
57  cout << "\nCleaning up..\n";
58  scanner->Close();
59  delete scanner;
60 }
void cleanup_()
Catch the exit call from scanor and clean up c++ objects CRT.
Definition: utkscanor.cpp:55
int GetNumberArguments(void)
#define PROGRAM_NAME
Definition: utkscanor.cpp:13
bool Close()
Shutdown cleanly.
bool Setup(int argc, char *argv[])
Setup user options and initialize all required objects.
UtkScanInterface * scanner
Definition: utkscanor.cpp:19
void SetProgramName(const std::string &head_)
Set the header string used to prefix output messages.
Main Driver for event processing.
void drrmake_()
DAMM initialization call.
char ** GetArguments(void)
Returns an argv style array that can be used to pass to getopt and other similar functions.
Class derived from ScanInterface to handle UI for the scan.
void drrsub_(uint32_t &iexist)
Defines the main interface with the SCANOR library, the program essentially starts here...
Definition: utkscanor.cpp:42
static ScanorInterface * get()
virtual Unpacker * GetCore()
void endrr_()
DAMM declaration wrap-up call.
void startup_()
Begins setups the interface between SCANOR and the C++ and the Unpacker. It also handles the processi...
Definition: utkscanor.cpp:23
void SetUnpacker(Unpacker *a)
static DetectorDriver * get()