• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ boost::ptr_vector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中boost::ptr_vector的典型用法代码示例。如果您正苦于以下问题:C++ ptr_vector类的具体用法?C++ ptr_vector怎么用?C++ ptr_vector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: operator

 void operator()(boost::ptr_vector<Variable>& target, Tag tag) {
   target.push_back( new ValueVariable<Tag>() );
   if (localization::MetaInfo<Tag>::has_range) {
     target.push_back( new MinVariable<Tag>() );
     target.push_back( new MaxVariable<Tag>() );
   }
 }
开发者ID:stevewolter,项目名称:rapidSTORM,代码行数:7,代码来源:localization_variable.cpp


示例2: from_wkb

bool geometry_utils::from_wkb(boost::ptr_vector<geometry_type>& paths,
                               const char* wkb,
                               unsigned size,
                               wkbFormat format)
{
    std::size_t geom_count = paths.size();
    wkb_reader reader(wkb, size, format);
    reader.read(paths);
    if (paths.size() > geom_count)
        return true;
    return false;
}
开发者ID:GISpecialist,项目名称:mapnik,代码行数:12,代码来源:wkb.cpp


示例3: operator

void AddLoopMatcherImpl::operator()( boost::ptr_vector<Matcher> & matchers, uint min, uint max, std::vector<uint> & alternativesCount ) const {
	LoopMatcher * matcher = new LoopMatcher( min, max );

	for ( int i = alternativesCount.size() - 1; i >= 0 ; -- i ) { // Важно!! Здесь перебираем в обратном порядке!
		MatcherContainer * matcherGroup = new MatcherContainer(); // Создаем контейнер для альтернативы

		matcherGroup->addMatchers( matchers.end() - alternativesCount[ i ], matchers.end(), matchers );

		matcher->addAlternative( matcherGroup );
	}

	matchers.push_back( matcher );
}
开发者ID:alesapin,项目名称:lspl,代码行数:13,代码来源:Functions.cpp


示例4: analyzeString

void AotGraphan::analyzeString( const std::string & str, boost::ptr_vector<Unit> & units ) {
	setupRml();

	try {
		CGraphmatFile file;

		if( !file.LoadDicts() ) { // Загружаем словари
			throw std::logic_error( file.GetLastError() );
		}

		if( !file.LoadStringToGraphan( str ) ) { // Загружаем файл
			throw std::logic_error( file.GetLastError() );
		}

		for( const CGraLine & line : file.GetUnits() ) {
			units.push_back( new Unit( line.GetToken(), line.GetTokenLength(), line.GetInputOffset(), line.IsWordOrNumberOrAbbr() ? Unit::WORD : line.IsPunct() ? Unit::PUNCT : Unit::UNKNOWN ) );
		}
	} catch ( const std::exception & e ) {
		throw e;
	} catch ( const CExpc & e ) {
		throw std::logic_error( "Couldn't init morphology: " + e.m_strCause );
	} catch (...) {
		throw std::logic_error( "Couldn't init morphology due to unknown error" );
	}
}
开发者ID:cmc-msu-ai,项目名称:lspl,代码行数:25,代码来源:AotGraphan.cpp


示例5: FindRescues

    /**
     * Function FindRescues
     * Grab all possible RESCUE_CACHE_CANDIDATEs into a vector.
     * @param aRescuer - the working RESCUER instance.
     * @param aCandidates - the vector the will hold the candidates.
     */
    static void FindRescues( RESCUER& aRescuer, boost::ptr_vector<RESCUE_CANDIDATE>& aCandidates )
    {
        typedef std::map<wxString, RESCUE_CACHE_CANDIDATE> candidate_map_t;
        candidate_map_t candidate_map;

        wxString part_name_suffix = aRescuer.GetPartNameSuffix();

        for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
        {
            wxString part_name( each_component->GetPartName() );

            LIB_PART* cache_match = find_component( part_name, aRescuer.GetLibs(), /* aCached */ true );
            LIB_PART* lib_match = aRescuer.GetLibs()->FindLibPart( part_name );

            // Test whether there is a conflict
            if( !cache_match || !lib_match )
                continue;
            if( !cache_match->PinsConflictWith( *lib_match, /* aTestNums */ true,
                    /* aTestNames */ true, /* aTestType */ true, /* aTestOrientation */ true,
                    /* aTestLength */ false ))
                continue;

            RESCUE_CACHE_CANDIDATE candidate(
                part_name, part_name + part_name_suffix,
                cache_match, lib_match );
            candidate_map[part_name] = candidate;
        }

        // Now, dump the map into aCandidates
        for( const candidate_map_t::value_type& each_pair : candidate_map )
        {
            aCandidates.push_back( new RESCUE_CACHE_CANDIDATE( each_pair.second ) );
        }
    }
