void add_ptr_convs(TypeIndex index) { TypeInfo bare = index.get_info().class_type(); //add_conv_track<void>(bare); //add_conv_track<void const>(bare.as_const_value()); auto bottom_ptr_type = create_type_mirror("BottomPtr", size_t(0), create_bottom_ptr_type_index(), type_system->global_namespace().get_class_type()); type_system->add_class(create_bottom_ptr_type_index(), bottom_ptr_type, type_system->global_namespace()); // allow unsafe_ptr_cast to convert to any type and nil (NULL) to any pointer type add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_nonconst(), "bottom ptr unsafe cast to any ptr"); add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_const(), "bottom ptr unsafe cast to any const ptr"); // allow any ptr to be converted to void* or void const* add_nochange_conv(bare.as_ptr_to_nonconst(), TypId<void*>::restricted().get_info(), "any ptr to void ptr"); add_nochange_conv(bare.as_ptr_to_const(), TypId<void const*>::restricted().get_info(), "any ptr to const void ptr"); }
LM::TypeMirror& register_namespace(std::string name, TypeMirror& parent_namespace_) { std::string full_name = parent_namespace_.get_class_name() + "::" + name; const TypeIndex namespace_type(LM::create_namespace_type_index(full_name)); std::cout << "Registering namespace " << full_name << " as type " << namespace_type.description() << endl; if (type_system->get_class(namespace_type)) { return *(type_system->get_class(namespace_type)); } else { auto result = create_type_mirror(name, size_t(0), namespace_type, parent_namespace_.get_class_type()); type_system->add_class(namespace_type, result, parent_namespace_); return *result; } }
TypeMirror& register_class(std::string name, TypeMirror& namespace_) { const TypeIndex class_type(TypId<T>::liberal()); if (type_system->get_class(class_type)) return *(type_system->get_class(class_type)); else { auto result = create_type_mirror(name, GetSizeOf<T>::value, class_type, namespace_.get_class_type()); type_system->add_class(class_type, result, namespace_); result->set_deleter( std::unique_ptr<AbstractTermDeleter const>( new TermDeleter<T>())); return *result; } }