1
0
mirror of https://github.com/wfjm/w11.git synced 2026-02-02 23:21:27 +00:00

add Rtime support in RtclGet/RtclSet

This commit is contained in:
Walter F.J. Mueller
2017-02-26 14:49:14 +01:00
parent a6f6ed8822
commit 6728181be7
2 changed files with 47 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
// $Id: RtclGet.ipp 488 2013-02-16 18:49:47Z mueller $
// $Id: RtclGet.ipp 854 2017-02-25 14:46:03Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// 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
@@ -13,12 +13,13 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-02-20 854 1.1 add Rtime
// 2013-02-12 487 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclGet.ipp 488 2013-02-16 18:49:47Z mueller $
\version $Id: RtclGet.ipp 854 2017-02-25 14:46:03Z mueller $
\brief Implemenation (inline) of class RtclGet.
*/
@@ -27,6 +28,8 @@
\brief FIXME_docs
*/
#include "librtools/Rtime.hpp"
// all method definitions in namespace Retro
namespace Retro {
@@ -185,5 +188,26 @@ inline Tcl_Obj* RtclGet<const std::string&>::operator()() const
return Tcl_NewStringObj((char*) val.data(), val.length());
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <>
inline Tcl_Obj* RtclGet<Rtime>::operator()() const
{
Rtime val = fGet();
return Tcl_NewDoubleObj(double(val));
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <>
inline Tcl_Obj* RtclGet<const Rtime&>::operator()() const
{
Rtime val = fGet();
return Tcl_NewDoubleObj(double(val));
}
} // end namespace Retro

View File

@@ -1,6 +1,6 @@
// $Id: RtclSet.ipp 488 2013-02-16 18:49:47Z mueller $
// $Id: RtclSet.ipp 854 2017-02-25 14:46:03Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// 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
@@ -13,12 +13,13 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-02-20 854 1.1 add Rtime
// 2013-02-12 487 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclSet.ipp 488 2013-02-16 18:49:47Z mueller $
\version $Id: RtclSet.ipp 854 2017-02-25 14:46:03Z mueller $
\brief Implemenation (inline) of class RtclSet.
*/
@@ -30,6 +31,8 @@
#include <climits>
#include <cfloat>
#include "librtools/Rtime.hpp"
// all method definitions in namespace Retro
namespace Retro {
@@ -245,6 +248,20 @@ inline void RtclSet<const std::string&>::operator()(RtclArgs& args) const
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <>
inline void RtclSet<const Rtime&>::operator()(RtclArgs& args) const
{
double val;
if(Tcl_GetDoubleFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
throw Rexception("RtclSet<>::oper()", "conversion error");
fSet(Rtime(val));
return;
}
} // end namespace Retro