当前位置: 首页>>代码示例>>C++>>正文


C++ multimap::insert方法代码示例

本文整理汇总了C++中std::multimap::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ multimap::insert方法的具体用法?C++ multimap::insert怎么用?C++ multimap::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::multimap的用法示例。


在下文中一共展示了multimap::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: makebumpers

int FlipMemo::makebumpers(std::multimap<LocBlk, BumperPoint*>& bblks, int rn, float& maxVDWrad) {
	int i = 0, an = 0;
	BumperPoint* bp;
	if (_isComplete) {
		for (i = 0; i < _resFlip[_resType].numBmpr; i++) { // regular
			const int f1 = i + 1;
			bp = new BumperPoint(_origLoc[f1], rn, an++, _wrkAtom[f1].vdwRad());
			bblks.insert(std::make_pair(LocBlk(_origLoc[f1]), bp));
//			bblks.put(LocBlk(_origLoc[f1]),
//				BumperPoint(_origLoc[f1], rn, an++, _wrkAtom[f1].vdwRad()));

			if (_wrkAtom[f1].vdwRad() > maxVDWrad) { maxVDWrad = _wrkAtom[f1].vdwRad(); }
		}
		for (i = 0; i < _resFlip[_resType].numPP; i++) { // flipped
			const int f2 = _resFlip[_resType].numPnts - i;
			bp = new BumperPoint(_origLoc[f2], rn, an++, _wrkAtom[f2].vdwRad());
			bblks.insert(std::make_pair(LocBlk(_origLoc[f2]), bp));
//			bblks.put(LocBlk(_origLoc[f2]),
//				BumperPoint(_origLoc[f2], rn, an++, _wrkAtom[f2].vdwRad()));

			if (_wrkAtom[f2].vdwRad() > maxVDWrad) { maxVDWrad = _wrkAtom[f2].vdwRad(); }
		}
	}
	return an;
}
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:25,代码来源:FlipMemo.cpp

示例2: register_record_menu_items

void  register_record_menu_items(std::multimap<std::string, std::pair<std::string, record_menu_item_info> >&  record_menu_items)
{
    record_menu_items.insert({
        scn::get_collider_folder_name(),
        {
            "capsule",
            {
                "Insert collision c&apsule",
                "Ctrl+Alt+C",
                "A 'capsule' is a collision object, i.e. a 'collider', whose shape consists of a torus with\n"
                "a hemisphere on the top and bottom of the cilinder. The shape of a capsule can be fully described\n"
                "by two numbers: 1. 'Excentricity' which is the distance of the hemispheres (or equally the length\n"
                "of the axis of the cylinder), and 2. 'Radius' which is the common radius of both hemispheres\n"
                "(or equally as the thickness of the cyinder from its axis).\n"
                "Each collider is further assigned a 'material', like WOOD or STEEL, which is used in computation of\n"
                "density, mass, inertia tensor, and friction coefficients. Finally, a collider can be maked as either\n"
                "'static' or 'dynamic'. A static collider cannot be moved (think of it as a part of ground). A dynamic\n"
                "collider is free to move in space and time, i.e. it can be moved together with an associated 'rigid body'."
            }
        }
    });
    record_menu_items.insert({
        scn::get_collider_folder_name(),
        {
            "sphere",
            {
                "Insert collision sp&here",
                "Ctrl+Alt+S",
                "A 'sphere' is a collision object, i.e. a 'collider', whose shape can be fully described\n"
                "by one number: 'Radius' of the sphere.\n"
                "Each collider is further assigned a 'material', like WOOD or STEEL, which is used in computation of\n"
                "density, mass, inertia tensor, and friction coefficients. Finally, a collider can be maked as either\n"
                "'static' or 'dynamic'. A static collider cannot be moved (think of it as a part of ground). A dynamic\n"
                "collider is free to move in space and time, i.e. it can be moved together with an associated 'rigid body'."
            }
        }
    });
    record_menu_items.insert({
        scn::get_collider_folder_name(),
        {
            "triangle mesh",
            {
                "Insert collision triangle &mesh",
                "Ctrl+Alt+M",
                "A 'triangle mesh' is simply a collection of triangles. A 'triangle' is then a collision object,\n"
                "i.e. a 'collider', whose shape can be fully described by 3 points in 3D space. Triangles in a triangle\n"
                "mesh are defined in two files 'vertices.txt' and 'indices.txt' representing the vertex buffer\n"
                "and index buffer of the triangles respectively. Several of these files are already available for use\n"
                "under meshes root directory '<E2-root-dir>/dist/data/shared/gfx/meshes/'. You can also use 'Blender' and\n"
                "'E2 Blender export plugin' (located in '<E2-root-dir>/data/Blender/export/E2_Blender_gfx_export_plugin.py')\n"
                "to create new files.\n"
                "Each collider is further assigned a 'material', like WOOD or STEEL, which is used in computation of\n"
                "density, mass, inertia tensor, and friction coefficients. Finally, a collider can be maked as either\n"
                "'static' or 'dynamic'. A static collider cannot be moved (think of it as a part of ground). A dynamic\n"
                "collider is free to move in space and time, i.e. it can be moved together with an associated 'rigid body'."
            }
        }
    });
}
开发者ID:trtikm,项目名称:E2,代码行数:59,代码来源:menu_bar_record_collider.cpp

