示例#1
0
void TestMain::CheckInstallation(std::unordered_map<std::wstring, std::wstring>& expectedContent)
{
	boost::filesystem::directory_iterator itEnd;
	for (boost::filesystem::directory_iterator itFile(datadirPath_ / L"install-test1"); itFile != itEnd; ++itFile) {
		lhWinAPI::TextFile tf(itFile->path().wstring(), GENERIC_READ, 0, OPEN_EXISTING);
		std::wstring txt;
		tf.ReadText(txt, lhWinAPI::TextFile::UTF8);
		std::wstringstream txtStream(txt);
		std::wstring fstLine;
		std::getline(txtStream, fstLine);

		bool foundFile = false;
		for (auto itMap = expectedContent.begin(); itMap != expectedContent.end(); ++itMap) {
			if (boost::iequals(itFile->path().filename().wstring(), itMap->first)) {
				foundFile = true;
				if (boost::iequals(fstLine, itMap->second)) {
					expectedContent.erase(itMap);
					break;
				}
				else {
					throw lhstd::exception(L"wrong version of " + itMap->first + L"\n" +
										   L"Content was: " + fstLine + L"\nExpected: " + itMap->second);
				}
			}
		}

		if (!foundFile) {
			throw lhstd::exception(L"unknown file " + itFile->path().filename().wstring());
		}
	}
	if (!expectedContent.empty()) {
		throw lhstd::exception(L"map not empty - " + expectedContent.begin()->first);
	}
}
void logAllData(std::unordered_map<int,Kantai*> _kantaiMap,
                std::unordered_map<int,Equip*> _equipMap,
                std::unordered_map<int,Fleet*> _fleetMap,
                std::unordered_map<int,std::pair<int, int>> _fleetKantaiMap,
                std::unordered_map<int,std::pair<int, int>> _kantaiEquipMap)
{
    log("-------------------------kantai in the map:-------------------------------");
    for (auto it=_kantaiMap.begin(); it!=_kantaiMap.end(); ++it)
    {
        log("kantaiKey: %d   kantaiNumber: %d",it->first,it->second->getKantaiNumber());
    }
    log("-------------------------equip in the map:-------------------------------");
    for (auto it=_equipMap.begin(); it!=_equipMap.end(); ++it)
    {
        log("equipKey: %d   equipNumber: %d",it->first,it->second->getEquipNumber());
    }
    log("-------------------------fleet in the map:-------------------------------");
    for (auto it=_fleetMap.begin(); it!=_fleetMap.end(); ++it)
    {
        log("fleetKey: %d   fleetKey: %d",it->first,it->second->getFleetKey());
    }
    log("-------------------------fleet and kantai relation in the map:-------------------------------");
    for (auto it=_fleetKantaiMap.begin(); it!=_fleetKantaiMap.end(); ++it)
    {
        log("kantaiKey: %d  fleetKey: %d  position: %d",it->first,it->second.first,it->second.second);
    }
    log("-------------------------kantai and equip relation in the map:-------------------------------");
    for (auto it=_kantaiEquipMap.begin(); it!=_kantaiEquipMap.end(); ++it)
    {
        log("equipKey: %d  kantaiKey: %d  position: %d",it->first,it->second.first,it->second.second);
    }
}
示例#3
0
void ParserOutput::outputCpp()
{
  ofstream file(outputfile + ".cpp");
  file << "#include \"" << outputfile << ".h\"" << endl;
  std::string fullFilename(resourceDirectory);
  fullFilename = fullFilename + "astres/SourcePreamble.txt";
  outputFile(&file,fullFilename.c_str());
  rules->outputTypeDefinitions(&file);
  outputListCode(&file);
  {
    auto iter = terminalTokens.begin();
    while (iter != terminalTokens.end())
      {
	file << iter->first << "_Type::" << iter->first << "_Type(char* _matchedText, char* _preceedingWhitespace)" << endl;
	file << ":TerminalTokenBaseClass(_matchedText,_preceedingWhitespace)" << endl;
	file << '{' << endl;
	file << '}' << endl;
	iter++;
      }
  }
  {
    auto iter = stringTokens.begin();
    while (iter != stringTokens.end())
      {
	file << iter->first << "_String_Type::" << iter->first << "_String_Type(char* _matchedText, char* _preceedingWhitespace)" << endl;
	file << ":TerminalTokenBaseClass(_matchedText,_preceedingWhitespace)" << endl;
	file << '{' << endl;
	file << '}' << endl;
	iter++;
      }
  }
}
void EziSocialObject::sendRequestToFriends(EziSocialWrapperNS::FB_REQUEST::TYPE requestType,
                                           const char* message,
                                           const std::vector<std::string> &selectedFriendIDs,
                                           const std::unordered_map<std::string,std::string> &dataDictionary, const char* customTitle)
{
    
    std::string dataString      = "";
    std::string friendsString   = "";
    
    for(auto it = dataDictionary.begin();it!=dataDictionary.end();++it)
    {
        if (it != dataDictionary.begin())
        {
            dataString.append(",");
        }
        dataString.append(it->first);
        dataString.append(",");
        dataString.append(it->second);
    }
    
    for(auto it = selectedFriendIDs.begin();it!=selectedFriendIDs.end();++it)
    {
        if (it != selectedFriendIDs.begin())
        {
            friendsString.append(",");
        }
        friendsString.append(*it);
    }
    
    EziSocialWrapperNS::sendRequest(internalRequestSendCallback,
                                    requestType,
                                    message,
                                    dataString.c_str(),
                                    friendsString.c_str(), customTitle);
}
示例#5
0
文件: StrategyXor.cpp 项目: yxtj/GSDM
std::vector<Motif> StrategyXor::refineByPostive(
	std::unordered_map<Motif, std::pair<int, double>>& data, const size_t gsize, const size_t topk)
{
	vector<pair<int, decltype(data.begin())>> idx;
	int minOcc = static_cast<int>(ceil(pRefine*gsize));
	auto it = data.begin();
	for(size_t i = 0; i < data.size(); ++i, ++it) {
		if(it->second.first >= minOcc) {
			it->second.second /= it->second.first;
			idx.emplace_back(i, it);
		}
	}
	sort(idx.begin(), idx.end(),
		[](const pair<int, decltype(data.begin())>& a, const pair<int, decltype(data.begin())>& b) {
		return a.first > b.first || a.first == b.first && a.second->second > b.second->second;
		//return a.first > b.first;
	});
	cout << "  valid motif: " << idx.size() << endl;

	vector<Motif> res;
	size_t end = min(topk, idx.size());
	for(size_t i = 0; i < end; ++i)
		res.push_back(move(idx[i].second->first));
	return res;
}
示例#6
0
文件: main.cpp 项目: knightzf/review
    bool impl(std::unordered_map<int, int>& oddMap,
              std::unordered_map<int, int>& evenMap,
              bool isAlice)
    {
        if(!evenMap.empty())
        {
            oddMap[evenMap.begin()->first] = evenMap.begin()->second - 1;
            evenMap.erase(evenMap.begin());
            return impl(oddMap, evenMap, !isAlice);
        }

        if(oddMap.begin()->second > 1)
        {
            evenMap[oddMap.begin()->first] = oddMap.begin()->second - 1;
            oddMap.erase(oddMap.begin());
        }
        else
        {
            oddMap.erase(oddMap.begin());
        }

        if(oddMap.empty()) return isAlice ? false : true;

        return impl(oddMap, evenMap, !isAlice);
    }
