OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librlink/] [RlinkPortFactory.cpp] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 wfjm
// $Id: RlinkPortFactory.cpp 632 2015-01-11 12:30:03Z mueller $
2 10 wfjm
//
3 19 wfjm
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 10 wfjm
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16 19 wfjm
// 2013-02-23   492   1.2    use RparseUrl
17 17 wfjm
// 2012-12-26   465   1.1    add cuff: support
18 10 wfjm
// 2011-03-27   374   1.0    Initial version
19
// 2011-01-15   356   0.1    First draft
20
// ---------------------------------------------------------------------------
21
 
22
/*!
23
  \file
24 29 wfjm
  \version $Id: RlinkPortFactory.cpp 632 2015-01-11 12:30:03Z mueller $
25 10 wfjm
  \brief   Implemenation of RlinkPortFactory.
26
*/
27
 
28 19 wfjm
#include "librtools/RparseUrl.hpp"
29
 
30 10 wfjm
#include "RlinkPortFifo.hpp"
31
#include "RlinkPortTerm.hpp"
32 17 wfjm
#include "RlinkPortCuff.hpp"
33 10 wfjm
 
34 19 wfjm
#include "RlinkPortFactory.hpp"
35
 
36 10 wfjm
using namespace std;
37
 
38
/*!
39
  \class Retro::RlinkPortFactory
40 19 wfjm
  \brief FIXME_docs
41 10 wfjm
*/
42
 
43 19 wfjm
// all method definitions in namespace Retro
44
namespace Retro {
45
 
46 10 wfjm
//------------------------------------------+-----------------------------------
47 19 wfjm
//! FIXME_docs
48 10 wfjm
 
49
RlinkPort* Retro::RlinkPortFactory::New(const std::string& url, RerrMsg& emsg)
50
{
51 19 wfjm
  string scheme = RparseUrl::FindScheme(url);
52
 
53
  if (scheme.length() == 0) {
54 10 wfjm
    emsg.Init("RlinkPortFactory::New()",
55 21 wfjm
              string("no scheme specified in url '" + url + "'"));
56 10 wfjm
    return 0;
57
  }
58
 
59
  if        (scheme == "fifo") {
60
    return new RlinkPortFifo();
61
  } else if (scheme == "term") {
62
    return new RlinkPortTerm();
63 17 wfjm
  } else if (scheme == "cuff") {
64
    return new RlinkPortCuff();
65 10 wfjm
  }
66
 
67
  emsg.Init("RlinkPortFactory::New()", string("unknown scheme: ") + scheme);
68
  return 0;
69
}
70
 
71
//------------------------------------------+-----------------------------------
72 19 wfjm
//! FIXME_docs
73 10 wfjm
 
74
RlinkPort* RlinkPortFactory::Open(const std::string& url, RerrMsg& emsg)
75
{
76
  RlinkPort* pport = New(url, emsg);
77 29 wfjm
  if (pport == nullptr) return 0;
78 10 wfjm
 
79
  if (pport->Open(url, emsg)) return pport;
80
  delete pport;
81
  return 0;
82
}
83
 
84 19 wfjm
} // end namespace Retro

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.