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


C++ ptr_vector::push_back方法代码示例

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


在下文中一共展示了ptr_vector::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: specialValue

const Value MessageSelectorEnv::specialValue(const string& id) const
{
    Value v;
    // TODO: Just use a simple if chain for now - improve this later
    if ( id=="delivery_mode" ) {
        v = msg.getEncoding().isPersistent() ? PERSISTENT : NON_PERSISTENT;
    } else if ( id=="redelivered" ) {
        v = msg.getDeliveryCount()>0 ? true : false;
    } else if ( id=="priority" ) {
        v = int64_t(msg.getPriority());
    } else if ( id=="correlation_id" ) {
        MessageId cId = msg.getEncoding().getCorrelationId();
        if (cId) {
            returnedStrings.push_back(new string(cId.str()));
            v = returnedStrings[returnedStrings.size()-1];
        }
    } else if ( id=="message_id" ) {
        MessageId mId = msg.getEncoding().getMessageId();
        if (mId) {
            returnedStrings.push_back(new string(mId.str()));
            v = returnedStrings[returnedStrings.size()-1];
        }
    } else if ( id=="to" ) {
        v = EMPTY; // Hard to get this correct for both 1.0 and 0-10
    } else if ( id=="reply_to" ) {
        v = EMPTY; // Hard to get this correct for both 1.0 and 0-10
    } else if ( id=="absolute_expiry_time" ) {
        qpid::sys::AbsTime expiry = msg.getExpiration();
        // Java property has value of 0 for no expiry
        v = (expiry==qpid::sys::FAR_FUTURE) ? 0
            : qpid::sys::Duration(qpid::sys::AbsTime::Epoch(), expiry) / qpid::sys::TIME_MSEC;
    } else if ( id=="creation_time" ) {
        // Use the time put on queue (if it is enabled) as 0-10 has no standard way to get message
        // creation time and we're not paying attention to the 1.0 creation time yet.
        v = int64_t(msg.getTimestamp() * 1000); // getTimestamp() returns time in seconds we need milliseconds
    } else if ( id=="jms_type" ) {
        // Currently we can't distinguish between an empty JMSType and no JMSType
        // We'll assume for now that setting an empty JMSType doesn't make a lot of sense
        const string jmsType = msg.getAnnotation("jms-type").asString();
        if ( !jmsType.empty() ) {
            returnedStrings.push_back(new string(jmsType));
            v = returnedStrings[returnedStrings.size()-1];
        }
    } else {
        v = Value();
    }
    return v;
}
开发者ID:gregerts,项目名称:debian-qpid-cpp,代码行数:48,代码来源:Selector.cpp

示例3: 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

示例4: Layout

 Layout(float s0_snr,float mean_dif_,unsigned char odf_fold = 8,float discrete_scale_ = 0.5,float spin_density_ = 2000.0)
         :mean_dif(mean_dif_),discrete_scale(discrete_scale_),spin_density(spin_density_)
 {
     ti.init(odf_fold);
     for (unsigned int index = 0; index * discrete_scale <= spin_density+1.0; ++index)
         rician_gen.push_back(new RacianNoise((float)index * discrete_scale,spin_density/s0_snr));
 }
开发者ID:YounesN,项目名称:DSI-Studio,代码行数:7,代码来源:layout.hpp

示例5: 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

示例6: 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

示例7: 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

示例8: operator

void AddNormalizationRestrictionImpl::operator()( boost::ptr_vector<Restriction> & restrictions ) const {
	AgreementRestriction *agrRestr = new AgreementRestriction();
	agrRestr->addArgument(new AttributeExpression(new CurrentAnnotationExpression(), lspl::text::attributes::AttributeKey::BASE));
	agrRestr->addArgument(new ConstantExpression("1"));
	Restriction * restriction = agrRestr;
	restrictions.push_back( restriction );
}
开发者ID:alesapin,项目名称:lspl,代码行数:7,代码来源:Functions.cpp

示例9: if

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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: read_linestring_xyz

 void read_linestring_xyz(boost::ptr_vector<geometry_type> & paths)
 {
     geometry_type* line = new geometry_type(LineString);
     int num_points = read_integer();
     CoordinateArray ar(num_points);
     read_coords_xyz(ar);
     line->move_to(ar[0].x, ar[0].y);
     for (int i = 1; i < num_points; ++i)
     {
         line->line_to(ar[i].x, ar[i].y);
     }
     paths.push_back(line);
 }
开发者ID:rjw57,项目名称:mapnik,代码行数:13,代码来源:wkb.cpp

示例15: parseFile

void Parser::parseFile ( ProgramOptions &options, boost::ptr_vector<File> &fileList ) {
    std::string output = options.getFileName();
    std::ifstream stream ( output, std::ios::in );

    std::string line, path, name;
    std::uintmax_t file_size;
    if ( stream.is_open() ) {
        while ( stream.good() ) {
            std::getline ( stream, line );
            std::stringstream lineStream ( line );
            lineStream >> file_size >> path >> name;
            File *newFile = new File ( file_size, path, name );
            fileList.push_back ( newFile );
        }
    } else
开发者ID:canella,项目名称:doubletap,代码行数:15,代码来源:parser.cpp


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