HeightMapInterface* AbstractHeightMapManager::getHeightMapOfTile(Tile* tile) { if (tileMap.find(tile->getId()) != tileMap.end()) { return tileMap[tile->getId()]; //cache hit } //load and save std::string fileName = generateFileName(tile); HeightMapInterface* h = loadImpl(fileName); if(h) { PRINTD(INFO, "found saved heightmap at %s\n",fileName.c_str()); } else { PRINTD(INFO, "creating heightmap for tile %s\n",tile->getName().c_str()); h = createImpl(tile); if(h) { //save to disk if(!saveImpl(h, fileName)) PRINTD(WARNING, "can't save heightmap of tile %s to %s\n",tile->getName().c_str(), fileName.c_str()); } } if(h) { //save in cache -> TODO what about locks? tileMap[tile->getId()] = h; return h; } else { PRINTD(WARNING, "can't neighter load or create heightmap for tile %s\n",tile->getName().c_str()); return NULL; } }
Timer::timer_id Timer::create(uint64_t msFromNow, uint64_t msPeriod, std::function<void()>&& handler) { return createImpl(Instance(0, Clock::now() + Duration(msFromNow), Duration(msPeriod), std::move(handler))); }
WString& WString::arg(const WString& value) { createImpl(); impl_->arguments_.push_back(value); return *this; }
void ThreadImpl::startImpl(Runnable& target) { if (isRunningImpl()) throw SystemException("thread already running"); _pRunnableTarget = ⌖ createImpl(runnableEntry, this); }
void ThreadImpl::startImpl(Callable target, void* pData) { if (isRunningImpl()) throw SystemException("thread already running"); _callbackTarget.callback = target; _callbackTarget.pData = pData; createImpl(callableEntry, this); }
void HeadlessBackend::activate() { active = true; if (!impl) { createImpl(); } assert(impl); impl->activateContext(); }
WString& WString::arg(const std::wstring& value) { createImpl(); WString s; s.utf8_ = Wt::toUTF8(value); impl_->arguments_.push_back(s); return *this; }
//--------------------------------------------------------------------------- ResourcePtr GpuProgramManager::create(const String& name, const String& group, GpuProgramType gptype, const String& syntaxCode, bool isManual, ManualResourceLoader* loader) { // Call creation implementation ResourcePtr ret = ResourcePtr( createImpl(name, getNextHandle(), group, isManual, loader, gptype, syntaxCode)); addImpl(ret); // Tell resource group manager ResourceGroupManager::getSingleton()._notifyResourceCreated(ret); return ret; }
WString& WString::arg(const std::string& value, CharEncoding encoding) { createImpl(); if (realEncoding(encoding) == UTF8) impl_->arguments_.push_back(WString::fromUTF8(value, true)); else { WString s; s.utf8_ = Wt::toUTF8(value); impl_->arguments_.push_back(s); } return *this; }
//----------------------------------------------------------------------- ResourcePtr ResourceManager::create(const String& name, const String& group, bool isManual, ManualResourceLoader* loader, const NameValuePairList* params) { // Call creation implementation ResourcePtr ret = ResourcePtr( createImpl(name, getNextHandle(), group, isManual, loader, params)); if (params) ret->setParameterList(*params); addImpl(ret); // Tell resource group manager ResourceGroupManager::getSingleton()._notifyResourceCreated(ret); return ret; }
SPtr<RenderWindow> RenderWindowManager::create(RENDER_WINDOW_DESC& desc, SPtr<RenderWindow> parentWindow) { UINT32 id = ct::RenderWindowManager::instance().mNextWindowId.fetch_add(1, std::memory_order_relaxed); SPtr<RenderWindow> renderWindow = createImpl(desc, id, parentWindow); renderWindow->_setThisPtr(renderWindow); { Lock lock(mWindowMutex); mWindows[renderWindow->mWindowId] = renderWindow.get(); } if (renderWindow->getProperties().isModal) mModalWindowStack.push_back(renderWindow.get()); renderWindow->initialize(); return renderWindow; }
JSFunction* JSFunction::create(VM& vm, FunctionExecutable* executable, JSScope* scope) { JSFunction* result = createImpl(vm, executable, scope); executable->singletonFunction()->notifyWrite(vm, result, "Allocating a function"); return result; }
std::shared_ptr<IParameterUpdaterHook> IParameterUpdaterHook::create( const ParameterConfig& paramConfig, int idx) { std::pair<std::string, int> key = {paramConfig.name(), idx}; return g_hookCache_.get( key, [&] { return createImpl(paramConfig.update_hooks(idx)); }); }
JSGeneratorFunction* JSGeneratorFunction::createWithInvalidatedReallocationWatchpoint(VM& vm, FunctionExecutable* executable, JSScope* scope) { return createImpl(vm, executable, scope); }
JSGeneratorFunction* JSGeneratorFunction::create(VM& vm, FunctionExecutable* executable, JSScope* scope) { JSGeneratorFunction* generatorFunction = createImpl(vm, executable, scope); executable->singletonFunction()->notifyWrite(vm, generatorFunction, "Allocating a generator function"); return generatorFunction; }