Пример #1
0
static type_t pair_type(type_t a, type_t b) {
  type_t aux[2];

  aux[0] = a;
  aux[1] = b;
  return tuple_type(&types, 2, aux);
}
Пример #2
0
		hash_type add_timer_handler(handler_type handler, Integer id, Integers... ids)
		{
			hash_type hash = rand();
			add_handler_helper(tuple_type(hash, handler), id, ids...);

			return hash;
		}
Пример #3
0
static type_t pair_type(type_t t1, type_t t2) {
    type_t a[2];

    a[0] = t1;
    a[1] = t2;
    return tuple_type(&types, 2, a);
}
Пример #4
0
void MergeTreePartition::serializeText(const MergeTreeData & storage, WriteBuffer & out, const FormatSettings & format_settings) const
{
    size_t key_size = storage.partition_key_sample.columns();

    if (key_size == 0)
    {
        writeCString("tuple()", out);
    }
    else if (key_size == 1)
    {
        const DataTypePtr & type = storage.partition_key_sample.getByPosition(0).type;
        auto column = type->createColumn();
        column->insert(value[0]);
        type->serializeAsText(*column, 0, out, format_settings);
    }
    else
    {
        DataTypes types;
        Columns columns;
        for (size_t i = 0; i < key_size; ++i)
        {
            const auto & type = storage.partition_key_sample.getByPosition(i).type;
            types.push_back(type);
            auto column = type->createColumn();
            column->insert(value[i]);
            columns.push_back(std::move(column));
        }

        DataTypeTuple tuple_type(types);
        auto tuple_column = ColumnTuple::create(columns);
        tuple_type.serializeText(*tuple_column, 0, out, format_settings);
    }
}
Пример #5
0
static type_t triple_type(type_t a, type_t b, type_t c) {
  type_t aux[3];

  aux[0] = a;
  aux[1] = b;
  aux[2] = c;
  return tuple_type(&types, 3, aux);
}
Пример #6
0
static type_t triple_type(type_t t1, type_t t2, type_t t3) {
    type_t a[3];

    a[0] = t1;
    a[1] = t2;
    a[2] = t3;
    return tuple_type(&types, 3, a);
}
Пример #7
0
		hash_type add_keyboard_handler(handler_type handler, Type t, Types... characters)
		{
			hash_type hash = rand();
			auto tuple = tuple_type(hash, handler);

			add_handler_helper(tuple, t, characters...);

			return hash;
		}
Пример #8
0
// Parse a primary type.
//
//    primary-type:
//      'void'
//      'byte'
//      'bool'
//      'char'
//      'int'
//      'float'
//      'auto'
//      id-type
//      decltype-type
//      function-type
//      '( unary-type )'
//      '{ type-list }'
//
// FIXME: Design a better integer and FP type suite.
Type&
Parser::primary_type()
{
  switch (lookahead()) {
    case void_tok:
      return on_void_type(accept());
    case bool_tok:
      return on_bool_type(accept());
    case int_tok:
      return on_int_type(accept());
    case byte_tok:
      return on_byte_type(accept());

    // TODO: Implement me.
    case char_tok:
      lingo_unimplemented("char type");
    
    case float_tok:
      lingo_unimplemented("float type");
    
    case auto_tok:
      lingo_unimplemented("auto type");
    
    case decltype_tok:
      return decltype_type();

    case class_tok:
      return on_class_type(accept());

    case coroutine_tok:
      return on_coroutine_type(accept());

    case lparen_tok: {
      // FIXME: We shouldn't need a tentative parse for this.
      if (Type* t = match_if(&Parser::function_type))
        return *t;
      return grouped_type();
    }
    
    case lbrace_tok:
      return tuple_type();

    default:
      return id_type();
  }
}
Пример #9
0
	tuple_type
	to_tuple(variadic_sequence<_vSeq...>) const
	{
		return tuple_type(
			static_cast<const tuple_element_t<_vSeq, tuple_type>&>(*this)...);
	}