示例#7
0
void CNodeDefManager::removeNode(const std::string &name)
{
	// Pre-condition
	assert(name != "");

	// Erase name from name ID mapping
	content_t id = CONTENT_IGNORE;
	if (m_name_id_mapping.getId(name, id)) {
		m_name_id_mapping.eraseName(name);
		m_name_id_mapping_with_aliases.erase(name);
	}

	// Erase node content from all groups it belongs to
	for (std::unordered_map<std::string, std::vector<content_t>>::iterator iter_groups =
			m_group_to_items.begin(); iter_groups != m_group_to_items.end();) {
		std::vector<content_t> &items = iter_groups->second;
		items.erase(std::remove(items.begin(), items.end(), id), items.end());

		// Check if group is empty
		if (items.empty())
			m_group_to_items.erase(iter_groups++);
		else
			++iter_groups;
	}
}
示例#8
0
void init() {
    CLOG(L"Initializing...");

    delete vOSD;
    delete eOSD;

    Settings *settings = Settings::Instance();
    settings->Load();

    SkinManager::Instance()->LoadSkin(settings->SkinXML());

    /* TODO: Detect monitor changes, update this map, and reload/reorg OSDs */
    DisplayManager::UpdateMonitorMap();

    /* OSDs */
    eOSD = new EjectOSD();
    vOSD = new VolumeOSD();

    /* Hotkey setup */
    if (hkManager != NULL) {
        hkManager->Shutdown();
    }
    hkManager = HotkeyManager::Instance(mainWnd);

    hotkeys = Settings::Instance()->Hotkeys();
    for (auto it = hotkeys.begin(); it != hotkeys.end(); ++it) {
        int combination = it->first;
        hkManager->Register(combination);
    }

    WTSRegisterSessionNotification(mainWnd, NOTIFY_FOR_THIS_SESSION);
}
示例#9
0
 ~Space()
 {
     for (auto it = clusters.begin(); it != clusters.end(); ++it)
     {
         delete it->second;
     }
 }
