-
Notifications
You must be signed in to change notification settings - Fork 0
/
OAProbeFactory.cc
73 lines (59 loc) · 1.74 KB
/
OAProbeFactory.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
/*
-------------------------------------------------------------------------
OBJECT NAME: OAProbeFactory.cc
COPYRIGHT: University Corporation for Atmospheric Research, 2003-19
-------------------------------------------------------------------------
*/
#include "OAProbeFactory.h"
#include "OAP.h"
#include "PMS2D.h"
#include "Fast2D.h"
#include "TwoDS.h"
#include "F2DS.h"
#include "HVPS.h"
#include "CIP.h"
using namespace OAP;
OAProbeFactory *OAProbeFactory::_oapFactory = 0;
OAProbeFactory::OAProbeFactory()
{
}
/* -------------------------------------------------------------------- */
OAProbeFactory *OAProbeFactory::getFactory()
{
if (_oapFactory == 0)
{
// Create the root factory, then populate the map with known factories.
_oapFactory = new OAProbeFactory();
}
return(_oapFactory);
}
/* -------------------------------------------------------------------- */
Probe *OAProbeFactory::create(const char specifier[], UserConfig *cfg)
{
char *id = strstr((char *)specifier, "id=") + 4;
if (id == 0)
return 0;
size_t size = sizeof(OAP::P2d_rec);
switch (probeType((const unsigned char *)id))
{
case OAP::PMS2D_T:
return new PMS2D(cfg, specifier, size);
case OAP::FAST2D_T:
return new Fast2D(cfg, specifier, size);
case OAP::TWODS_T:
return new TwoDS(cfg, specifier, size);
case OAP::HVPS_T:
return new HVPS(cfg, specifier, size);
case OAP::CIP_T:
return new CIP(cfg, specifier, size);
case OAP::F2DS_T:
return new F2DS(cfg, specifier, sizeof(OAP::TwoDS_rec));
default:
fprintf(stderr, "OAProbeFactory: Unknown probe type, [%c%c]\n", id[0], id[1]);
fprintf(stderr, "OAProbeFactory: [%s]\n", specifier);
}
return 0;
}
OAProbeFactory::
~OAProbeFactory()
{}