开发者ID:reportingsjr,项目名称:kicad-source-mirror,代码行数:40,代码来源:project_rescue.cpp


示例6: read_polygon_xyz

 void read_polygon_xyz(boost::ptr_vector<geometry_type> & paths)
 {
     int num_rings = read_integer();
     if (num_rings > 0)
     {
         std::unique_ptr<geometry_type> poly(new geometry_type(geometry_type::types::Polygon));
         for (int i = 0; i < num_rings; ++i)
         {
             int num_points = read_integer();
             if (num_points > 0)
             {
                 CoordinateArray ar(num_points);
                 read_coords_xyz(ar);
                 poly->move_to(ar[0].x, ar[0].y);
                 for (int j = 1; j < num_points; ++j)
                 {
                     poly->line_to(ar[j].x, ar[j].y);
                 }
                 poly->close_path();
             }
         }
         if (poly->size() > 2) // ignore if polygon has less than 3 vertices
             paths.push_back(poly.release());
     }
 }
开发者ID:GISpecialist,项目名称:mapnik,代码行数:25,代码来源:wkb.cpp


示例7: compute_projections

void Projector::compute_projections(boost::ptr_vector<Projection>& projections,
                                    int image_size) const {

  // get coordinates
  IMP::algebra::Vector3Ds points(particles_.size());
  for (unsigned int i = 0; i < particles_.size(); i++) {
    points[i] = core::XYZ(particles_[i]).get_coordinates();
  }

  int axis_size = estimate_image_size(points);
  if (axis_size <= image_size) axis_size = image_size;

  // storage for rotated points
  IMP::algebra::Vector3Ds rotated_points(points.size());
  IMP::algebra::Rotation3Ds rotations;
  IMP::algebra::Vector3Ds axes;
  projection_sphere_.get_all_rotations_and_axes(rotations, axes);

  for (unsigned int i = 0; i<rotations.size(); i++) {
    // rotate points
    for (unsigned int point_index = 0; point_index < points.size();
         point_index++) {
      rotated_points[point_index] = rotations[i] * points[point_index];
    }
    // project
    IMP_UNIQUE_PTR<Projection> p(new Projection(rotated_points, mass_,
                                                pixel_size_, resolution_,
                                                axis_size));
    p->set_rotation(rotations[i]);
    p->set_axis(axes[i]);
    p->set_id(i);
    projections.push_back(p.release());
  }
}
开发者ID:salilab,项目名称:imp,代码行数:34,代码来源:Projector.cpp


示例8: sqrt

double distance::getEuclidean2(boost::ptr_vector<double>& v1, boost::ptr_vector<double>& v2)
{
	double euclidean = 0;
	int n = v1.size() == v2.size() ? v1.size() : 0;
	if (n > 0)
	{
		for (boost::ptr_vector<double>::iterator it1 = v1.begin(), it2 = v2.begin(); it1 != v1.end(), it2 != v2.end(); it1++, it2++)
		{
			euclidean += (*it1 - *it2)*(*it1 - *it2);
		}
		euclidean = sqrt(euclidean);
		return euclidean;
	}
	else
		return (double)-1;
}
开发者ID:campper,项目名称:CMS.Experiments.Console,代码行数:16,代码来源:distance.cpp


示例9: release_ptr

std::auto_ptr<T> release_ptr( T *p, boost::ptr_vector<T,C,A>& vec)
{
    std::auto_ptr<T> result;

	for( typename boost::ptr_vector<T,C,A>::iterator it( vec.begin()), e( vec.end()); it != e; ++it)
	{
		if( &(*it) == p)
		{
			typename boost::ptr_vector<T,C,A>::auto_type ptr = vec.release( it);
            result.reset( ptr.release());
            break;
		}
	}

	return result;
}
开发者ID:JohanAberg,项目名称:Ramen,代码行数:16,代码来源:ptr_vector_util.hpp


