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


C++ Activity::time_stop方法代码示例

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


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

示例1: activity_test

void activity_test()
{
	BufferConverter c;

	UniqueComponentActivityID ucaid = 10;
	Timestamp time_start = 20, time_end = 30;
	uint32_t nid = 40, pid = 50, time = 60, aid = 70;
	uint16_t cid = 80;
	ProcessID proc = { nid, pid, time };
	ComponentID comp = { proc, cid };
	ActivityID actid = { comp, aid };
	ActivityError error = 404;
	RemoteCallIdentifier *remote_invoker = NULL;

	ProcessID proc2 = { 110, 210, 310 };
	ComponentID comp2 = { proc2, 410 };
	ActivityID actid2 = { comp2, 510 };

	ProcessID proc3 = { 120, 220, 320 };
	ComponentID comp3 = { proc3, 420 };
	ActivityID actid3 = { comp3, 520 };

	vector<ActivityID> parents;
	parents.push_back (actid2);
	parents.push_back (actid3);

	const std::string str1 = "klingon functions don't have parameters, they have arguments, and always win them!";
	const AttributeValue value1 (str1);
	const Attribute attr1 (100, value1);

	const AttributeValue value2 (42);
	const Attribute attr2 (101, value2);

	vector<Attribute> attributes;
	attributes.push_back (attr1);
	attributes.push_back (attr2);

	const RemoteCallIdentifier target1 (5, 10, 15);
	const RemoteCallIdentifier target2 (10, 20, 30);

	const std::string str3 = "all your base are belong to us";
	const AttributeValue value3 (str3);
	const Attribute attr3 (100, value3);

	const AttributeValue value4 (42);
	const Attribute attr4 (103, value4);
	attributes.push_back (attr4);

	vector<Attribute> attributes2;
	vector<Attribute> attributes3;
	attributes2.push_back (attr3);
	attributes2.push_back (attr4);

	RemoteCall rc1 = { target1, attributes2 };
	RemoteCall rc2 = { target1, attributes3 };

	vector<RemoteCall> remote_calls;
	remote_calls.push_back (rc1);
	remote_calls.push_back (rc2);

	Activity act (ucaid, time_start, time_end, actid, parents,
	              attributes, remote_calls, remote_invoker, error);

	buffers::Activity bact;

	c.activity (act, bact);

	if (act.ucaid() != bact.ucaid())
		util::fail("Activity-UCAID");
	if (act.time_start() != bact.time_start())
		util::fail("Activity-TIME-START");
	if (act.time_stop() != bact.time_stop())
		util::fail("Activity-TIME-STOP");
	if (act.errorValue() != bact.error_value())
		util::fail("Activity-ERROR-VALUE");

	if (act.aid().id != bact.aid().id())
		util::fail("Activity-ID");
	if (act.aid().cid.id != bact.aid().cid().id())
		util::fail("Activity-CID");
	if (act.aid().cid.pid.nid != bact.aid().cid().pid().nid())
		util::fail("Activity-NID");
	if (act.aid().cid.pid.pid != bact.aid().cid().pid().pid())
		util::fail("Activity-PID");
	if (act.aid().cid.pid.time != bact.aid().cid().pid().time())
		util::fail("Activity-TIME");

	if (act.parentArray().size() != (unsigned) bact.parents_size())
		util::fail("Different parent count.");

	for (vector<ActivityID>::const_iterator i = act.parentArray().begin();
	        i < act.parentArray().end(); i++) {

		buffers::ActivityID aid1;
		c.aid (*i, aid1);

		bool found = false;

		for (int j = 0; j < bact.parents_size(); j++) {

//.........这里部分代码省略.........
开发者ID:JulianKunkel,项目名称:siox,代码行数:101,代码来源:converter-test.cpp


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