コード例 #1
0
ファイル: VirtualMachine.cpp プロジェクト: ronsaldo/chela
    inline Class *GetTemplateClass(Module *module, const std::string &className)
    {
        // Find the class type group.
        Member *member = module->GetMember(className + " <TG> ");
        if(!member || !member->IsTypeGroup())
            throw VirtualMachineException("Failed to load " + className + " <TG> ");

        // Use the first template in the group.
        TypeGroup *group = static_cast<TypeGroup*> (member);
        Structure *building = group->GetType(0);
        if(!building || !building->IsClass())
            throw VirtualMachineException("Failed to load template class " + className);

        // Cast the class.
        return static_cast<Class*> (building);
    }