示例10: grid2utf

static void grid2utf(T const& grid_type,
                     boost::ptr_vector<uint16_t> & lines,
                     std::vector<typename T::lookup_type>& key_order,
                     unsigned int resolution)
{
    typedef std::map< typename T::lookup_type, typename T::value_type> keys_type;
    typedef typename keys_type::const_iterator keys_iterator;

    typename T::feature_key_type const& feature_keys = grid_type.get_feature_keys();
    typename T::feature_key_type::const_iterator feature_pos;

    keys_type keys;
    // start counting at utf8 codepoint 32, aka space character
    uint16_t codepoint = 32;

    unsigned array_size = std::ceil(grid_type.width()/static_cast<float>(resolution));
    for (unsigned y = 0; y < grid_type.height(); y=y+resolution)
    {
        uint16_t idx = 0;
        uint16_t* line = new uint16_t[array_size];
        typename T::value_type const* row = grid_type.getRow(y);
        for (unsigned x = 0; x < grid_type.width(); x=x+resolution)
        {
            // todo - this lookup is expensive
            typename T::value_type feature_id = row[x];
            feature_pos = feature_keys.find(feature_id);
            if (feature_pos != feature_keys.end())
            {
                typename T::lookup_type const& val = feature_pos->second;
                keys_iterator key_pos = keys.find(val);
                if (key_pos == keys.end())
                {
                    // Create a new entry for this key. Skip the codepoints that
                    // can't be encoded directly in JSON.
                    if (codepoint == 34) ++codepoint;      // Skip "
                    else if (codepoint == 92) ++codepoint; // Skip backslash
                    if (feature_id == mapnik::grid::base_mask)
                    {
                        keys[""] = codepoint;
                        key_order.push_back("");
                    }
                    else
                    {
                        keys[val] = codepoint;
                        key_order.push_back(val);
                    }
                    line[idx++] = static_cast<uint16_t>(codepoint);
                    ++codepoint;
                }
                else
                {
                    line[idx++] = static_cast<uint16_t>(key_pos->second);
                }
            }
            // else, shouldn't get here...
        }
        lines.push_back(line);
    }
}
开发者ID:adrianoxavier,项目名称:node-mapnik,代码行数:59,代码来源:js_grid_utils.hpp


示例11: GetAll

void GetAll(boost::ptr_vector<acl::Group>& groups)
{
  groups.clear();

  QueryResults results;
  mongo::Query query;
  boost::unique_future<bool> future;
  TaskPtr task(new db::Select("groups", query, results, future));
  Pool::Queue(task);

  future.wait();

  if (results.size() == 0) return;

  for (auto& obj: results)
    groups.push_back(bson::Group::Unserialize(obj));
}
开发者ID:cm277,项目名称:ebftpd,代码行数:17,代码来源:group.cpp


示例12: read_point

 void read_point(boost::ptr_vector<geometry_type> & paths)
 {
     geometry_type* pt = new geometry_type(Point);
     double x = read_double();
     double y = read_double();
     pt->move_to(x, y);
     paths.push_back(pt);
 }
开发者ID:rjw57,项目名称:mapnik,代码行数:8,代码来源:wkb.cpp


示例13: read_point

 void read_point(boost::ptr_vector<geometry_type> & paths)
 {
     double x = read_double();
     double y = read_double();
     std::unique_ptr<geometry_type> pt(new geometry_type(geometry_type::types::Point));
     pt->move_to(x, y);
     paths.push_back(pt.release());
 }
开发者ID:GISpecialist,项目名称:mapnik,代码行数:8,代码来源:wkb.cpp


示例14: parseParameters

void MultiDispatch::parseParameters(
    const std::vector<std::string>& input,
    boost::ptr_vector<ExpressionPiece>& output) {
  for (vector<string>::const_iterator it = input.begin(); it != input.end();
       ++it) {
    const char* src = it->c_str();
    output.push_back(get_complex_param(src));
  }
}
开发者ID:Morlok8k,项目名称:rlvm,代码行数:9,代码来源:GeneralOperations.cpp


示例15: renderScene

