DABC (Data Acquisition Backbone Core)  2.9.9
Factory.cxx
Go to the documentation of this file.
1 // $Id: Factory.cxx 4464 2020-04-15 12:14:20Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #include "ezca/Factory.h"
17 
18 #include <cstdlib>
19 
20 #include "dabc/Command.h"
21 #include "dabc/logging.h"
22 #include "dabc/Url.h"
23 #include "dabc/Manager.h"
24 
25 #include "ezca/Definitions.h"
26 #include "ezca/EpicsInput.h"
27 #include "ezca/Monitor.h"
28 
29 const char* ezca::xmlEpicsName = "EpicsIdentifier";
30 const char* ezca::xmlUpdateFlagRecord = "EpicsFlagRec";
31 const char* ezca::xmlEventIDRecord = "EpicsEventIDRec";
32 const char* ezca::xmlNameLongRecords = "EpicsLongRecs";
33 const char* ezca::xmlNameDoubleRecords = "EpicsDoubleRecs";
34 const char* ezca::xmlTimeout = "EpicsPollingTimeout";
35 const char* ezca::xmlEpicsSubeventId = "EpicsSubeventId";
36 const char* ezca::xmlEzcaTimeout = "EzcaTimeout";
37 const char* ezca::xmlEzcaRetryCount = "EzcaRetryCount";
38 const char* ezca::xmlEzcaDebug = "EzcaDebug";
39 const char* ezca::xmlEzcaAutoError = "EzcaAutoError";
40 
41 const char* ezca::nameUpdateCommand = "ezca::OnUpdate";
42 const char* ezca::xmlCommandReceiver = "EpicsDabcCommandReceiver"; // Command receiver on flag change event
43 
45 
46 
47 ezca::Factory::Factory(const std::string &name) :
48  dabc::Factory(name)
49 {
50 }
51 
52 dabc::DataInput* ezca::Factory::CreateDataInput(const std::string &typ)
53 {
54  dabc::Url url(typ);
55  if (url.GetProtocol()=="ezca")
56  return new ezca::EpicsInput(url.GetHostName());
57 
58  return 0;
59 }
60 
61 dabc::Module* ezca::Factory::CreateModule(const std::string &classname, const std::string &modulename, dabc::Command cmd)
62 {
63  if (classname == "ezca::Monitor")
64  return new ezca::Monitor(modulename, cmd);
65 
66  return dabc::Factory::CreateModule(classname, modulename, cmd);
67 }
Represents command with its arguments.
Definition: Command.h:99
Interface for implementing any kind of data input.
Definition: DataIO.h:61
Small helper class to correctly instantiate user-specific factories.
Definition: Factory.h:106
virtual Module * CreateModule(const std::string &classname, const std::string &modulename, Command cmd)
Factory method to create module.
Definition: Factory.h:67
Base for dabc::ModuleSync and dabc::ModuleAsync classes.
Definition: Module.h:42
Uniform Resource Locator interpreter.
Definition: Url.h:33
The epics easy channel access data input implementation.
Definition: EpicsInput.h:37
Factory for epics eazy channel access classes
Definition: Factory.h:29
Factory(const std::string &name)
Definition: Factory.cxx:47
virtual dabc::DataInput * CreateDataInput(const std::string &typ)
Factory method to create data input.
Definition: Factory.cxx:52
virtual dabc::Module * CreateModule(const std::string &classname, const std::string &modulename, dabc::Command cmd)
Factory method to create module.
Definition: Factory.cxx:61
Monitor of EPICS data.
Definition: Monitor.h:34
Event manipulation API.
Definition: api.h:23
const char * xmlUpdateFlagRecord
Definition: Factory.cxx:30
const char * nameUpdateCommand
Definition: Factory.cxx:41
const char * xmlEzcaAutoError
indicates if error should be automatically printed
Definition: Factory.cxx:39
const char * xmlNameLongRecords
Definition: Factory.cxx:32
const char * xmlCommandReceiver
Definition: Factory.cxx:42
const char * xmlEventIDRecord
Definition: Factory.cxx:31
const char * xmlTimeout
Definition: Factory.cxx:34
const char * xmlEpicsSubeventId
Definition: Factory.cxx:35
const char * xmlEpicsName
Definition: Factory.cxx:29
const char * xmlEzcaDebug
retry counter for ezca operation
Definition: Factory.cxx:38
const char * xmlEzcaTimeout
timeout for ezca operation
Definition: Factory.cxx:36
const char * xmlEzcaRetryCount
retry counter for ezca operation
Definition: Factory.cxx:37
const char * xmlNameDoubleRecords
Definition: Factory.cxx:33
dabc::FactoryPlugin epicsfactory(new ezca::Factory("ezca"))