Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "fasp/Factory.h"
00016
00017 #include "dabc/Command.h"
00018 #include "dabc/logging.h"
00019 #include "dabc/Port.h"
00020 #include "dabc/ModuleSync.h"
00021
00022 #include "base/Url.h"
00023 #include "fasp/FileInput.h"
00024 #include "fasp/Transport.h"
00025
00026 dabc::FactoryPlugin rocfactory(new fasp::Factory("fasp"));
00027
00028 fasp::Factory::Factory(const char* name) :
00029 dabc::Factory(name)
00030 {
00031 }
00032
00033
00034 dabc::Transport* fasp::Factory::CreateTransport(dabc::Reference ref, const char* typ, dabc::Command cmd)
00035 {
00036 if (strcmp(typ, "fasp::Transport")==0) {
00037 dabc::PortRef portref = ref;
00038 if (portref.null()) {
00039 EOUT(("Port not specified"));
00040 return 0;
00041 }
00042
00043
00044 fasp::Transport* tr = new fasp::Transport(portref, cmd);
00045
00046 if (!tr->IsRawSocket()) { delete tr; tr = 0; }
00047
00048 return tr;
00049 }
00050
00051 return dabc::Factory::CreateTransport(ref, typ, cmd);
00052 }
00053
00054
00055
00056 dabc::DataInput* fasp::Factory::CreateDataInput(const char* typ)
00057 {
00058 if ((typ==0) || (strlen(typ)==0)) return 0;
00059
00060 DOUT3(("Factory::CreateDataInput %s", typ));
00061
00062 if (strcmp(typ, "fasp::FileInput")==0) {
00063 return new fasp::FileInput();
00064 }
00065
00066 return 0;
00067 }