56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
/* @file Integer.cpp
|
|
*
|
|
* author: Roland Conybeare, Aug 2025
|
|
*/
|
|
|
|
#include "Integer.hpp"
|
|
#include "xo/reflect/Reflect.hpp"
|
|
#include <cstddef>
|
|
|
|
namespace xo {
|
|
using xo::reflect::Reflect;
|
|
using xo::reflect::TaggedPtr;
|
|
|
|
namespace obj {
|
|
Integer::Integer(int_type x) : value_{x} {}
|
|
|
|
gp<Integer>
|
|
Integer::make(int_type x) {
|
|
return new (MMPtr(mm)) Integer(x);
|
|
}
|
|
|
|
gp<Integer>
|
|
Integer::from(gp<Object> x) {
|
|
return dynamic_cast<Integer*>(x.ptr());
|
|
}
|
|
|
|
TaggedPtr
|
|
Integer::self_tp() const {
|
|
return Reflect::make_tp(const_cast<Integer*>(this));
|
|
}
|
|
|
|
void
|
|
Integer::display(std::ostream & os) const {
|
|
os << value_;
|
|
}
|
|
|
|
std::size_t
|
|
Integer::_shallow_size() const {
|
|
return sizeof(Integer);
|
|
}
|
|
|
|
Object *
|
|
Integer::_shallow_copy() const {
|
|
Cpof cpof(this);
|
|
return new (cpof) Integer(*this);
|
|
}
|
|
|
|
std::size_t
|
|
Integer::_forward_children() {
|
|
return Integer::_shallow_size();
|
|
}
|
|
|
|
} /*namespace obj*/
|
|
} /*namespace xo*/
|
|
|
|
/* end Integer.cpp */
|