/* * call-seq: * rd[index] = value * * Assigns +value+ to the slot designated by +index+ */ static VALUE aset(VALUE self, VALUE index, VALUE value) { unsigned long *addr = addr_of(self, index); *addr = NUM2ULONG(value); return value; }
/* * call-seq: * rd[index] -> value * * Returns the value of the slot designated by +index+ */ static VALUE aref(VALUE self, VALUE index) { return ULONG2NUM(*addr_of(self, index)); }
const void* get() const override { // const is restored when returning from the function return addr_of(const_cast<T&>(x_)); }
/* * call-seq: * rd.decr(index[, number]) -> result * * Decrements the value referred to by the +index+ by +number+. * +number+ defaults to +1+ if unspecified. */ static VALUE decr(int argc, VALUE *argv, VALUE self) { unsigned long nr = incr_decr_arg(argc, argv); return ULONG2NUM(__sync_sub_and_fetch(addr_of(self, argv[0]), nr)); }
error load(deserializer& source) override { return source(*addr_of(x_)); }
void* get_mutable() override { return addr_of(x_); }
error save(serializer& sink) const override { return sink(*addr_of(const_cast<T&>(x_))); }
error load(deserializer& source) override { detail::try_serialize(source, addr_of(x_)); // TODO: refactor after visit API is in place (#470) return {}; }
error save(serializer& sink) const override { detail::try_serialize(sink, addr_of(x_)); // TODO: refactor after visit API is in place (#470) return {}; }