Let's add a new class with approximately this definition:
It will work as follows:
- Data type plugins will provide instances of Type_collection.
- Each Type_collation will contain one or more data types (Type_handler instances).
- Data types from the same Type_collection will "know" each other.
- If two data types are from the same collection, data type aggregation for various operations (i.e. result, comparson, LEAST/GREATES, numeric dyadic operators) will be delegated to their Type_collection through virtual methods.
For now there will be two collections:
- Type_collection_geometry, containing Type_handler_geometry.
- Type_collection_std, containing all other built-in data types.
Later, we'll split out geometry subtypes (POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION) into separate type handlers, so Type_collection_geometry will contain 8 type handlers
(the generic one, and handlers for 7 subtypes):
Later, we'll add Type_collection_json and will turn JSON functionality into handlers:
and remove Item::is_json_type().
Later, we'll add Type_collection_inet with two data type handlers: