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

Subversion Repositories w11

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
// $Id: RlinkPortFactory.cpp 465 2012-12-27 21:29:38Z mueller $
2 10 wfjm
//
3 17 wfjm
// Copyright 2011-2012 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 17 wfjm
// 2012-12-26   465   1.1    add cuff: support
17 10 wfjm
// 2011-03-27   374   1.0    Initial version
18
// 2011-01-15   356   0.1    First draft
19
// ---------------------------------------------------------------------------
20
 
21
/*!
22
  \file
23 17 wfjm
  \version $Id: RlinkPortFactory.cpp 465 2012-12-27 21:29:38Z mueller $
24 10 wfjm
  \brief   Implemenation of RlinkPortFactory.
25
*/
26
 
27
#include "RlinkPortFactory.hpp"
28
#include "RlinkPortFifo.hpp"
29
#include "RlinkPortTerm.hpp"
30 17 wfjm
#include "RlinkPortCuff.hpp"
31 10 wfjm
 
32
using namespace std;
33
using namespace Retro;
34
 
35
/*!
36
  \class Retro::RlinkPortFactory
37
  \brief FIXME_text
38
*/
39
 
40
//------------------------------------------+-----------------------------------
41
//! FIXME_text
42
 
43
RlinkPort* Retro::RlinkPortFactory::New(const std::string& url, RerrMsg& emsg)
44
{
45
  size_t dpos = url.find_first_of(':');
46
  if (dpos == string::npos) {
47
    emsg.Init("RlinkPortFactory::New()",
48
              string("no scheme specified in url \"" + url + string("\"")));
49
    return 0;
50
  }
51
 
52
  string scheme = url.substr(0,dpos);      // get scheme without ':' delim
53
 
54
  if        (scheme == "fifo") {
55
    return new RlinkPortFifo();
56
  } else if (scheme == "term") {
57
    return new RlinkPortTerm();
58 17 wfjm
  } else if (scheme == "cuff") {
59
    return new RlinkPortCuff();
60 10 wfjm
  }
61
 
62
  emsg.Init("RlinkPortFactory::New()", string("unknown scheme: ") + scheme);
63
  return 0;
64
}
65
 
66
//------------------------------------------+-----------------------------------
67
//! FIXME_text
68
 
69
RlinkPort* RlinkPortFactory::Open(const std::string& url, RerrMsg& emsg)
70
{
71
  RlinkPort* pport = New(url, emsg);
72
  if (pport == 0) return 0;
73
 
74
  if (pport->Open(url, emsg)) return pport;
75
  delete pport;
76
  return 0;
77
}
78
 
79
 
80
//------------------------------------------+-----------------------------------
81
#if (defined(Retro_NoInline) || defined(Retro_RlinkPortFactory_NoInline))
82
#define inline
83
//#include "RlinkPortFactory.ipp"
84
#undef  inline
85
#endif

powered by: WebSVN 2.1.0

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