示例3: getNodeItemsByMass

	void FragmentTree::getNodeItemsByMass(MonoPeakPtr pk, std::multimap<MonoPeakPtr, NodeItem>& node_map)
	{
		TreeByMass& tree_mass_index = node_pool.get<theo_mass>();
		double matching_error = param.getParameter<double>("matching_error").first;

		double mass = msmath::calculateMass(pk->mz, -1 * pk->z);
		TreeByMass::iterator mass_iter = tree_mass_index.lower_bound(mass);
    TreeByMass::iterator up_bound = tree_mass_index.upper_bound(mass);
		// Shift the iterator upstream and downstream.
		
		if(mass_iter == tree_mass_index.end() && up_bound == tree_mass_index.end()) // Not found.
			return;

		//std::cout << "Current mass: " << mass << std::endl;
		TreeByMass::iterator up_iter = mass_iter;

		// Upstream.
		while(1)
		{	
			//std::cout << "Try to match " << up_iter->getMass() << std::endl;
			if((up_iter->getMass() - mass)/mass >= 1e-6 * matching_error)
				break;

			if(abs(up_iter->getMass()-mass)/mass < 1e-6 * matching_error){
				//std::cout << "A hit for " << mass << std::endl;
				node_map.insert(std::make_pair(pk, *up_iter));	
				//if(status == false) status = true;
			} 
			up_iter++;
			if(up_iter == tree_mass_index.end())
				break;
		}
		TreeByMass::iterator down_iter = mass_iter;
		while(1)
		{
			//std::cout << "Try to match " << down_iter->getMass() << std::endl;
			if((mass - down_iter->getMass())/down_iter->getMass() >= 1e-6 * matching_error) {
				break;
			}

			if(abs(down_iter->getMass()-mass)/down_iter->getMass() < 1e-6 * matching_error){
				//std::cout << "A hit for " << mass << std::endl;
				node_map.insert(std::make_pair(pk, *down_iter));
				//if(status == false) status = true;
			} 
			if(down_iter == tree_mass_index.begin())
				break;
			down_iter--;
		}

		return;
		
	}
开发者ID:hh1985,项目名称:multi_hs_seq,代码行数:53,代码来源:LibraryTree.cpp

示例4: report

 virtual void report(const PortInfo& info) override {
     if (info.tag == PortInfo::PORTINFO_CONNECTION) {
         NameClient& nic = NameClient::getNameClient();
         Contact c;
         if (info.incoming) {
             c = RosNameSpace::rosify(nic.queryName(info.sourceName));
             incomingURIs.insert(std::make_pair(info.portName, c.toURI()));
         } else {
             c = RosNameSpace::rosify(nic.queryName(info.targetName));
             outgoingURIs.insert(std::make_pair(info.portName, c.toURI()));
         }
     }
 }
开发者ID:claudiofantacci,项目名称:yarp,代码行数:13,代码来源:Node.cpp

示例5: dfhack_timeout