示例#10
0
文件: Cvar.cpp 项目: Razish/xsngine
// public, static
void Cvar::List( void ) {
	console.Print( PrintLevel::Normal, "Listing cvars...\n" );

	std::map<std::string, Cvar *> sorted( cvars.begin(), cvars.end() );
	std::vector<std::string> keyValues;
	keyValues.reserve( sorted.size() );

	Indent indent( 1 );
	size_t maxLen = 1u;
	for ( const auto &cvar : sorted ) {
		keyValues.push_back( String::Format( "%s = \"%s\"", cvar.first.c_str(), cvar.second->fullString.c_str() ) );
		const size_t len = strlen( keyValues.back().c_str() );
		if ( len > maxLen ) {
			maxLen = len;
		}
	}
	uint32_t i = 0;
	for ( const auto &cvar : sorted ) {
		console.Print( PrintLevel::Normal, "%-*s: %s\n",
			maxLen + 1,
			keyValues[i++].c_str(),
			cvar.second->description.c_str()
		);
	}
}
示例#11
0
        Unit* SelectRandomNotStomach()
        {
            if (Stomach_Map.empty())
                return NULL;

            std::unordered_map<ObjectGuid, bool>::const_iterator i = Stomach_Map.begin();

            std::list<Unit*> temp;
            std::list<Unit*>::const_iterator j;

            //Get all players in map
            while (i != Stomach_Map.end())
            {
                //Check for valid player
                Unit* unit = ObjectAccessor::GetUnit(*me, i->first);

                //Only units out of stomach
                if (unit && i->second == false)
                    temp.push_back(unit);

                ++i;
            }

            if (temp.empty())
                return NULL;

            j = temp.begin();

            //Get random but only if we have more than one unit on threat list
            if (temp.size() > 1)
                advance(j, rand32() % (temp.size() - 1));

            return (*j);
        }
