Example #1
0
function _create_data_type($name, $parent, array $copyArgs, array $swapArgs, $allowSubs, $serializable, $sep_deserial)
{
    global $_def_types;
    if (!isset($_def_types[$parent])) {
        throw new \RuntimeException("Attempting to create datatype with unknown parent type {$parent}.");
    }
    if (isset($_def_types[$name])) {
        throw new \RuntimeException("Attempting to create duplicate datatype {$name}");
    }
    $pInfo =& $_def_types[$parent];
    $copyable = $pInfo->is_copyable();
    $nType = new DataType($name, $copyArgs, $swapArgs, $copyable, $allowSubs, $serializable, $sep_deserial, $pInfo);
    $_def_types[$name] =& $nType;
    $_def_types[$parent]->add_child($name);
    $nType->expand();
}