int dfhack_timeout(lua_State *L)
{
    using df::global::world;
    using df::global::enabler;

    // Parse arguments
    lua_Number time = luaL_checknumber(L, 1);
    int mode = luaL_checkoption(L, 2, NULL, timeout_modes);
    luaL_checktype(L, 3, LUA_TFUNCTION);
    lua_settop(L, 3);

    if (mode > 0 && !Core::getInstance().isWorldLoaded())
    {
        lua_pushnil(L);
        return 1;
    }

    // Compute timeout value
    switch (mode)
    {
    case 2:
        time *= 1200;
        break;
    case 3:
        time *= 33600;
        break;
    case 4:
        time *= 403200;
        break;
    default:;
    }

    int delta = time;

    if (delta <= 0)
        luaL_error(L, "Invalid timeout: %d", delta);

    // Queue the timeout
    int id = next_timeout_id++;
    if (mode)
        tick_timers.insert(std::pair<int,int>(world->frame_counter+delta, id));
    else
        frame_timers.insert(std::pair<int,int>(frame_idx+delta, id));

    lua_rawgetp(L, LUA_REGISTRYINDEX, &DFHACK_TIMEOUTS_TOKEN);
    lua_swap(L);
    lua_rawseti(L, -2, id);

    lua_pushinteger(L, id);
    return 1;
}
开发者ID:mstram,项目名称:dfhack-40d,代码行数:51,代码来源:LuaTools.cpp

示例6: get_all_parameters

void HttpServerConnection::get_all_parameters(const char *qpos,
                                              std::multimap<std::string,
                                              std::string> &pars) {
    const char *ppos = qpos; // Start of parameter name
    while (*qpos) {
        if (*qpos == '&') {
            // Epmty value:
            pars.insert(std::make_pair(std::string(ppos, qpos), std::string()));
            ++qpos;
            ppos = qpos;
        } else if (*qpos == '=') {
            // Urldecode value:
            std::string par_name = std::string(ppos, qpos);
            ++qpos; ; // Start of value
            std::ostringstream res;
            while (char c = *qpos) {
                if (c == '&') {
                    ++qpos;
                    break;
                } else if (c == '+') {
                    ++qpos;
                    c = ' ';
                } else if (c == '%') {
                    // Should be two hex digits after %,
                    // but if not, ignore errors and just keep the %
                    if (*++qpos) {
                        char c1 = *qpos, c2;
                        if (*++qpos) {
                            c2 = *qpos;
                            if (c2) {
                                ++qpos;
                                int n = hexval(c1)*16+hexval(c2);
                                if (n >= 0)
                                    c = static_cast<char>(n);
                            }
                        }
                    }
                } else {
                    ++qpos;
                }
                res << c;
            }
            pars.insert(std::make_pair(par_name, res.str()));
            ppos = qpos;
        } else {
            ++qpos;
        }
    }
}
开发者ID:dotse,项目名称:bbk,代码行数:49,代码来源:httpserverconnection.cpp

示例7: adaptSG

long double adaptSG(StdVector<long double> & iv,
		    std::multimap<long double,std::vector<int> > & activeIndex,
		    std::set<std::vector<int> > & oldIndex,
		    AdaptiveSparseGridInterface<long double,StdVector<long double> > & problem_data,
		    CubatureTensorSorted<long double> & cubRule,
		    long double TOL) {

  // Construct a Container for the adapted rule
  int dimension = problem_data.getDimension();
  std::vector<int> index(dimension,1);
  
  // Initialize global error indicator
  long double eta = 1.0;
  
  // Initialize the Active index set
  activeIndex.insert(std::pair<long double,std::vector<int> >(eta,index));

  // Perform Adaptation
  while (eta > TOL) {
    eta = AdaptiveSparseGrid<long double,StdVector<long double> >::refine_grid(
                                                       activeIndex,oldIndex,
						       iv,cubRule,
						       eta,problem_data);
  }
  cubRule.normalize();
  return eta;
}
开发者ID:00liujj,项目名称:trilinos,代码行数:27,代码来源:test_23.cpp

