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 10

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

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

powered by: WebSVN 2.1.0

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