示例#12
0
std::string GlobalConfig::GetEntryDescriptions()
{
	std::string out;
	unsigned int descIdx = 0;
	for (auto desc = m_entries.begin(); desc != m_entries.end(); ++desc, ++descIdx)
	{
		out += "##### \"" + desc->first + "\"" + " (" + std::to_string(desc->second.m_value.size()) + " params)\n" + desc->second.m_description;
		if (!desc->second.m_listeners.empty())
		{
			out += "\n[Listeners: ";
			unsigned int listenerIdx = 0;
			for (auto listener = desc->second.m_listeners.begin(); listener != desc->second.m_listeners.end(); ++listener, ++listenerIdx)
			{
				out += "\"" + listener->first + "\"";
				if (listenerIdx < desc->second.m_listeners.size() - 1)
					out += ", ";
			}
			out += "]";
		}
		if (descIdx < m_entries.size() - 1)
			out += "\n\n";
		
	}
	return out;
}
	bool PhysicsEngine::update(float deltaTime){
		_world->stepSimulation(deltaTime, 60);

		//iterate across the contacts map
		for(auto contactsIter = contacts.begin(); contactsIter!=contacts.end(); ++contactsIter){
			//get the entity key from  teh current entry in the map
			Entity* collider0 = contactsIter->first;
			//get the set of colliders from the current entry in the map
			std::set<Entity*>& set = contactsIter->second;
			//iterate thru all the entities in the set
			for(auto entityIter = set.begin(); entityIter!=set.end(); ++entityIter){
				// get the other colider from the iterator
				Entity* collider1 = *entityIter;
				//create 2 messages - one for collider and one for the entity being hit
				Message msg1(collider0, "COLLISION", collider1);
				Message msg2(collider1, "COLLISION", collider0);
				//dispatch teh messages
				MessageHandler::sendMessage(msg1);
				MessageHandler::sendMessage(msg2);
			}
		}
		//empty the contacts map ready for next time
		contacts.clear();

		//for now
		return true;
	}
示例#14
0
		/**
		 * @brief Construct result, by packing process.
		 */
		void constructResult()
		{
			if (result.empty() == false)
				return;

			// 제품과 포장지 그룹, Product와 WrapperGroup의 1:1 매칭
			for (size_t i = 0; i < size(); i++)
			{
				const std::shared_ptr<Wrapper> &wrapper = at(i);
				if (result.count(wrapper->key()) == 0)
				{
					WrapperGroup *wrapperGroup = new WrapperGroup(wrapper);
					result.insert({ wrapper->key(), std::shared_ptr<WrapperGroup>(wrapperGroup) });
				}

				std::shared_ptr<WrapperGroup> wrapperGroup = result.at(wrapper->key());
				std::shared_ptr<Instance> instance = instanceArray->at(i);

				if (wrapperGroup->allocate(instance) == false)
				{
					// 일개 제품 크기가 포장지보다 커서 포장할 수 없는 경우, 
					// 현재의 염기서열은 유효하지 못하여 폐기됨
					valid = false;
					return;
				}
			}

			// 유효한 염기서열일 때,
			for (auto it = result.begin(); it != result.end(); it++)
			{
				it->second->optimize(); // 세부적(그룹별)으로 bin-packing을 실시함
				price += it->second->getPrice(); // 더불어 가격도 합산해둔다
			}
			valid = true;
		};
示例#15
0
文件: Lead.cpp 项目: ChadSki/Phasor
    void __stdcall OnTick()
    {
        if (ignoreUntilNewGame) return;

        bytesCopied = 0;
        for (int i = 0; i < 16; i++) {
            s_player* player = game::getPlayer(i);
            if (player) {
                auto& history = playerHistory[player->memory_id];

                objects::s_halo_biped* obj = (objects::s_halo_biped*)
                    objects::GetObjectAddress(player->mem->object_id);
                if (obj) {
                    history.add(obj);
                } else {
                    // object is no longer valid (i.e. player died)
                    history.clear();
                }
            }
        }

        for (auto itr = vehicleHistory.begin(); itr != vehicleHistory.end(); ++itr) {
            objects::s_halo_vehicle* obj = (objects::s_halo_vehicle*)
                objects::GetObjectAddress(make_ident(itr->first));
            if (obj) {
                itr->second.add(obj);
            } else {
                itr->second.clear();
            }
        }
    }