示例8: Timer

    static void PASCAL Timer(unsigned int uTimerID, unsigned int uMsg,
                             DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
    {
        AsyncEvent *p;
        double tm;
        std::multimap<double, AsyncEvent *>::iterator e;

        while (1)
        {
            p = s_acSleep.get();
            if (p == NULL)
                break;

            tm = s_time + s_now + p->result();
            s_tms.insert(std::make_pair(tm, p));
        }

        atom_xchg(&s_now, (int)(v8::internal::OS::TimeCurrentMillis() - s_time));

        while (1)
        {
            e = s_tms.begin();
            if (e == s_tms.end())
                break;
            if (e->first > s_time + s_now)
                break;

            e->second->apost(0);
            s_tms.erase(e);
        }
    }
开发者ID:cwyiu,项目名称:fibjs,代码行数:31,代码来源:fbFiber.cpp

示例9: engineAttachDisplayToUpdateThread

VkBool32 VKTS_APIENTRY engineAttachDisplayToUpdateThread(const INativeDisplayWP& display, const IUpdateThreadSP& updateThread)
{
    if (g_engineState != VKTS_ENGINE_INIT_STATE)
    {
        logPrint(VKTS_LOG_ERROR, "Engine: Adding attaching display failed! Not in initialize state.");

        return VK_FALSE;
    }

    if (!updateThread.get())
    {
        logPrint(VKTS_LOG_ERROR, "Engine: No display or update thread.");

        return VK_FALSE;
    }

    auto sharedDisplay = display.lock();

    if (!sharedDisplay.get())
    {
        return VK_FALSE;
    }

    const auto nativeDisplay = visualGetDisplayInternal(sharedDisplay->getIndex());

    if (!nativeDisplay.get())
    {
        return VK_FALSE;
    }

    g_allAttachedDisplays.insert(std::pair<IUpdateThreadSP, const NativeDisplaySP>(updateThread, nativeDisplay));

    return VK_TRUE;
}
开发者ID:Asmodean-,项目名称:Vulkan,代码行数:34,代码来源:fn_engine.cpp

示例10: BuildPersistentCache

static bool BuildPersistentCache()
{
    if (next_persistent_id)
        return true;
    if (!Core::getInstance().isWorldLoaded())
        return false;

    stl::vector<df::historical_figure*> &hfvec = df::historical_figure::get_vector();

    // Determine the next entry id as min(-100, lowest_id-1)
    next_persistent_id = -100;

    if (hfvec.size() > 0 && hfvec[0]->id <= -100)
        next_persistent_id = hfvec[0]->id-1;

    // Add the entries to the lookup table
    persistent_index.clear();

    for (size_t i = 0; i < hfvec.size() && hfvec[i]->id <= -100; i++)
    {
        if (!hfvec[i]->name.has_name || hfvec[i]->name.first_name.empty())
            continue;

        persistent_index.insert(T_persistent_item(hfvec[i]->name.first_name, -hfvec[i]->id));
    }

    return true;
}
开发者ID:mstram,项目名称:dfhack-40d,代码行数:28,代码来源:World.cpp

示例11: readIntegerFile

void readIntegerFile(std::string inputFile, std::multimap<sampleType, int> &mapSample ){
  std::ifstream integerReader;
  std::string line;
  integerReader.open(inputFile, std::ios::in);
  int lineCounter = 0;  
  int diff = 1;
  while(std::getline(integerReader, line)){
    // read in the integer 
    std::istringstream iss(line);
    sampleType intSample(0);
    iss>>intSample; 
    // add it to the hash table 
    // mapSample[key] = data;
    // mapSample[intSample] = lineCounter;
    mapSample.insert(std::pair<sampleType, int>(intSample, lineCounter));

    lineCounter++;

    if((lineCounter - mapSample.size()) == diff){
      std::cout<<"At line: "<<lineCounter<<" , key: "<<intSample<<" is not inserted. "<<"Map size is: "<< mapSample.size()<<std::endl;
      diff++;
    }

  }// end of while 
  std::cout<<"The hash table size is: "<<mapSample.size()<<std::endl;
  std::cout<<"line counter is: "<<lineCounter<<std::endl;
  std::cout<<std::endl;
  std::cout<<std::endl;
  std::cout<<std::endl;
  //  std::cout<<"If the above two are not equal, then it means there are : "<<lineCounter<<std::endl;
} // end of reader 
开发者ID:wyqsnddd,项目名称:courseWork,代码行数:31,代码来源:two_sum_hash.cpp

示例12: merge_recommended_queries

  void query_recommender::merge_recommended_queries(std::multimap<double,std::string,std::less<double> > &related_queries,
      hash_map<const char*,double,hash<const char*>,eqstr> &update)
  {
    hash_map<const char*,double,hash<const char*>,eqstr>::iterator hit;
    std::multimap<double,std::string,std::less<double> >::iterator mit
    = related_queries.begin();
    while(mit!=related_queries.end())
      {
        std::string rquery = (*mit).second;
        if ((hit = update.find(rquery.c_str()))!=update.end())
          {
            (*hit).second = std::min((*mit).first,(*hit).second);
            std::multimap<double,std::string,std::less<double> >::iterator mit2 = mit;
            ++mit;
            related_queries.erase(mit2);
          }
        else ++mit;
      }
    hit = update.begin();
    hash_map<const char*,double,hash<const char*>,eqstr>::iterator chit;
    while(hit!=update.end())
      {
        related_queries.insert(std::pair<double,std::string>((*hit).second,std::string((*hit).first)));
        chit = hit;
        ++hit;
        free_const((*chit).first);
      }

  }
开发者ID:Psycojoker,项目名称:seeks,代码行数:29,代码来源:query_recommender.cpp

示例13: Store

void UserMappingGridmap::Store(
    std::string dn,
    std::string users,
    std::string user_seperator,
    boost::bimap< std::string, std::string > &new_username,
    std::multimap< std::string, std::string > &new_groupname) {
  // if there are several usernames, use only the first one
  escaped_list_separator<char> els2("", user_seperator.c_str(), "");
  tokenizer< escaped_list_separator<char> > tok_user(users, els2);
  tokenizer< escaped_list_separator<char> >::iterator first_username
      = tok_user.begin();
  std::string user = std::string(*first_username);

//      cout << "gridmap: dn: '" << dn << "'" << std::endl;
//      cout << "gridmap: user: " << user << std::endl;

  new_username.insert(bimap< string, string >::value_type(dn, user));

  // find groups (starting with OU=)
  size_t ou_pos = dn.find("OU=", 0);
  while (ou_pos != string::npos) {
    size_t end_pos = dn.find(",", ou_pos+1);
    std::string ou = dn.substr(ou_pos+3, end_pos-ou_pos-3);

//        cout << "gridmap: group: " << ou << std::endl;

    // add one usergroup (OU=...)
    new_groupname.insert(std::pair<std::string, std::string>(dn, ou));

    // search in the remaining string
    ou_pos = dn.find("OU=", ou_pos+1);
  }
}
开发者ID:2510,项目名称:xtreemfs,代码行数:33,代码来源:user_mapping_gridmap.cpp

示例14: getClasses

/// @brief distribute matched phrase by names
/// @param phrases vector with matched phrases [in]
/// @param phraseByCls classID to phrase_matched multimap [out]
// this impementatin doesn't use getClasses (by ids) since huge multimap overhead
void PhraseSearcher::getClasses(const vector<phrase_matched> &phrases, 
                                std::multimap<string, phrasecls_matched> &phraseByCls) const
{
  phraseByCls.clear();
  
  phrasecls_matched mi;
  phrase_record *phrec;
  phrase_classes_list *pclassList;
  
  for (vector<phrase_matched>::const_iterator it = phrases.begin();
       it != phrases.end();
       it++) 
  {
    phrec = m_pimpl->m_phrase_offsets[ it->phrase_id ];
    pclassList = __phrase_header_jump_to_classes(phrec);
    
    mi.phrase_id = it->phrase_id;
    mi.match_flags = it->match_flags;
    
    for (unsigned i = 0; i < pclassList->n; i++) {
      mi.baserank = pclassList->clse[i].phrase_rank;
      phraseByCls.insert(pair<string, phrasecls_matched>(m_pQCIndex->getName(pclassList->clse[i].clsid), mi));
    }
  }
}
开发者ID:bekbulatov,项目名称:htmarkup,代码行数:29,代码来源:phrase_searcher.cpp

示例15: Fill

void Morphology::Fill(std::vector<std::vector<int>>& img, std::vector<std::vector<int>>& labels, int width, int height, int x, int y, int L, std::multimap<int, Cell>& maps)
{
	if ((labels[x][y] == 0) & (img[x][y] == 1))
	{
		maps.insert(std::make_pair(L, Cell(y, x)));
		labels[x][y] = L;
		// 4x
		if (x > 0)
			Fill(img, labels, width, height, x - 1, y, L, maps);
		if (x < height - 1)
			Fill(img, labels, width, height, x + 1, y, L, maps);
		if (y > 0)
			Fill(img, labels, width, height, x, y - 1, L, maps);
		if (y < width - 1)
			Fill(img, labels, width, height, x, y + 1, L, maps);

		// 8x
		if (x > 0 && y > 0)
			Fill(img, labels, width, height, x - 1, y - 1, L, maps);
		if (x < height - 1 && y > 0)
			Fill(img, labels, width, height, x + 1, y - 1, L, maps);
		if (x > 0 && y < width - 1)
			Fill(img, labels, width, height, x - 1, y + 1, L, maps);
		if (x < height - 1 && y < width - 1)
			Fill(img, labels, width, height, x + 1, y + 1, L, maps);
	}
}
开发者ID:Niliem,项目名称:CourseProject,代码行数:27,代码来源:morphology.cpp


注:本文中的std::multimap::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。