Line 1... |
Line 1... |
// $Id: RtclProxyBase.hpp 401 2011-07-31 21:02:33Z mueller $
|
// $Id: RtclCmdBase.hpp 486 2013-02-10 22:34:43Z mueller $
|
//
|
//
|
// Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 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
|
// 2011-07-31 401 1.2 add ctor(type,interp,name) for direct usage
|
// 2013-02-02 480 1.0 Initial version (refactored out from ProxyBase)
|
// 2011-04-23 380 1.1 use boost/function instead of RmethDsc
|
|
// use boost::noncopyable (instead of private dcl's)
|
|
// 2011-02-20 363 1.0 Initial version
|
|
// 2011-02-11 360 0.1 First draft
|
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RtclProxyBase.hpp 401 2011-07-31 21:02:33Z mueller $
|
\version $Id: RtclCmdBase.hpp 486 2013-02-10 22:34:43Z mueller $
|
\brief Declaration of class RtclProxyBase.
|
\brief Declaration of class RtclCmdBase.
|
*/
|
*/
|
|
|
#ifndef included_Retro_RtclProxyBase
|
#ifndef included_Retro_RtclCmdBase
|
#define included_Retro_RtclProxyBase 1
|
#define included_Retro_RtclCmdBase 1
|
|
|
#include "tcl.h"
|
#include "tcl.h"
|
|
|
#include <string>
|
#include <string>
|
#include <map>
|
#include <map>
|
Line 39... |
Line 35... |
|
|
#include "RtclArgs.hpp"
|
#include "RtclArgs.hpp"
|
|
|
namespace Retro {
|
namespace Retro {
|
|
|
class RtclProxyBase : private boost::noncopyable {
|
class RtclCmdBase : private boost::noncopyable {
|
public:
|
public:
|
static const int kOK = TCL_OK;
|
|
static const int kERR = TCL_ERROR;
|
|
|
|
typedef boost::function<int(RtclArgs&)> methfo_t;
|
typedef boost::function<int(RtclArgs&)> methfo_t;
|
|
|
typedef std::map<std::string, methfo_t> mmap_t;
|
typedef std::map<std::string, methfo_t> mmap_t;
|
typedef mmap_t::iterator mmap_it_t;
|
typedef mmap_t::iterator mmap_it_t;
|
typedef mmap_t::const_iterator mmap_cit_t;
|
typedef mmap_t::const_iterator mmap_cit_t;
|
typedef mmap_t::value_type mmap_val_t;
|
typedef mmap_t::value_type mmap_val_t;
|
|
|
explicit RtclProxyBase(const std::string& type = std::string());
|
RtclCmdBase();
|
RtclProxyBase(const std::string& type, Tcl_Interp* interp,
|
virtual ~RtclCmdBase();
|
const char* name);
|
|
virtual ~RtclProxyBase();
|
|
|
|
virtual int ClassCmdConfig(Tcl_Interp* interp, int objc,
|
int DispatchCmd(RtclArgs& args);
|
Tcl_Obj* const objv[]);
|
|
|
|
const std::string& Type() const;
|
// some constants (also defined in cpp)
|
Tcl_Command Token() const;
|
static const int kOK = TCL_OK; //<!
|
|
static const int kERR = TCL_ERROR; //<!
|
|
|
protected:
|
protected:
|
void SetType(const std::string& type);
|
|
|
|
void AddMeth(const std::string& name, const methfo_t& methfo);
|
void AddMeth(const std::string& name, const methfo_t& methfo);
|
|
|
void CreateObjectCmd(Tcl_Interp* interp, const char* name);
|
|
|
|
int TclObjectCmd(Tcl_Interp* interp, int objc,
|
|
Tcl_Obj* const objv[]);
|
|
|
|
static int ThunkTclObjectCmd(ClientData cdata, Tcl_Interp* interp,
|
|
int objc, Tcl_Obj* const objv[]);
|
|
static void ThunkTclCmdDeleteProc(ClientData cdata);
|
|
static void ThunkTclExitProc(ClientData cdata);
|
|
|
|
protected:
|
protected:
|
std::string fType; //!< proxied type name
|
|
mmap_t fMapMeth; //!< map for named methods
|
mmap_t fMapMeth; //!< map for named methods
|
Tcl_Interp* fInterp; //!< tcl interpreter
|
|
Tcl_Command fCmdToken; //!< cmd token for object command
|
|
};
|
};
|
|
|
} // end namespace Retro
|
} // end namespace Retro
|
|
|
#if !(defined(Retro_NoInline) || defined(Retro_RtclProxyBase_NoInline))
|
//#include "RtclCmdBase.ipp"
|
#include "RtclProxyBase.ipp"
|
|
#endif
|
|
|
|
#endif
|
#endif
|
|
|
No newline at end of file
|
No newline at end of file
|