您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strategy函数代码示例

51自学网 2021-06-03 08:27:08
  C++
这篇教程C++ strategy函数代码示例写得很实用,希望能帮到您。

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

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

示例1: strategy

void TestWordBddaDiscoverStrategy::TestDiscoverFootNotes(){   MockVisitor visitor;   WordSchemaSoftPolicy policy;   policy.EnableFootNotes();   WordSchemaSoftDiscoverStrategy strategy(visitor, policy, TEST_FILE_PATH _T("TestDiscoverFootnotes//Footnotes.doc"));   strategy.Execute();   assertEquals(_T("<TestFootnoteTestEndnote>"), visitor.GetFootNotes());}
开发者ID:killbug2004,项目名称:WSProf,代码行数:10,


示例2: search_label

/* * Find a valid disklabel. */static intsearch_label(struct of_dev *devp, u_long off, u_char *buf, struct disklabel *lp,	     u_long off0){	size_t nread;	struct mbr_partition *p;	int i;	u_long poff;	static int recursion;	if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &nread)	    || nread != DEV_BSIZE)		return ERDLAB;	if (*(u_int16_t *)&buf[MBR_MAGIC_OFFSET] != sa_htole16(MBR_MAGIC))		return ERDLAB;	if (recursion++ <= 1)		off0 += off;	for (p = (struct mbr_partition *)(buf + MBR_PART_OFFSET), i = 4;	     --i >= 0; p++) {		if (p->mbrp_type == MBR_PTYPE_NETBSD#ifdef COMPAT_386BSD_MBRPART		    || (p->mbrp_type == MBR_PTYPE_386BSD &&			(printf("WARNING: old BSD partition ID!/n"), 1)			/* XXX XXX - libsa printf() is void */ )#endif		    ) {			poff = get_long(&p->mbrp_start) + off0;			if (strategy(devp, F_READ, poff + 1,				     DEV_BSIZE, buf, &nread) == 0			    && nread == DEV_BSIZE) {				if (!getdisklabel(buf, lp)) {					recursion--;					return 0;				}			}			if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &nread)			    || nread != DEV_BSIZE) {				recursion--;				return ERDLAB;			}		} else if (p->mbrp_type == MBR_PTYPE_EXT) {			poff = get_long(&p->mbrp_start);			if (!search_label(devp, poff, buf, lp, off0)) {				recursion--;				return 0;			}			if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &nread)			    || nread != DEV_BSIZE) {				recursion--;				return ERDLAB;			}		}	}	recursion--;	return ERDLAB;}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:61,


示例3: discovery_service_start

int discovery_service_start(discovery_service *svc, discovery_strategy *strategy) {  JNXCHECK(svc);  // *** TODO Set up brodcast or multicast ***  // It should just be a simple matter of passing a flag to the service  // or changing the function signature and calling either  // set_up_sockets_for_broadcast or set_up_sockets_for_multicast.  // set_up_sockets_for_broadcast(svc);  svc->sock_send = jnx_socket_udp_create(svc->family);  svc->udp_listener = jnx_socket_udp_listener_broadcast_create(      port_to_string(svc), svc->family);  svc->isrunning = 1;  if (0 != listen_for_discovery_packets(svc)) {    JNXLOG(0, "[DISCOVERY] Couldn't start the discovery listener./n");    return ERR_DISCOVERY_START;  }  initiate_discovery(svc);  if (strategy == NULL) {    svc->peers->is_active_peer = is_active_peer_ask_once;    send_discovery_request(svc);  }  else {    svc->peers->is_active_peer = is_active_peer_periodic_update;    strategy(svc);  }  return 0;}
开发者ID:azalucel,项目名称:whisper-core,代码行数:32,


示例4: tl

	LiveNodeModelPtr RowStoreModel::subModel			( QModelIndex const &topleft_inclusive, QModelIndex const &bottomright_exclusive			, QList<int> const &columns_mapping)	{		QModelIndex tl(topleft_inclusive), br(bottomright_exclusive);		if (columns_mapping.size()) {			tl = tl.sibling(tl.row(), 0);			br = br.sibling(br.row(), 0);		}		if(tl.row() > br.row())			warning(this) << "topleft row greater than bottomright row:" << tl;		else if(tl.column() > br.column())			warning(this) << "topleft column greater than bottomright column:" << tl;		else if(tl.column() < 0)			warning(this) << "topleft.column(" << tl.column() << ") < 0";		else if(br.column() > columns_.visibleColumnCount())			warning(this) << "bottomright.column(" << br.column()						  << ") > column count(" << columns_.visibleColumnCount() << ")";		else		{			if(ContentModule *ct = contentModule().data())				return ct->subModel(tl, br, columns_mapping);			// TODO: frak this, figure out const correctness policy			return const_cast<RowStoreModel *>(this)->subModelImpl					( strategy(topleft_inclusive), tl, br, columns_mapping);		}		return LiveNodeModelPtr();	}
开发者ID:dudochkin-victor,项目名称:libqttracker,代码行数:28,


示例5: test_with_ax

void test_with_ax(std::string const& wkt,        std::string const& expected,        T const& adt,        T const& xdt){    typedef typename bg::point_type<Geometry>::type point_type;    typedef bg::strategy::distance::detail::projected_point_ax<> ax_type;    typedef typename bg::strategy::distance::services::return_type    <        bg::strategy::distance::detail::projected_point_ax<>,        point_type,        point_type    >::type return_type;    typedef bg::strategy::distance::detail::projected_point_ax_less    <        return_type    > comparator_type;    typedef bg::strategy::simplify::detail::douglas_peucker    <        point_type,        bg::strategy::distance::detail::projected_point_ax<>,        comparator_type    > dp_ax;    return_type max_distance(adt, xdt);    comparator_type comparator(max_distance);    dp_ax strategy(comparator);    test_geometry<Geometry>(wkt, expected, max_distance, strategy);}
开发者ID:Ding8222,项目名称:abelkhan,代码行数:32,


示例6: qInfo

QJsonDocument Api::get(const QString& path, CancellationToken cancellationToken) const{    qInfo() << "Executing GET " << path;    ApiConnectionSettings connectionSettings = defaultConnectionSettings();    ApiConnectionStrategy strategy(connectionSettings, Config::minConnectionTimeoutMsec, Config::maxConnectionTimeoutMsec);    QBuffer buffer;    buffer.open(QIODevice::WriteOnly);    if (!strategy.execute(m_dataSource, path, buffer, cancellationToken))    {        throw ApiConnectionError("Failed to connect to the api.");    }    auto data = buffer.data();    QJsonParseError parseError;    auto doc = QJsonDocument::fromJson(data, &parseError);    if (parseError.error != QJsonParseError::NoError)    {        throw InvalidFormatException(parseError.errorString());    }    return doc;}
开发者ID:patchkit-net,项目名称:patchkit-launcher-qt,代码行数:27,


示例7: initProjection

EnumerationConstraint* ModelEnumerator::doInit(SharedContext& ctx, SharedMinimizeData* opt, int numModels) {	initProjection(ctx);	uint32 st = strategy();	if (detectStrategy() || (ctx.concurrency() > 1 && !ModelEnumerator::supportsParallel())) {		st = 0;	}	bool optOne  = opt && opt->mode() == MinimizeMode_t::optimize;	bool trivial = optOne || std::abs(numModels) == 1;	if (optOne && projectionEnabled()) {		for (const WeightLiteral* it =  minimizer()->lits; !isSentinel(it->first) && trivial; ++it) {			trivial = ctx.varInfo(it->first.var()).project();		}		if (!trivial) { ctx.report(warning(Event::subsystem_prepare, "Projection: Optimization may depend on enumeration order.")); }	}	if (st == strategy_auto) { st  = trivial || (projectionEnabled() && ctx.concurrency() > 1) ? strategy_record : strategy_backtrack; }	if (trivial)             { st |= trivial_flag; }	options_ &= ~uint32(strategy_opts_mask);	options_ |= st;	const LitVec* dom = (projectOpts() & project_dom_lits) != 0 ? (ctx.heuristic.domRec = &domRec_) : 0;	EnumerationConstraint* c = st == strategy_backtrack	  ? static_cast<ConPtr>(new BacktrackFinder(projectOpts()))	  : static_cast<ConPtr>(new RecordFinder(dom));	if (projectionEnabled()) { setIgnoreSymmetric(true); }	return c;}
开发者ID:lc2casp,项目名称:lc2casp,代码行数:25,


示例8: main

int main(int argc, char* argv[]){	try	{			const std::string cfgFileName = "../config/tt.cfg";		const std::string symbol = "xx";		const std::string maturityMonthYear = "xx";		const std::string account = "uchidts10";		// create our strategy and connect it to our Application FIX interface		MyStrategy strategy(symbol, maturityMonthYear, account);		Application Application(strategy);		Application.Init(cfgFileName);				// quickfix is now running in the background, so we just wait here until the user hits ENTER to shut us down		std::cout << std::endl << "Hit [ENTER] to quit..." << std::endl;		std::string input;		std::getline(std::cin, input);	}	catch(const std::exception & e)	{		std::cerr << std::endl << e.what() << std::endl;		return 1;	}	return 0;}
开发者ID:mbeven,项目名称:FINM_2016_SPRING,代码行数:27,


示例9: apply

    static inline bool apply(S const& seg, P const& selection_point, T const& search_radius)    {        assert_dimension_equal<S, P>();        if (! outside_loop                <                    S, P, T, 0, dimension<P>::type::value                >::apply(seg, selection_point, search_radius))        {            // Not outside, calculate dot product/square distance to segment.            // Call corresponding strategy            typedef typename strategy_distance_segment                <                    typename cs_tag<P>::type,                    typename cs_tag<S>::type,                    P,                    S                >::type strategy_type;            typedef typename strategy_type::return_type return_type;            strategy_type strategy;            return_type result = strategy(selection_point, seg);            return result < search_radius;        }        return false;    }
开发者ID:4x4falcon,项目名称:fosm-merkaartor,代码行数:27,


示例10: load_disklabel

intload_disklabel(struct of_dev *ofdev, struct disklabel *label){	char buf[DEV_BSIZE];	size_t read;	int error = 0;	char *errmsg = NULL;	/* First try to find a disklabel without MBR partitions */	DNPRINTF(BOOT_D_OFDEV, "load_disklabel: trying to read disklabel/n");	if (strategy(ofdev, F_READ,		     LABELSECTOR, DEV_BSIZE, buf, &read) != 0	    || read != DEV_BSIZE	    || (errmsg = getdisklabel(buf, label))) {#ifdef BOOT_DEBUG		if (errmsg)			DNPRINTF(BOOT_D_OFDEV,			    "load_disklabel: getdisklabel says %s/n", errmsg);#endif		/* Else try MBR partitions */		errmsg = search_label(ofdev, LABELSECTOR, buf,		    label, 0);		if (errmsg) { 			printf("load_disklabel: search_label says %s/n",			    errmsg);			error = ERDLAB;		}	}	return (error);}
开发者ID:DavidAlphaFox,项目名称:openbsd-kernel,代码行数:31,


示例11: initProjection

EnumerationConstraint* ModelEnumerator::doInit(SharedContext& ctx, MinimizeConstraint* min, int numModels) {	delete queue_;	queue_ = 0;	initProjection(ctx); 	uint32 st = strategy();	if (detectStrategy() || (ctx.concurrency() > 1 && !ModelEnumerator::supportsParallel())) {		st = 0;	}	bool optOne  = minimizer() && minimizer()->mode() == MinimizeMode_t::optimize;	bool trivial = optOne || std::abs(numModels) == 1;	if (optOne && project_) {		const SharedMinimizeData* min = minimizer();		for (const WeightLiteral* it = min->lits; !isSentinel(it->first) && trivial; ++it) {			trivial = ctx.varInfo(it->first.var()).project();		}		if (!trivial) { ctx.report(warning(Event::subsystem_prepare, "Projection: Optimization may depend on enumeration order.")); }	}	if (st == strategy_auto) { st  = trivial || (project_ && ctx.concurrency() > 1) ? strategy_record : strategy_backtrack; }	if (trivial)             { st |= trivial_flag; }	if (ctx.concurrency() > 1 && !trivial && st != strategy_backtrack) {		queue_ = new SolutionQueue(ctx.concurrency()); 		queue_->reserve(ctx.concurrency() + 1);	}	options_ &= ~uint32(strategy_opts_mask);	options_ |= st;	Solver& s = *ctx.master();	EnumerationConstraint* c = st == strategy_backtrack 	  ? static_cast<ConPtr>(new BacktrackFinder(s, min, project_, projectOpts()))	  : static_cast<ConPtr>(new RecordFinder(s, min, project_, queue_));	if (projectionEnabled()) { setIgnoreSymmetric(true); }	return c;}
开发者ID:utexas-bwi,项目名称:clasp,代码行数:32,


示例12: elect_write_ds

 int32_t elect_write_ds(const LayoutManager& meta, const int32_t elect_count, VUINT64& elect_ds_list) {   WriteStrategy strategy(meta.get_elect_seq(), *meta.get_ns_global_info());   int64_t elect_seq = meta.get_elect_seq();   int32_t ret = elect_ds(strategy, ExcludeGroupElectOperation(), meta, elect_count, elect_seq, elect_ds_list);   meta.set_elect_seq(elect_seq);   return ret; }
开发者ID:qqiangwu,项目名称:annotated-tfs,代码行数:8,


示例13: checkOneSelector

static inline bool checkOneSelector(const CSSSelector& selector, const WillBeHeapVector<RawPtrWillBeMember<Node>, 32>& siblings, int nth){    Element* element = toElement(siblings[nth]);    SelectorChecker selectorChecker(element->document(), SelectorChecker::CollectingCSSRules);    SelectorChecker::SelectorCheckingContext context(selector, element, SelectorChecker::VisitedMatchEnabled);    ShadowDOMSiblingTraversalStrategy strategy(siblings, nth);    return selectorChecker.match(context, strategy) == SelectorChecker::SelectorMatches;}
开发者ID:335969568,项目名称:Blink-1,代码行数:8,


示例14: android_view_VelocityTracker_nativeInitialize

static jlong android_view_VelocityTracker_nativeInitialize(JNIEnv* env, jclass clazz,        jstring strategyStr) {    if (strategyStr) {        ScopedUtfChars strategy(env, strategyStr);        return reinterpret_cast<jlong>(new VelocityTrackerState(strategy.c_str()));    }    return reinterpret_cast<jlong>(new VelocityTrackerState(NULL));}
开发者ID:365flysky,项目名称:platform_frameworks_base,代码行数:8,


示例15: main

int main (int argc, char const* argv[]){    std::function<void(const char*)> log = [](const char* msg){ std::cout << msg << std::endl; };        if( argc < 3 ) {        log("Too few arguments!!!");        exit(1);    }    const int MATCH_TOTAL_NUMBER = atoi(argv[1]);        // choose enemy strategy    std::function<Action(int)> strategy = STRATEGIES[atoi(argv[2])];        try {        // define qlplayer        QLAgent<Action,Action> player = QLAgent<Action,Action>( [](Action act){ std::vector<Action> vact = {ROCK,PAPER,SCISSOR}; return vact; } );        player.setQLParameters(0.1,0.2,1.);        player.setCurrentState(ROCK);            for(int counter = 0; counter != MATCH_TOTAL_NUMBER; counter++) {            // choose actions            Action playerChoice = player.chooseAction();            Action enemyChoice  = strategy(counter);            // evaluate the match            float reward;            int matchResult = ((int)(playerChoice) - (int)(enemyChoice)) %3;            switch(matchResult) {                case 1:                    reward = LOSE_REWARD;                    std::cout << "L";                break;                case 0:                    reward = DRAW_REWARD;                    std::cout << "D";                break;                case -1:                    reward = WIN_REWARD;                    std::cout << "W";                break;                default:                    reward = 0;                break;            }                    player.update(enemyChoice,reward);        }    }    catch (std::exception e) {        log(e.what());    }                log("");    log("Game has ended!");    return 0;}
开发者ID:cherosene,项目名称:learning_algorithms,代码行数:57,


示例16: elect_replicate_dest_ds

 int32_t elect_replicate_dest_ds(const LayoutManager& meta,     const ReplicateSourceStrategy::counter_type& dest_counter, const int32_t elect_count, VUINT64& elect_ds_list) {   ReplicateDestStrategy strategy(meta.get_elect_seq(), *meta.get_ns_global_info(), dest_counter);   int64_t elect_seq = meta.get_elect_seq();   int32_t ret = elect_ds(strategy, ExcludeGroupElectOperation(), meta, elect_count, elect_seq, elect_ds_list);   meta.set_elect_seq(elect_seq);   return ret; }
开发者ID:qqiangwu,项目名称:annotated-tfs,代码行数:9,


示例17: Rebalancer

Alg7::Alg7(computeInfo *computeArray, patchInfo *patchArray, 	   processorInfo *processorArray, int nComps, 	   int nPatches, int nPes) :  Rebalancer(computeArray, patchArray, 	     processorArray, nComps, 	     nPatches, nPes){strategyName = "Alg7";strategy();}
开发者ID:aar2163,项目名称:NAMD-energy,代码行数:10,


示例18: multiplex_strategy

void multiplex_strategy(struct bio *bio){	struct device *dev = bio->bio_dev;	devop_strategy_t strategy = *((devop_strategy_t *)dev->private_data);	uint64_t len = bio->bio_bcount;	bio->bio_offset += bio->bio_dev->offset;	uint64_t offset = bio->bio_offset;	void *buf = bio->bio_data;	assert(strategy != NULL);	if (len <= dev->max_io_size) {		strategy(bio);		return;	}	// It is better to initialize the refcounter beforehand, specially because we can	// trivially determine what is the number going to be. Otherwise, we can have a	// situation in which we bump the refcount to 1, get scheduled out, the bio is	// finished, and when it drops its refcount to 0, we consider the main bio finished.	refcount_init(&bio->bio_refcnt, (len / dev->max_io_size) + !!(len % dev->max_io_size));	while (len > 0) {		uint64_t req_size = MIN(len, dev->max_io_size);		struct bio *b = alloc_bio();		b->bio_bcount = req_size;		b->bio_data = buf;		b->bio_offset = offset;		b->bio_cmd = bio->bio_cmd;		b->bio_dev = bio->bio_dev;		b->bio_caller1 = bio;		b->bio_done = multiplex_bio_done;		strategy(b);		buf += req_size;		offset += req_size;		len -= req_size;	}}
开发者ID:Pieter-was,项目名称:osv,代码行数:43,


示例19: test

    static void test(double lon1, double lat1, double lon2, double lat2,                       double radius, double expected, double tolerance)    {        haversine_type strategy(radius);        Point p1, p2;        boost::geometry::assign(p1, lon1, lat1);        boost::geometry::assign(p2, lon2, lat2);        typename haversine_type::return_type d1 = strategy.apply(p1, p2);        BOOST_CHECK_CLOSE((double) d1, expected, tolerance);    }
开发者ID:nurF,项目名称:Brute-Force-Game-Engine,代码行数:12,


示例20: RefineTorusLB

TorusLB::TorusLB(computeInfo *cs, patchInfo *pas, processorInfo *pes, int ncs, int npas, int npes) : RefineTorusLB(cs, pas, pes, ncs, npas, npes, 0){  strategyName = "TorusLB";  strategy();  //if ( computeMax() <= origMaxLoad ) {  //  binaryRefine();  //  printLoads();  //}  // CREATE THE SPANNING TREE IN THE LOAD BALANCER  //if(proxySendSpanning || proxyRecvSpanning)  //  createSpanningTree();}
开发者ID:sun51,项目名称:ece598HK,代码行数:13,


示例21: strategy

void TestExcelMetadataOccurenceDiscoverStrategy::TestDiscoverTrackChangesForDocWithTrackChanges(){   MockVisitor visitor;   ExcelMetadataOccurencePolicy policy;   policy.EnableTrackChanges();      ExcelMetadataOccurenceDiscoveryStrategy strategy(visitor, policy, TEST_FILE_PATH _T("DiscoverMetaData.xls"));     strategy.Execute();      assertMessage(visitor.IsEventRaised(_T("MockVisitor::OnTrackChangesBegin")), _T("The event [MockVisitor::OnTrackChangesBegin] was not raised."));   assertMessage(visitor.IsEventRaised(_T("MockVisitor::OnTrackChangesEnd")), _T("The event [MockVisitor::OnTrackChangesEnd] was not raised."));   assertMessage(visitor.IsEventRaised(_T("MockVisitor::OnTrackChange")), _T("We expected Track Changes to be found"));}
开发者ID:killbug2004,项目名称:WSProf,代码行数:13,


示例22: rowCount

	int RowStoreModel::rowCount(const QModelIndex &index) const	{		if(index.isValid())			return 0;		// if running, but not streaming nor windowed, do blocking refresh.		if(((strategy(index) ^ RDFStrategy::Running)			& (RDFStrategy::Running | RDFStrategy::Streaming | RDFStrategy::Windowed)) == 0)			const_cast<RowStoreModel *>(this)->refreshModel				(LiveNodeModel::Block | LiveNodeModel::CoverDerivedProperties);		return row_store.size();	}
开发者ID:dudochkin-victor,项目名称:libqttracker,代码行数:13,


示例23: main_prog

// main programint main_prog(){  	// Initialize game	initializeGame();		// Initialize interrupts	initializeInterrupts();	    // Send initial co-ordinates for all players    sendInitialPositionsPackets();	u8 i;    for(i = 0; ; i++) {				// Read data    	numberOfPackets = 0;    	readQueueData();				//See if any player is inside foul box		playerInDefendingFoulBox = numberOfPlayersInFoulBox(teamA, DEFENDING_FOUL);		playerInAttackingFoulBox = numberOfPlayersInFoulBox(teamA, ATTACKING_FOUL);				// Develop strategy for player movement by considering position of ball/players		strategy();				// offensive/defensive strategy switch		u8 switches = XGpio_DiscreteRead(&GpioInputSwitch, 1);		// if 4th bit of switch == 1, offensive		if((switches >> 3) == 1) {			//xil_printf("Inside offensive/n");			// move all players to offensive side			u8 j;			for(j = 0; j < 5; j++) {				if(fieldSide == FIELD_LEFT && teamA.player[j].position.x > 310) {					position pos = {170, 200};					movePlayer(&teamA.player[j], &pos);				}				else if(fieldSide == FIELD_RIGHT && teamA.player[j].position.x < 310) {					position pos = {470, 200};					movePlayer(&teamA.player[j], &pos);				}			}		}		else {			// offensive			// do nothing		}		// Send player movement updates		sendUpdatePackets();	}
开发者ID:MeisterFiq,项目名称:Football-System,代码行数:51,



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


C++ strbuf函数代码示例
C++ strappend函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。