void SetParameters( void* obj, const ClassAccessors& accessors, const ParameterBox& paramBox) { // we can choose to iterate through the parameters in either way: // either by iterating through the accessors in "accessors" and pulling // values from the parameter box... // or by iterating through the parameters in "paramBox" and pushing those // values in. // We have to consider array cases -- perhaps it easier to go through the // parameters in the parameter box for (auto i=paramBox.Begin(); !i.IsEnd(); ++i) { const auto nameStart = i.Name(); const auto nameEnd = XlStringEnd(nameStart); auto arrayBracket = std::find(nameStart, nameEnd, '['); if (arrayBracket == nameEnd) { accessors.TryOpaqueSet( obj, Hash64(nameStart, nameEnd), i.RawValue(), i.Type(), false); } else { auto arrayIndex = XlAtoUI32((const char*)(arrayBracket+1)); accessors.TryOpaqueSet( obj, Hash64(nameStart, arrayBracket), arrayIndex, i.RawValue(), i.Type(), false); } } }
namespace KindTag { static constexpr std::size_t SHIFT = 48; static constexpr RawValue MASK = RawValue(0x7) << SHIFT; // 3 low bits static constexpr RawValue INTEGER = RawValue(0x1) << SHIFT; static constexpr RawValue POINTER = RawValue(0x2) << SHIFT; } // namespace KindTag
ValueObject& PerconaFTIterator::Value(bool clone_str) { if (m_value.GetType() > 0) { if(clone_str) { m_value.CloneStringPart(); } return m_value; } Slice key = RawValue(); Buffer kbuf(const_cast<char*>(key.data()), 0, key.size()); m_value.Decode(kbuf, clone_str); return m_value; }
Value& setInteger(std::uint32_t value) noexcept { return raw(BoxKindTag::INTEGER | RawValue(value)); }
Value& setPtr(T* ptr) noexcept { assert(Infra::areNoBitsSet(RawValue(ptr), ~VALUE_MASK)); return raw(BoxKindTag::POINTER | RawValue(ptr)); }
explicit constexpr Value(std::int32_t i) : data_{BoxKindTag::INTEGER | (RawValue(i) & VALUE_MASK)} { }
std::string TRegisterHandler::TextValue() const { return reg.Scale == 1 ? std::to_string(RawValue()) : std::to_string(ScaledValue()); }