Line 1... |
Line 1... |
// $Id: RtclProxyBase.hpp 365 2011-02-28 07:28:26Z mueller $
|
// $Id: RtclProxyBase.hpp 401 2011-07-31 21:02:33Z mueller $
|
//
|
//
|
// Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2011- 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
|
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
|
|
// 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-20 363 1.0 Initial version
|
// 2011-02-11 360 0.1 First draft
|
// 2011-02-11 360 0.1 First draft
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RtclProxyBase.hpp 365 2011-02-28 07:28:26Z mueller $
|
\version $Id: RtclProxyBase.hpp 401 2011-07-31 21:02:33Z mueller $
|
\brief Declaration of class RtclProxyBase.
|
\brief Declaration of class RtclProxyBase.
|
*/
|
*/
|
|
|
#ifndef included_Retro_RtclProxyBase
|
#ifndef included_Retro_RtclProxyBase
|
#define included_Retro_RtclProxyBase 1
|
#define included_Retro_RtclProxyBase 1
|
Line 29... |
Line 32... |
#include "tcl.h"
|
#include "tcl.h"
|
|
|
#include <string>
|
#include <string>
|
#include <map>
|
#include <map>
|
|
|
|
#include "boost/utility.hpp"
|
|
#include "boost/function.hpp"
|
|
|
#include "RtclArgs.hpp"
|
#include "RtclArgs.hpp"
|
#include "librtools/RmethDscBase.hpp"
|
|
|
|
namespace Retro {
|
namespace Retro {
|
|
|
class RtclProxyBase {
|
class RtclProxyBase : private boost::noncopyable {
|
public:
|
public:
|
static const int kOK = TCL_OK;
|
static const int kOK = TCL_OK;
|
static const int kERR = TCL_ERROR;
|
static const int kERR = TCL_ERROR;
|
|
|
typedef std::map<std::string, RmethDscBase<RtclArgs>*> mmap_t;
|
typedef boost::function<int(RtclArgs&)> methfo_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;
|
|
|
typedef RmethDscBase<RtclArgs> mdsc_t;
|
|
|
|
explicit RtclProxyBase(const std::string& type = std::string());
|
explicit RtclProxyBase(const std::string& type = std::string());
|
|
RtclProxyBase(const std::string& type, Tcl_Interp* interp,
|
|
const char* name);
|
virtual ~RtclProxyBase();
|
virtual ~RtclProxyBase();
|
|
|
virtual int ClassCmdConfig(Tcl_Interp* interp, int objc,
|
virtual int ClassCmdConfig(Tcl_Interp* interp, int objc,
|
Tcl_Obj* const objv[]);
|
Tcl_Obj* const objv[]);
|
|
|
Line 58... |
Line 65... |
Tcl_Command Token() const;
|
Tcl_Command Token() const;
|
|
|
protected:
|
protected:
|
void SetType(const std::string& type);
|
void SetType(const std::string& type);
|
|
|
void AddMeth(const std::string& name,
|
void AddMeth(const std::string& name, const methfo_t& methfo);
|
RmethDscBase<RtclArgs>* pmeth);
|
|
|
|
void CreateObjectCmd(Tcl_Interp* interp, const char* name);
|
void CreateObjectCmd(Tcl_Interp* interp, const char* name);
|
|
|
int TclObjectCmd(Tcl_Interp* interp, int objc,
|
int TclObjectCmd(Tcl_Interp* interp, int objc,
|
Tcl_Obj* const objv[]);
|
Tcl_Obj* const objv[]);
|
Line 76... |
Line 82... |
protected:
|
protected:
|
std::string fType; //!< proxied type name
|
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_Interp* fInterp; //!< tcl interpreter
|
Tcl_Command fCmdToken; //!< cmd token for object command
|
Tcl_Command fCmdToken; //!< cmd token for object command
|
|
|
// RtclProxyBase is not copy or assignable
|
|
private:
|
|
RtclProxyBase(const RtclProxyBase& rhs);
|
|
RtclProxyBase& operator=(const RtclProxyBase& rhs);
|
|
};
|
};
|
|
|
} // end namespace Retro
|
} // end namespace Retro
|
|
|
#if !(defined(Retro_NoInline) || defined(Retro_RtclProxyBase_NoInline))
|
#if !(defined(Retro_NoInline) || defined(Retro_RtclProxyBase_NoInline))
|