示例#16
0
int WindowsAPI::nextEvents(bool &quit) {
  MSG uMsg;
  memset(&uMsg,0,sizeof(uMsg));
  int r = 0;

  while( !quit ){
    if( PeekMessage( &uMsg, NULL, 0, 0, PM_REMOVE ) ){
      if( uMsg.message==WM_QUIT )
        quit = 1;

      TranslateMessage( &uMsg );
      DispatchMessage ( &uMsg );

      if( uMsg.message==WM_QUIT )
        r = uMsg.wParam;
      } else {
      for( auto i=wndWx.begin(); i!=wndWx.end(); ++i )
        render( i->second );

      Sleep(1);
      return r;
      }
    }

  return r;
  }
double predict(const std::unordered_map<double, std::vector<double> > &model,
               const std::unordered_set<double> &label_set,
               const std::vector<double> &feats)
{
    // binary classification
    if (model.size() == 1) {
        std::unordered_set<double>::const_iterator lit = label_set.begin();
        const double label1 = *(lit++);
        const double label2 = *lit;
        const std::unordered_map<double, std::vector<double> >::const_iterator mit = model.find(label1);
        assert(mit != model.end());

        return hypothesis(mit->second, feats) > 0.5 ? label1 : label2;
    }

    double max_hyp = -1;
    double max_label = -1;
    for (std::unordered_map<double, std::vector<double> >::const_iterator it = model.begin();
         it != model.end();
         ++it)
    {
        double hyp = hypothesis(it->second, feats);
        if (hyp > max_hyp) {
            max_hyp = hyp;
            max_label = it->first;
        }
    }
    assert(max_hyp != -1);
    assert(max_label != -1);

    return max_label;
}
示例#18
0
    void FormatResponse()
    {
      auto ostream = std::ostringstream();

      // Write the header.
      ostream << "HTTP/" << (httpVersion == 1.0f ? "1.0" : "1.1") << " ";
      ostream << ToString(status);
      for (auto it = params.begin(); it != params.end(); ++it)
      {
        auto& param = *it;
        ostream << std::endl << param.first << ": " << param.second;
      }
      ostream << std::endl;

      ostream << "Content-Type: ";
      switch (dataType)
      {
      case HttpDataType::Html: 
        ostream << "text/html;"; 
        break;
      case HttpDataType::Json:
        ostream << "application/json";
        break;
      default:
        throw std::runtime_error("HttpResponse.FormatResponse - Unknown HttpDataType being used");
      }

      ostream << "charset=utf-8" << std::endl;
      ostream << "Content-Length: " << data.size();

      ostream << std::endl << std::endl << std::move(data);
      fullResponse = ostream.str();
    }
