git subrepo clone git@github.com:Rconybea/xo-object2.git xo-object2
subrepo: subdir: "xo-object2" merged: "8156e514" upstream: origin: "git@github.com:Rconybea/xo-object2.git" branch: "main" commit: "8156e514" git-subrepo: version: "0.4.9" origin: "???" commit: "???"
This commit is contained in:
parent
2a287cf772
commit
dff1b8e6ad
100 changed files with 6107 additions and 0 deletions
41
xo-object2/src/object2/GCObjectConversion_DFloat.cpp
Normal file
41
xo-object2/src/object2/GCObjectConversion_DFloat.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/** @file GCObjectConversion_DFloat.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "number/GCObjectConversion_DFloat.hpp"
|
||||
#include <xo/indentlog/print/tag.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::AGCObject;
|
||||
|
||||
namespace scm {
|
||||
|
||||
obj<AGCObject>
|
||||
GCObjectConversion<double>::to_gco(obj<AAllocator> mm,
|
||||
double x)
|
||||
{
|
||||
return DFloat::box<AGCObject>(mm, x);
|
||||
}
|
||||
|
||||
double
|
||||
GCObjectConversion<double>::from_gco(obj<AAllocator> mm,
|
||||
obj<AGCObject> gco)
|
||||
{
|
||||
(void)mm;
|
||||
|
||||
auto float_obj = obj<AGCObject,DFloat>::from(gco);
|
||||
|
||||
if (!float_obj) {
|
||||
throw std::runtime_error
|
||||
(tostr("Object obj found where Float expected",
|
||||
xtag("obj", gco)));
|
||||
}
|
||||
|
||||
return float_obj.data()->value();
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end GCObjectConversion_DFloat.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue