ACQ2XX_API
acq_transport.cpp
Go to the documentation of this file.
00001 /* ------------------------------------------------------------------------- */
00002 /* file acq_transport.cpp                                                    */
00003 /* ------------------------------------------------------------------------- */
00004 /*   Copyright (C) 2008 Peter Milne, D-TACQ Solutions Ltd
00005  *                      <Peter dot Milne at D hyphen TACQ dot com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of Version 2 of the GNU General Public License
00009     as published by the Free Software Foundation;
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
00019 /* ------------------------------------------------------------------------- */
00020 
00021 /** @file acq_transport.cpp instantiates Transport.
00022   Transport* Transport::getTransport(const char* id)
00023  - id=simple integer - create KddTransport to local (linux) device driver.
00024  - id begins http:// - create a SoapTransport
00025  - id is a DNS name or ip-address - create a Dt100Transport
00026  - id begins ssh: - create SshTransport
00027  */
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <string.h>
00031 #include "acq_transport.h"
00032 #include "Dt100Transport.h"
00033 #include "KddTransport.h"
00034 #include "SoapTransport.h"
00035 
00036 
00037 Transport* Transport::getTransport(const char* id)
00038 /**< Transport Factory. create appropriate Transport based on id. ]
00039 */
00040 {
00041         Transport* t;
00042 
00043         if ((t = KddTransportFactory::createTransport(id)) != 0 ){
00044                 return t;
00045         }else if ((t = SoapTransportFactory::createTransport(id)) != 0){
00046                 return t;
00047         }else{
00048                 return t = Dt100TransportFactory::createTransport(id);
00049         }
00050 }