示例#19
0
QRect calculateBoundingRect(const std::unordered_map<core::MapNode*, QPoint>& nodesPos, int tileSize)
{
    if (nodesPos.size() == 0)
        return QRect(0, 0, 0, 0);

    QPoint bpos = nodesPos.begin()->second;
    QPoint topLeft = bpos;
    QPoint bottomRight = bpos;

    for (const auto& element : nodesPos)
    {
        QPoint pos = element.second;
        topLeft.setX(std::min(pos.x(), topLeft.x()));
        bottomRight.setX(std::max(pos.x(), bottomRight.x()));

        topLeft.setY(std::min(pos.y(), topLeft.y()));
        bottomRight.setY(std::max(pos.y(), bottomRight.y()));
    }

    // x,y is the top-left corner of the node so we need to add the tile
    // size
    bottomRight += QPoint(tileSize, tileSize);

    // leave a half-tile padding
    QPoint padding(tileSize / 2, tileSize / 2);
    topLeft -= padding;
    bottomRight += padding;

    return QRect(topLeft, bottomRight);
}
SoundManager::~SoundManager()
{
#ifdef FMOD_ACTIVE
    for (auto iter = _instancesMusic.begin(); iter != _instancesMusic.end(); iter++)
    {
        ERRCHECK((*iter)->release());
    }
    _instancesMusic.clear();
    for (auto iter = _instancesFX.begin(); iter != _instancesFX.end(); iter++)
    {
        ERRCHECK((*iter)->release());
    }
    _instancesFX.clear();
    for (auto iter = _instancesMap.begin(); iter != _instancesMap.end(); iter++)
    {
        ERRCHECK((*iter).second->release());
    }
    _instancesMap.clear();
    
    for (FMOD::Studio::Bank * bank : _banks)
    {
        ERRCHECK(bank->unloadSampleData());
        ERRCHECK(bank->unload());
    }
    ERRCHECK(_stringsBank->unload());
    
    ERRCHECK(_system->release());
    
    Director::getInstance()->getScheduler()->unschedule(schedule_selector(SoundManager::updateSounds), this);
#endif
}
示例#21
0
bool IsLibraryAppletRunning() {
    // Check the applets map for instances of any applet
    for (auto itr = applets.begin(); itr != applets.end(); ++itr)
        if (itr->second != nullptr)
            return true;
    return false;
}
示例#22
0
        inline std::string escape(std::string const& source, std::unordered_map<char, std::string> const& escapes) {
            std::string magic;
            magic.reserve(escapes.size());
            std::transform(escapes.begin(), escapes.end(), std::back_inserter(magic), [](std::pair<char const, std::string> const& p) { return p.first; });

            auto first = source.begin();
            auto last = source.end();

            auto n_magic = std::count_if(first, last, [&magic](char c) { return magic.find(c) != std::string::npos; });

            std::string escaped;
            escaped.reserve(source.size() + n_magic*6);

            while(first != last) {
                auto next_magic = std::find_first_of(first, last, magic.begin(), magic.end());
                std::copy(first, next_magic, std::back_inserter(escaped));
                first = next_magic;
                if(first != last) {
                    auto it = escapes.find(*first);
                    if(it != escapes.end()) {
                        escaped += it->second;
                    }
                    ++first;
                }
            }
            return escaped;
        }
示例#23
0
	void doFades(float dtime)
	{
		m_fade_delay += dtime;

		if (m_fade_delay < 0.1f)
			return;

		float chkGain = 0;
		for (std::unordered_map<int, FadeState>::iterator i = m_sounds_fading.begin();
				i != m_sounds_fading.end();) {
			if (i->second.step < 0.f)
				chkGain = -(i->second.current_gain);
			else
				chkGain = i->second.current_gain;

			if (chkGain < i->second.target_gain) {
				i->second.current_gain += (i->second.step * m_fade_delay);
				i->second.current_gain = rangelim(i->second.current_gain, 0, 1);

				updateSoundGain(i->first, i->second.current_gain);
				++i;
			} else {
				if (i->second.target_gain <= 0.f)
					stopSound(i->first);

				m_sounds_fading.erase(i++);
			}
		}
		m_fade_delay = 0;
	}
示例#24
0
文件: Tracing.cpp 项目: Justme0/giri
void EntryCache::closeCacheFile() {
  // Create basic block termination entries for each basic block on the stack.
  // These were the basic blocks that were active when the program terminated.
  // **** Should we print the return records for active functions as well?????????
  for (auto I = BBStack.begin(); I != BBStack.end(); ++I) {
    while (!I->second.empty()) {
      // Create a basic block entry for it.
      unsigned bbid = I->second.top().id;
      unsigned char *fp = I->second.top().address;
      addToEntryCache(Entry(RecordType::BBType, bbid, I->first, fp));
      I->second.pop();
    }
  }

  // Create an end entry to terminate the log.
  addToEntryCache(Entry(RecordType::ENType, 0));

  size_t len = sizeof(Entry) * index;
  // Unmap the data. This should force it to be written to disk.
  msync(cache, len, MS_SYNC);
  munmap(cache, len);

  // Truncate the file to be the actual size for small traces
  ftruncate(fd, len + fileOffset);
}
示例#25
0
    std::pair<ValuePtr, size_t> Evaluator::TestLocalMinibatch(const std::unordered_map<Variable, ValuePtr>& arguments, std::unordered_map<Variable, ValuePtr>& outputsToFetch, const DeviceDescriptor& computeDevice)
    {
        if (!m_aggregatedEvaluationFunction)
            InvalidArgument("Evaluator::TestMinibatch: Cannot test when no evaluation function was specified during construction.");

        if (arguments.empty()) // Empty minibatch, return 0.
        {
            auto zeroValue = MakeSharedObject<Value>(
                MakeSharedObject<NDArrayView>(
                    m_aggregatedEvaluationFunction->Output().GetDataType(),
                    m_aggregatedEvaluationFunction->Output().IsSparse() ? StorageFormat::SparseCSC : StorageFormat::Dense,
                    m_aggregatedEvaluationFunction->Output().Shape(), computeDevice));
            if(zeroValue->GetDataType() == DataType::Float)
                zeroValue->Data()->SetValue(0.0f);
            else
                zeroValue->Data()->SetValue(0.0);
            return std::make_pair(zeroValue, 0);
        }

        std::unordered_map<Variable, ValuePtr> outputs = { { m_aggregatedEvaluationFunction, nullptr }, { m_testSampleCountVar, nullptr } };
        outputs.insert(outputsToFetch.begin(), outputsToFetch.end());

        m_combinedEvalFunction->Forward(arguments, outputs, computeDevice);

        const ValuePtr& aggregateEvalCriterionValue = outputs[m_aggregatedEvaluationFunction];
        auto sampleCount = GetSampleCount(m_testSampleCountVar, outputs[m_testSampleCountVar]);

        // Copy back output values for requested variables only.
        for (auto& o : outputsToFetch)
            o.second = outputs[o.first];

        return make_pair(aggregateEvalCriterionValue, sampleCount);
    }
	static void Exit() {												// Clean up Texture Library
		std::unordered_map <std::string, GLuint>::iterator it;
		for (it = textures.begin(); it != textures.end(); it++)
			glDeleteTextures(1, &it->second);
		textures.clear();
		std::cout << "Cleaned Texture Library.." << std::endl;
	}
示例#27
0
		std::vector<int> getMs() {
			std::vector<int> m_keys;
			std::unordered_map<int, std::list<int> >::iterator iter;
			for(iter = m_neighbor_set.begin(); iter != m_neighbor_set.end(); iter++) {
				m_keys.push_back(iter->first);
			}
			return m_keys;
		};
const char * cps_class_data_type_to_string(CPS_CLASS_DATA_TYPE_t data) {
    auto it = std::find_if(_data_types.begin(),_data_types.end(),[data]
            (const std::unordered_map<std::string,CPS_CLASS_DATA_TYPE_t>::value_type &it){
                return (it.second == data);
            });
    if (it != _data_types.end()) return it->first.c_str();
    return nullptr;
}
const char * cps_class_owner_type_to_string(CPS_API_OBJECT_OWNER_TYPE_t data) {
    auto it = std::find_if(_owner_type_to_string.begin(),_owner_type_to_string.end(),[data]
            (const std::unordered_map<std::string,CPS_API_OBJECT_OWNER_TYPE_t>::value_type &it){
                return (it.second == data);
            });
    if (it != _owner_type_to_string.end()) return it->first.c_str();
    return nullptr;
}
const char * cps_operation_type_to_string(cps_api_operation_types_t data) {
    auto it = std::find_if(_op_types.begin(),_op_types.end(),[data]
            (const std::unordered_map<std::string,cps_api_operation_types_t>::value_type &it){
                return (it.second == data);
            });
    if (it != _op_types.end()) return it->first.c_str();
    return nullptr;
}