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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librtcltools/] [RtclContext.cpp] - Diff between revs 10 and 19

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 10 Rev 19
Line 1... Line 1...
// $Id: RtclContext.cpp 368 2011-03-12 09:58:53Z mueller $
// $Id: RtclContext.cpp 492 2013-02-24 22:14:47Z mueller $
//
//
// Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
//
// This program is free software; you may redistribute and/or modify it under
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
// Software Foundation, either version 2, or at your option any later version.
//
//
Line 11... Line 11...
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for complete details.
// for complete details.
// 
// 
// Revision History: 
// Revision History: 
// Date         Rev Version  Comment
// Date         Rev Version  Comment
 
// 2013-02-03   481   1.0.3  use Rexception
 
// 2013-01-12   474   1.0.2  add FindProxy() method
// 2011-03-12   368   1.0.1  drop fExitSeen, get exit handling right
// 2011-03-12   368   1.0.1  drop fExitSeen, get exit handling right
// 2011-02-18   362   1.0    Initial version
// 2011-02-18   362   1.0    Initial version
// 2011-02-13   361   0.1    First draft
// 2011-02-13   361   0.1    First draft
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
 
 
/*!
/*!
  \file
  \file
  \version $Id: RtclContext.cpp 368 2011-03-12 09:58:53Z mueller $
  \version $Id: RtclContext.cpp 492 2013-02-24 22:14:47Z mueller $
  \brief   Implemenation of RtclContext.
  \brief   Implemenation of RtclContext.
*/
*/
 
 
#include <stdexcept>
 
#include <iostream>
#include <iostream>
 
 
#include "RtclContext.hpp"
#include "RtclContext.hpp"
 
 
 
#include "librtools/Rexception.hpp"
 
 
using namespace std;
using namespace std;
using namespace Retro;
 
 
 
/*!
/*!
  \class Retro::RtclContext
  \class Retro::RtclContext
  \brief FIXME_docs
  \brief FIXME_docs
*/
*/
 
 
typedef std::pair<Retro::RtclContext::cset_it_t, bool>  cset_ins_t;
// all method definitions in namespace Retro
typedef std::pair<Retro::RtclContext::pset_it_t, bool>  pset_ins_t;
namespace Retro {
 
 
 
typedef std::pair<RtclContext::cset_it_t, bool>  cset_ins_t;
 
typedef std::pair<RtclContext::pset_it_t, bool>  pset_ins_t;
 
 
RtclContext::xmap_t RtclContext::fMapContext;
RtclContext::xmap_t RtclContext::fMapContext;
 
 
//------------------------------------------+-----------------------------------
//------------------------------------------+-----------------------------------
//! Default constructor
//! Default constructor
Line 62... Line 67...
 
 
void RtclContext::RegisterClass(RtclClassBase* pobj)
void RtclContext::RegisterClass(RtclClassBase* pobj)
{
{
  cset_ins_t ret = fSetClass.insert(pobj);
  cset_ins_t ret = fSetClass.insert(pobj);
  if (ret.second == false)                  // or use !(ret.second)
  if (ret.second == false)                  // or use !(ret.second)
    throw logic_error("RtclContext::RegisterClass: duplicate pointer");
    throw Rexception("RtclContext::RegisterClass()",
 
                     "Bad args: duplicate pointer");
  return;
  return;
}
}
 
 
//------------------------------------------+-----------------------------------
//------------------------------------------+-----------------------------------
//! FIXME_docs
//! FIXME_docs
Line 82... Line 88...
 
 
void RtclContext::RegisterProxy(RtclProxyBase* pobj)
void RtclContext::RegisterProxy(RtclProxyBase* pobj)
{
{
  pset_ins_t ret = fSetProxy.insert(pobj);
  pset_ins_t ret = fSetProxy.insert(pobj);
  if (ret.second == false)                  // or use !(ret.second)
  if (ret.second == false)                  // or use !(ret.second)
    throw logic_error("RtclContext::RegisterProxy: duplicate pointer");
    throw Rexception("RtclContext::RegisterProxy()",
 
                     "Bad args: duplicate pointer");
  return;
  return;
}
}
 
 
//------------------------------------------+-----------------------------------
//------------------------------------------+-----------------------------------
//! FIXME_docs
//! FIXME_docs
Line 117... Line 124...
}
}
 
 
//------------------------------------------+-----------------------------------
//------------------------------------------+-----------------------------------
//! FIXME_docs
//! FIXME_docs
 
 
 
 
void RtclContext::ListProxy(std::vector<RtclProxyBase*>& list,
void RtclContext::ListProxy(std::vector<RtclProxyBase*>& list,
                            const std::string& type)
                            const std::string& type)
{
{
  list.clear();
  list.clear();
  for (pset_it_t it = fSetProxy.begin(); it != fSetProxy.end(); it++) {
  for (pset_it_t it = fSetProxy.begin(); it != fSetProxy.end(); it++) {
Line 133... Line 139...
}
}
 
 
//------------------------------------------+-----------------------------------
//------------------------------------------+-----------------------------------
//! FIXME_docs
//! FIXME_docs
 
 
 
RtclProxyBase* RtclContext::FindProxy(const std::string& type,
 
                                      const std::string& name)
 
{
 
  for (pset_it_t it = fSetProxy.begin(); it != fSetProxy.end(); it++) {
 
    if (type.length() == 0 || (*it)->Type()==type) {
 
      const char* cmdname = Tcl_GetCommandName(fInterp, (*it)->Token());
 
      if (name == cmdname) return *it;
 
    }
 
  }
 
  return 0;
 
}
 
 
 
//------------------------------------------+-----------------------------------
 
//! FIXME_docs
 
 
RtclContext& RtclContext::Find(Tcl_Interp* interp)
RtclContext& RtclContext::Find(Tcl_Interp* interp)
{
{
  RtclContext* pcntx = 0;
  RtclContext* pcntx = 0;
  xmap_it_t it = fMapContext.find(interp);
  xmap_it_t it = fMapContext.find(interp);
  if (it != fMapContext.end()) {
  if (it != fMapContext.end()) {
Line 167... Line 188...
    cerr << "RtclContext::ThunkTclExitProc called when maps non-empty" << endl;
    cerr << "RtclContext::ThunkTclExitProc called when maps non-empty" << endl;
  }
  }
  return;
  return;
}
}
 
 
//------------------------------------------+-----------------------------------
} // end namespace Retro
#if (defined(Retro_NoInline) || defined(Retro_RtclContext_NoInline))
 
#define inline
 
#include "RtclContext.ipp"
 
#undef  inline
 
#endif
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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