/////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// // // // Constructor // // /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// registerColorTransform::registerColorTransform(ptr<colorTransform> newColorTransform) { PUNTOEXE_FUNCTION_START(L"registerColorTransform::registerColorTransform"); ptr<colorTransformsFactory> pFactory(colorTransformsFactory::getColorTransformsFactory()); pFactory->registerTransform(newColorTransform); PUNTOEXE_FUNCTION_END(); }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ static Zen::Engine::Client::I_GameClientFactory::pGameClient_type getGameClient(const std::string& _name) { // First, load the plugin. Zen::Plugins::I_PluginManager::getSingleton().installPlugin(_name); Zen::Plugins::I_ExtensionRegistry& extensionRegistry = Zen::Plugins::I_ExtensionRegistry::getSingleton(); const Zen::Plugins::I_ExtensionRegistry::pExtensionQuery_type pQuery = extensionRegistry.createQuery(); pQuery->setNamespace("Zen::Engine::Client"); pQuery->setExtensionPoint("GameClient"); pQuery->setType(_name); // Get the extensions // Note that the result set takes ownership of pQuery Zen::Plugins::I_ExtensionRegistry::extension_result_set_ptr_type pExtensions = extensionRegistry.findExtensions(pQuery); // Grab the first extension; if there are more installed then eventually we can // deal with that but for now just grab one. Zen::Plugins::I_ExtensionRegistry::extension_result_set_type::iterator pExtensionIter = pExtensions->begin(); if (pExtensionIter != pExtensions->end()) { Zen::Plugins::I_ExtensionRegistry::class_factory_ref_type classFactory(extensionRegistry.getClassFactory(*pExtensionIter)); Zen::Engine::Client::I_GameClientFactory* pFactory(dynamic_cast<Zen::Engine::Client::I_GameClientFactory*>(&classFactory)); Zen::Engine::Client::I_GameClientFactory::config_type config; Zen::Engine::Client::I_GameClientFactory::pGameClient_type pGameClient = pFactory->create(_name, NULL, config); pGameClient->setSelfReference(pGameClient.getWeak()); return pGameClient; } else { // TODO Throw an exception / Log an error std::cout << "getGameClient(): Error finding game client " << _name << std::endl; } // TODO Throw an exception throw Zen::Utility::runtime_exception("Error"); }
/////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// // // // Retrieve a codec that can handle the specified // transfer syntax // // /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// ptr<codec> codecFactory::getCodec(std::wstring transferSyntax) { PUNTOEXE_FUNCTION_START(L"codecFactory::getCodec"); ptr<codecFactory> pFactory(getCodecFactory()); lockObject lockAccess(pFactory.get()); for(std::list<ptr<codec> >::iterator scanCodecs=pFactory->m_codecsList.begin(); scanCodecs!=pFactory->m_codecsList.end(); ++scanCodecs) { if((*scanCodecs)->canHandleTransferSyntax(transferSyntax)) { return (*scanCodecs)->createCodec(); } } ptr<codec> emptyCodec; return emptyCodec; PUNTOEXE_FUNCTION_END(); }
/////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// // // // Load the data from the specified stream and build a // dicomSet structure // // /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// ptr<dataSet> codecFactory::load(ptr<streamReader> pStream, std::uint32_t maxSizeBufferLoad /* = 0xffffffff */) { PUNTOEXE_FUNCTION_START(L"codecFactory::load"); // Copy the list of codecs in a local list so we don't have // to lock the object for a long time /////////////////////////////////////////////////////////// std::list<ptr<codec> > localCodecsList; ptr<codecFactory> pFactory(getCodecFactory()); { lockObject lockAccess(pFactory.get()); for(std::list<ptr<codec> >::iterator scanCodecs=pFactory->m_codecsList.begin(); scanCodecs!=pFactory->m_codecsList.end(); ++scanCodecs) { ptr<codec> copyCodec((*scanCodecs)->createCodec()); localCodecsList.push_back(copyCodec); } } ptr<dataSet> pDataSet; for(std::list<ptr<codec> >::iterator scanCodecs=localCodecsList.begin(); scanCodecs != localCodecsList.end() && pDataSet == 0; ++scanCodecs) { try { return (*scanCodecs)->read(pStream, maxSizeBufferLoad); } catch(codecExceptionWrongFormat& /* e */) { exceptionsManager::getMessage(); // Reset the messages stack continue; } } if(pDataSet == 0) { PUNTOEXE_THROW(codecExceptionWrongFormat, "none of the codecs recognized the file format"); } return pDataSet; PUNTOEXE_FUNCTION_END(); }