DnsResource* DnsLayer::getAdditionalRecord(const std::string& name, bool exactMatch) { uint16_t numOfAdditionalRecords = ntohs(getDnsHeader()->numberOfAdditional); IDnsResource* res = getResourceByName(m_FirstAdditional, numOfAdditionalRecords, name, exactMatch); if (res != NULL) return dynamic_cast<DnsResource*>(res); return NULL; }
DnsQuery* DnsLayer::getQuery(const std::string& name, bool exactMatch) { uint16_t numOfQueries = ntohs(getDnsHeader()->numberOfQuestions); IDnsResource* res = getResourceByName(m_FirstQuery, numOfQueries, name, exactMatch); if (res != NULL) return dynamic_cast<DnsQuery*>(res); return NULL; }
//----------------------------------------------------------------------- void ResourceManager::remove(const String& name) { ResourcePtr res = getResourceByName(name); if (!res.isNull()) { removeImpl(res); } }
CLuaScriptPtr CLuaScriptManager::load(const Ogre::String &name, const Ogre::String &group) { CLuaScriptPtr ptr = getResourceByName(name, group).dynamicCast<CLuaScript>(); if (ptr.isNull()) ptr = createResource(name, group).dynamicCast<CLuaScript>(); ptr->load(); return ptr; }
//----------------------------------------------------------------------- void ResourceManager::unload(const String& name) { ResourcePtr res = getResourceByName(name); if (!res.isNull()) { // Unload resource res->unload(); } }
//----------------------------------------------------------------------- void ResourceManager::remove(const String& name, const String& group) { ResourcePtr res = getResourceByName(name, group); #if OGRE_RESOURCEMANAGER_STRICT OgreAssert(res, ("attempting to remove unknown resource: "+name+" in group "+group).c_str()); #endif if (res) { removeImpl(res); } }
//----------------------------------------------------------------------- ResourceManager::ResourceCreateOrRetrieveResult ResourceManager::createOrRetrieve( const String& name, const String& group, bool isManual, ManualResourceLoader* loader, const NameValuePairList* params) { // Lock for the whole get / insert OGRE_LOCK_AUTO_MUTEX; ResourcePtr res = getResourceByName(name, group); bool created = false; if (!res) { created = true; res = createResource(name, group, isManual, loader, params); } return ResourceCreateOrRetrieveResult(res, created); }
//----------------------------------------------------------------------- CompositorPtr CompositorManager::getByName(const String& name, const String& groupName) { return getResourceByName(name, groupName).staticCast<Compositor>(); }
//----------------------------------------------------------------------- GpuProgramPtr GpuProgramManager::getByName(const String& name, const String& group, bool preferHighLevelPrograms) { return getResourceByName(name, group, preferHighLevelPrograms).staticCast<GpuProgram>(); }
//----------------------------------------------------------------------- FontPtr FontManager::getByName(const String& name, const String& groupName) { return getResourceByName(name, groupName).staticCast<Font>(); }
//----------------------------------------------------------------------- MeshPtr MeshManager::getByName(const String& name, const String& groupName) { return getResourceByName(name, groupName).staticCast<Mesh>(); }
//----------------------------------------------------------------------- MaterialPtr MaterialManager::getByName(const String& name, const String& groupName) { return getResourceByName(name, groupName).staticCast<Material>(); }
//----------------------------------------------------------------------- SkeletonPtr SkeletonManager::getByName(const String& name, const String& groupName) { return getResourceByName(name, groupName).staticCast<Skeleton>(); }