当前位置: 首页>>代码示例>>C++>>正文


C++ Tuple::toUnderType方法代码示例

本文整理汇总了C++中Tuple::toUnderType方法的典型用法代码示例。如果您正苦于以下问题:C++ Tuple::toUnderType方法的具体用法?C++ Tuple::toUnderType怎么用?C++ Tuple::toUnderType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tuple的用法示例。


在下文中一共展示了Tuple::toUnderType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: writeBinary

    void writeBinary(const Tuple & x_def, WriteBuffer & buf)
    {
        auto & x = x_def.toUnderType();
        const size_t size = x.size();
        DB::writeBinary(size, buf);

        for (auto it = x.begin(); it != x.end(); ++it)
        {
            const UInt8 type = it->getType();
            DB::writeBinary(type, buf);

            switch (type)
            {
                case Field::Types::Null: break;
                case Field::Types::UInt64:
                {
                    DB::writeVarUInt(get<UInt64>(*it), buf);
                    break;
                }
                case Field::Types::UInt128:
                {
                    DB::writeBinary(get<UInt128>(*it), buf);
                    break;
                }
                case Field::Types::Int64:
                {
                    DB::writeVarInt(get<Int64>(*it), buf);
                    break;
                }
                case Field::Types::Float64:
                {
                    DB::writeFloatBinary(get<Float64>(*it), buf);
                    break;
                }
                case Field::Types::String:
                {
                    DB::writeStringBinary(get<std::string>(*it), buf);
                    break;
                }
                case Field::Types::Array:
                {
                    DB::writeBinary(get<Array>(*it), buf);
                    break;
                }
                case Field::Types::Tuple:
                {
                    DB::writeBinary(get<Tuple>(*it), buf);
                    break;
                }
                case Field::Types::AggregateFunctionState:
                {
                    DB::writeStringBinary(it->get<AggregateFunctionStateData>().name, buf);
                    DB::writeStringBinary(it->get<AggregateFunctionStateData>().data, buf);
                    break;
                }
            }
        }
    }
开发者ID:greck2908,项目名称:ClickHouse,代码行数:58,代码来源:Field.cpp

示例2: readBinary

    void readBinary(Tuple & x_def, ReadBuffer & buf)
    {
        auto & x = x_def.toUnderType();
        size_t size;
        DB::readBinary(size, buf);

        for (size_t index = 0; index < size; ++index)
        {
            UInt8 type;
            DB::readBinary(type, buf);

            switch (type)
            {
                case Field::Types::Null:
                {
                    x.push_back(DB::Field());
                    break;
                }
                case Field::Types::UInt64:
                {
                    UInt64 value;
                    DB::readVarUInt(value, buf);
                    x.push_back(value);
                    break;
                }
                case Field::Types::UInt128:
                {
                    UInt128 value;
                    DB::readBinary(value, buf);
                    x.push_back(value);
                    break;
                }
                case Field::Types::Int64:
                {
                    Int64 value;
                    DB::readVarInt(value, buf);
                    x.push_back(value);
                    break;
                }
                case Field::Types::Float64:
                {
                    Float64 value;
                    DB::readFloatBinary(value, buf);
                    x.push_back(value);
                    break;
                }
                case Field::Types::String:
                {
                    std::string value;
                    DB::readStringBinary(value, buf);
                    x.push_back(value);
                    break;
                }
                case Field::Types::Array:
                {
                    Array value;
                    DB::readBinary(value, buf);
                    x.push_back(value);
                    break;
                }
                case Field::Types::Tuple:
                {
                    Tuple value;
                    DB::readBinary(value, buf);
                    x.push_back(value);
                    break;
                }
                case Field::Types::AggregateFunctionState:
                {
                    AggregateFunctionStateData value;
                    DB::readStringBinary(value.name, buf);
                    DB::readStringBinary(value.data, buf);
                    x.push_back(value);
                    break;
                }
            }
        }
    }
开发者ID:greck2908,项目名称:ClickHouse,代码行数:78,代码来源:Field.cpp


注:本文中的Tuple::toUnderType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。