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


C++ Bag::begin方法代码示例

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


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

示例1: delta_ext

void SaccadeMotorProgram::delta_ext(double e, const Bag<IO_Type>& xb)
{
	_time += e;
	if (!_saccades.empty())
	{
		//Rcout << _time << " There are " << _saccades.size() << " saccades in the motor queue." << endl;
		list<Saccade*>::const_iterator si = _saccades.begin();
		for(; si != _saccades.end(); si++)
		{
			(*si)->nonlabile_t -= e;
		}
	}
	Bag<IO_Type>::const_iterator iter = xb.begin();
	for (; iter != xb.end(); iter++)
	{
		Saccade* s = new Saccade(*((*xb.begin()).value));
		s->labile_stop = _time;
		s->nonlabile_start = _time;
		s->nonlabile_t = ::Rf_rgamma(((_mean*_mean)/(_stdev*_stdev)),(_stdev*_stdev)/_mean);
		_saccades.push_back(s);
	}
	_saccades.sort(sortNonLabile);
	//printf("%f\t    SaccadeMotorProgram: Starting non-labile programming for saccade[id=%d]\n", _time, _saccade->id);
	//printf("%f\t    SaccadeMotorProgram: Next event at %f\n", _time, _time+_threshold);
}
开发者ID:RyanHope,项目名称:EMdevs,代码行数:25,代码来源:SaccadeMotorProgram.cpp

示例2: min

typename Bag::value_type min(const Bag & b)
{
    typename Bag::const_iterator it;
    typename Bag::value_type m = *b.begin();
    for (it = b.begin(); it != b.end(); ++it)
        if (*it < m)
            m = *it;
    return m;
}
开发者ID:Admiri92,项目名称:CPP_Primer_Plus,代码行数:9,代码来源:appg02.cpp

示例3: delta_ext

void LoadControl::delta_ext(double e, const Bag<PortValue<BasicEvent*> >& xb)
{
	Bag<PortValue<BasicEvent*> >::const_iterator iter = xb.begin();
	for (; iter != xb.end(); iter++)
	{
		GenrSampleEvent* measurement = dynamic_cast<GenrSampleEvent*>((*iter).value);
		if (measurement->freqBreakerOpen()) fdata.erase(measurement->getBusID());
		else fdata[measurement->getBusID()] = measurement->getRotorSpeed();
	}
	// Compute adjustment fraction
	double modified_adjustment = 0.0;
	// Get average frequency
	map<unsigned,double>::iterator fiter = fdata.begin();
	for (; fiter != fdata.end(); fiter++)
	{
		modified_adjustment += (*fiter).second;
	}
	modified_adjustment /= fdata.size();
	// Normalize to a percentage and apply the gain
	modified_adjustment *= (K/FreqTol);
	// Signal?
	if (!(fabs(modified_adjustment) <= max_adjust))
	{
		if (modified_adjustment > 0.0) modified_adjustment = max_adjust;
		else modified_adjustment = -max_adjust;
	}
	signal = adjustment != modified_adjustment;
	adjustment = modified_adjustment;
	assert(fabs(adjustment) <= max_adjust);
}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:30,代码来源:LoadControl.cpp

示例4: gc_output

void Generator::gc_output(Bag<IO_Type>& g)
{
	// Delete the customer that was produced as output
	Bag<IO_Type>::iterator i;
	for (i = g.begin(); i != g.end(); i++)
	{
		delete (*i).value;
	}
}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:9,代码来源:Generator.cpp

示例5: delta_ext

void Payer::delta_ext(double e, const Bag<IO>& xb)
{
	// Record the times at which the bene left the provider.
	Bag<IO>::const_iterator i;
	for (i = xb.begin(); i != xb.end(); i++)
	{
		//const Signal* c = (*i).value;
		total_number_of_patients += 1;
	}
}
开发者ID:cengover,项目名称:ACO,代码行数:10,代码来源:Payer.cpp

示例6: external_event

		/**
		 * Change Vref on receiving input.
		 */
		void external_event(double* q, double e, const Bag<double>& xb)
		{
			// Apply the external event function of the base class
			Circuit::external_event(q,e,xb);
			// Set the reference voltage and indicate that we are no longer
			// at the reference.
			set_V_Vref(*(xb.begin()));
			atVref = false;
			// Reinitialize the continuous model. This is really only necessary
			// if your discrete event may result in new values for the 
			// state variables (discrete or continuous) of the modelica model.
			update_vars(q,true);
		}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:16,代码来源:main_circuit.cpp