void renderScene() {
    FrameTimeCounter counter;
    int avgFps = 0;
    int iterations = 0;
    while (!complete) {
        counter.BeginCounting();

        physicsWorld->Simulate(1.0f / 10.0f);

        contextPtr->BeginScene();
        contextPtr->ApplyCamera(*cameraPtr);
        //contextPtr->RenderLine(vec2(0.0f, 0.0f), vec2(100.0f, 100.0f));
        for (int i = 0; i < physicsBodies.size(); ++i) {
            physicsBodies[i].DebugRender(debugRenderer);
        }

        for (int i = 0; i < physicsJoints.size(); ++i) {
            physicsJoints[i].DebugRender(debugRenderer);
        }

        contextPtr->EndScene();



        counter.EndCounting();

        avgFps += counter.GetFps();
        iterations++;
        if (iterations > 10) {
            SetWindowTextA(hWnd, formatString("fps: %d", avgFps / iterations).c_str());
            iterations = 0;
            avgFps = 0;
        }
    }
}
开发者ID:fromtherussia,项目名称:e2d,代码行数:35,代码来源:main.cpp


示例16: set

 void set(const string& id, const qb::Value& value) {
     if (value.type==qb::Value::T_STRING) {
         strings.push_back(new string(*value.s));
         values[id] = strings[strings.size()-1];
     } else {
         values[id] = value;
     }
 }
开发者ID:ncdc,项目名称:qpid,代码行数:8,代码来源:Selector.cpp


示例17: set_type

 void set_type(Uint32 type){
     switch (type){
         case man_Pistol: cooldown = 10; damage = 10; ammo.resize(100); break;
         case semi_Pistol: cooldown = 5; damage = 8; ammo.resize(30); break;
         case man_Rifle: cooldown = 15; damage = 20; ammo.resize(8); break;
         case semi_Rifle: cooldown = 8; damage = 18; ammo.resize(30); break;
         case auto_Rifle: cooldown = 2; damage = 15; ammo.resize(50); break;
         default: break;
     }
     version = type;
 }
开发者ID:ohmesdaddy2,项目名称:Endless-shooter,代码行数:11,代码来源:Weapon.hpp


示例18: fetch

inline bool command::fetch(std::vector<variant>& row)
{
  if (0 == m_hnd.stmt) return false;
  if (m_cols.empty()) columns();

  const sword r(lib::singleton().p_OCIStmtFetch2(m_hnd.stmt, m_hnd.err, 1, OCI_FETCH_NEXT, 1, OCI_DEFAULT));
  if (OCI_NO_DATA == r) return false;
  m_hnd.check(r);

  row.resize(m_cols.size());
  for (size_t i(0); i < m_cols.size(); ++i)
    m_cols[i](row[i]);
  return true;
}
开发者ID:igor-sadchenko,项目名称:brig,代码行数:14,代码来源:command.hpp


示例19: fetch

inline bool command::fetch(std::vector<variant>& row)
{
  if (!m_stmt) return false;
  if (m_cols.empty()) columns();

  const int r(lib::singleton().p_mysql_stmt_fetch(m_stmt));
  if (MYSQL_NO_DATA == r) return false;
  check(1 != r);

  row.resize(m_cols.size());
  for (size_t i(0); i < m_cols.size(); ++i)
    check(m_cols[i](m_stmt, (unsigned int)i, row[i]) == 0);
  return true;
}
开发者ID:respu,项目名称:brig,代码行数:14,代码来源:command.hpp


示例20: fetch

inline bool command::fetch(std::vector<variant>& row)
{
  if (lib::error(m_req)) return false;
  if (m_cols.empty()) columns();

  const int r(lib::singleton().p_cci_cursor(m_req, 1, CCI_CURSOR_CURRENT, &m_err));
  if (CCI_ER_NO_MORE_DATA == r) return false;
  check(r);
  check(lib::singleton().p_cci_fetch(m_req, &m_err));

  row.resize(m_cols.size());
  for (size_t i(0); i < m_cols.size(); ++i)
    if (lib::error(m_cols[i](m_req, i, row[i]))) throw std::runtime_error("CUBRID error");
  return true;
}
开发者ID:respu,项目名称:brig,代码行数:15,代码来源:command.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ boost::regex类代码示例发布时间:2022-05-31
下一篇:
C++ boost::promise类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap