CFEL - ASG Software Suite  2.5.0
CASS
detector_backend.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 Lutz Foucar
2 
3 /**
4  * @file detector_backend.cpp contains the base class definition for all detectors
5  * that are attached to an acqiris device.
6  *
7  * @author Lutz Foucar
8  */
9 #include "cass.h"
10 
11 #include "detector_backend.h"
12 #include "delayline_detector.h"
13 
14 using namespace cass::ACQIRIS;
15 using namespace std;
16 
17 DetectorBackend::shared_pointer DetectorBackend::instance(const DetectorType &dettype, const std::string &detname)
18 {
19  shared_pointer det;
20 
21  switch(dettype)
22  {
23  case Delayline:
24  det = shared_pointer(new DelaylineDetector(detname));
25  break;
26  case ToF:
27  det = shared_pointer(new TofDetector(detname));
28  break;
29  default:
30  throw invalid_argument("DetectorBackend::instance: detector type '" +
31  toString(dettype) + "' is unknown");
32  }
33  return det;
34 }
std::tr1::shared_ptr< DetectorBackend > shared_pointer
a shared pointer of this type
STL namespace.
static shared_pointer instance(const DetectorType &dettype, const std::string &detname)
create an instance of the requested dectortype
A Time of Flight Detector.
Definition: tof_detector.h:33
file contains the classes that describe a delayline detector.
contains the base class declaration for all detectors that are attached to an acqiris device...
DetectorType
the types of detectors that are available
file contains global definitions for project cass
std::string toString(const Type &t)
convert any type to a string
Definition: cass.h:63