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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librtcltools/] [RtclProxyBase.hpp] - 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: RtclProxyBase.hpp 365 2011-02-28 07:28:26Z 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-02-20   363   1.0    Initial version
17
// 2011-02-11   360   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id: RtclProxyBase.hpp 365 2011-02-28 07:28:26Z mueller $
23
  \brief   Declaration of class RtclProxyBase.
24
*/
25
 
26
#ifndef included_Retro_RtclProxyBase
27
#define included_Retro_RtclProxyBase 1
28
 
29
#include "tcl.h"
30
 
31
#include <string>
32
#include <map>
33
 
34
#include "RtclArgs.hpp"
35
#include "librtools/RmethDscBase.hpp"
36
 
37
namespace Retro {
38
 
39
  class RtclProxyBase {
40
    public:
41
      static const int kOK  = TCL_OK;
42
      static const int kERR = TCL_ERROR;
43
 
44
      typedef std::map<std::string, RmethDscBase<RtclArgs>*> mmap_t;
45
      typedef mmap_t::iterator         mmap_it_t;
46
      typedef mmap_t::const_iterator   mmap_cit_t;
47
      typedef mmap_t::value_type       mmap_val_t;
48
 
49
      typedef RmethDscBase<RtclArgs>   mdsc_t;
50
 
51
      explicit      RtclProxyBase(const std::string& type = std::string());
52
      virtual       ~RtclProxyBase();
53
 
54
      virtual int   ClassCmdConfig(Tcl_Interp* interp, int objc,
55
                                   Tcl_Obj* const objv[]);
56
 
57
      const std::string& Type() const;
58
      Tcl_Command        Token() const;
59
 
60
    protected:
61
      void          SetType(const std::string& type);
62
 
63
      void          AddMeth(const std::string& name,
64
                            RmethDscBase<RtclArgs>* pmeth);
65
 
66
      void          CreateObjectCmd(Tcl_Interp* interp, const char* name);
67
 
68
      int           TclObjectCmd(Tcl_Interp* interp, int objc,
69
                                 Tcl_Obj* const objv[]);
70
 
71
      static int    ThunkTclObjectCmd(ClientData cdata, Tcl_Interp* interp,
72
                                      int objc, Tcl_Obj* const objv[]);
73
      static void   ThunkTclCmdDeleteProc(ClientData cdata);
74
      static void   ThunkTclExitProc(ClientData cdata);
75
 
76
    protected:
77
      std::string   fType;                  //!< proxied type name
78
      mmap_t        fMapMeth;               //!< map for named methods
79
      Tcl_Interp*   fInterp;                //!< tcl interpreter
80
      Tcl_Command   fCmdToken;              //!< cmd token for object command
81
 
82
    // RtclProxyBase is not copy or assignable
83
    private:
84
                    RtclProxyBase(const RtclProxyBase& rhs);
85
      RtclProxyBase&  operator=(const RtclProxyBase& rhs);
86
  };
87
 
88
} // end namespace Retro
89
 
90
#if !(defined(Retro_NoInline) || defined(Retro_RtclProxyBase_NoInline))
91
#include "RtclProxyBase.ipp"
92
#endif
93
 
94
#endif

powered by: WebSVN 2.1.0

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