示例7: delta_ext

void QueueBus::delta_ext(double e, const Bag<PortValue<BasicEvent*> >& xb)
{
	if (!q.empty()) ttg -= e;
	for (Bag<PortValue<BasicEvent*> >::const_iterator iter = xb.begin();
			iter != xb.end(); iter++)
	{
		if (q.empty()) schedule_next_packet();
		packet_t pkt;
		pkt.e = ((*iter).value);
		if (pkt.e != NULL) pkt.e = pkt.e->clone();
		// Goes out on the same port that it arrived from
		pkt.out_port = ((*iter).port);
		q.push_back(pkt);
	}
}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:15,代码来源:QueueBus.cpp

示例8: external_event

		void external_event(double* q, double e, const Bag<double>& xb)
		{
			static const double pi = 3.141592653589793;
			test_count++;
			double test_angle = *(xb.begin());
			double diff = fabs(q[0]-test_angle);
			// Rotate by a full circle?
			if (diff > 1E-4) diff -= 2.0*pi;
			if (!(fabs(diff) < 1E-4))
			{
				cerr << "AGGGH: " << q[0] << "," << test_angle << "," 
					<< diff << endl;
			}
			assert(fabs(diff) < 1E-4);
		}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:15,代码来源:main_test2.cpp

示例9: delta_ext

void PacketProcessing::delta_ext(double e, const Bag<SimEvent>& xb)
{
	// If we are not interrupted and are processing a packet, then
	// reduce the time remaining to finish with that packet
	if (!interrupt && !q.empty()) sigma -= e;
	// Process input events
	for (Bag<SimEvent>::const_iterator iter = xb.begin();
			iter != xb.end(); iter++)
	{
		if ((*iter).getType() == SIM_PACKET)
			q.push_back((*iter).simPacket()); 
		else if ((*iter).getType() == SIM_INTERRUPT)
			interrupt = !interrupt;
	}
	// If we are idle and there are more packets, then start
	// processing the next one
	if (sigma == DBL_MAX && !q.empty()) sigma = processing_time;
}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:18,代码来源:PacketProcessing.cpp

示例10: gc_output

void QueueBus::gc_output(Bag<PortValue<BasicEvent*> >& gb)
{
	for (Bag<PortValue<BasicEvent*> >::const_iterator iter = gb.begin();
			iter != gb.end(); iter++)
		if ((*iter).value != NULL) delete (*iter).value;
}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:6,代码来源:QueueBus.cpp

示例11: external_event

		void external_event(double*,double,const Bag<bool>& xb)
		{
			s = *(xb.begin());
		}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:4,代码来源:circuit.cpp

示例12: gc_output

void SaccadeMotorProgram::gc_output(Bag<IO_Type>& g)
{
	Bag<IO_Type>::iterator i;
	for (i = g.begin(); i != g.end(); i++)
		delete (*i).value;
}
开发者ID:RyanHope,项目名称:EMdevs,代码行数:6,代码来源:SaccadeMotorProgram.cpp

示例13: delta_conf

		void delta_conf(const Bag<IO_Type>& xb)
		{
			QemuComputer<IO_Type>::delta_conf(xb);
			mem->write_mem(0xb0,*(xb.begin()));
		}
开发者ID:gregorylm,项目名称:MSaaS,代码行数:5,代码来源:ucsim_test.cpp

示例14: delta_ext

		void delta_ext(double e, const Bag<IO_Type>& xb)
		{
			QemuComputer<IO_Type>::delta_ext(e,xb);
			mem->write_mem(0xb0,*(xb.begin()));
		}
开发者ID:gregorylm,项目名称:MSaaS,代码行数:5,代码来源:ucsim_test.cpp

示例15: gc_output

void LoadControl::gc_output(Bag<PortValue<BasicEvent*> >& gb)
{
	Bag<PortValue<BasicEvent*> >::iterator iter = gb.begin();
	for (; iter != gb.end(); iter++) delete (*iter).value;
}
开发者ID:Network-Dynamics,项目名称:adevs,代码行数:5,代码来源:LoadControl.cpp


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