Exemplo n.º 1
0
ConfigType::Ptr ConfigType::GetByName(const String& name)
{
	boost::mutex::scoped_lock lock(GetStaticMutex());

	ConfigType::TypeMap::const_iterator tt = InternalGetTypeMap().find(name);

	if (tt == InternalGetTypeMap().end()) {
		Type::Ptr type = Type::GetByName(name);

		if (!type || !ConfigObject::TypeInstance->IsAssignableFrom(type)
		    || type->IsAbstract())
			return ConfigType::Ptr();

		ConfigType::Ptr dtype = new ConfigType(name);

		InternalGetTypeMap()[type->GetName()] = dtype;
		InternalGetTypeVector().push_back(dtype);

		return dtype;
	}

	return tt->second;
}