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


C++ TreeNode::beginSegment方法代码示例

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


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

示例1: main

int main(int argc, char *argv)
{
	int i, j;
	float data[1000];
	float currData[100];

	for(j = 0; j < 1000; j++) {
		data[j] = 0;
	}

	try {
		/*Open TEST pulse file, shot 1 */
		Tree *t = new Tree(TREE_NAME, SHOT_NUM);

		/* Get node \SEGMENTED */
		TreeNode *node = t->getNode(TAG_NAME1);
		/* Make sure no data is contained */
		//TODO: Segmentation fault
		//node->deleteData();

		Data *start = new Float64(10.);
		Data *end = new Float64(11.);
		Data *rate = new Float64(1E-3);
		Data *dimension = new Range(start, end, rate);

		Array *dataArray = new Float32Array(data, 1000);
		node->beginSegment(start, end, dimension, dataArray);

		for(i = 0; i < 10; i++) {
			for(j = 0; j < 100; j++) {
				currData[j] = i+1;
			}

			printf ("[%02d] putSegment ... \n", i);

			//Fill currData array with acquired data chunk
			Array *subArr = new Float32Array(currData, 100);
			node->putSegment(subArr, -1);

			delete(subArr);
			//sleep (3);
		}

		/* Free stuff */
		//deleteData(start);
		//deleteData(end);
		//deleteData(rate);
		deleteData(dimension);
		delete(t);
	}
	catch(MdsException *exc) {
		cout << "Error appending segments: " << exc->what();
	}
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:54,代码来源:mdsobjex2-ok2.cpp

示例2: storeTimebase

void MdsWrapper::storeTimebase(Tree *tree, const char* field_fmt,
		Data* start, Data* end, Data* dimension,
		unsigned istart, unsigned len,
		double t1, double isi)
{
	double* tb_seg = new double[len];
	double tx = t1;
	char node_name[128];
	snprintf(node_name, 128, field_fmt, TBCHAN);

	for (unsigned ii = 0; ii != len; ++ii){
		tb_seg[ii] = tx;
		tx += isi;
	}
	Array *data = new Float64Array(tb_seg, len);
	TreeNode *node = tree->getNode(node_name);
	node->beginSegment(start, end, dimension, data);
	deleteData(node);
	deleteData(data);
	delete [] tb_seg;
}
开发者ID:petermilne,项目名称:ACQ200API,代码行数:21,代码来源:MdsProcessController.cpp

示例3: storeChannels

void MdsWrapper::storeChannels(Tree *tree, const char* field_fmt,
			Data* start, Data* end, Data* dimension,
			unsigned istart, unsigned len)
{
	int nchan = dataModel.getAcqType().getNumChannels();

	if (getenv("ACQ_DEMUX_CHANNEL_ONE_ONLY")){
		nchan = 1;				/* reduced data for testing */
	}

	for (ActiveChannelsIt it = active_channels.begin();
							it < active_channels.end(); it++){
		int ch = *it;
		char node_name[128];
		snprintf(node_name, 128, field_fmt, ch);
		Array *data = new Int16Array(
				&dataModel.getChannelData(ch)[istart], len);
		TreeNode *node = tree->getNode(node_name);
		node->beginSegment(start, end, dimension, data);
		deleteData(node);
		deleteData(data);
	}
}
开发者ID:petermilne,项目名称:ACQ200API,代码行数:23,代码来源:MdsProcessController.cpp

示例4: main

int main(int argc, char *argv)
{
	int i, j;
	float data[10];
	float currData[2];

#if 0
	int socket;

	/* Connect to MDSplus */
	socket = MdsConnect (SERVER_ADDR);
	if ( socket == -1 ) {
		fprintf(stderr,"Error connecting to Atlas.\n");
		return EXIT_FAILURE;
	}
	printf ("after MdsConnect\n");
#endif

	try {
#if 0
		Connection *conn = new Connection (SERVER_ADDR);
		if (!conn) {
			printf ("Connection failed \n");
		}

		printf ("after Connection\n");
#endif

		/* Open pulse file, shot # */
		Tree *t = new Tree(TREE_NAME, SHOT_NUM);
		printf ("after Tree\n");

		/* Get node */
		TreeNode *node = t->getNode(TAG_NAME);
		printf ("after getNode\n");

		/* Make sure no data is contained */
		// Segmentation fault => 3.0 library & header is ok
		node->deleteData();

		//float stime = -5;
		float stime = -5;

		Data *start = new Float64(10.);
		Data *end = new Float64(11.);
		Data *rate = new Float64(0.1);
		Data *dimension = new Range(start, end, rate);

		memset (data, 0x00, sizeof(data));
		Array *dataArray = new Float32Array(data, 2);

		for (i = 0; i < 5; i++) {
			start = new Float64(stime + i);
			end = new Float64(stime + 0.1 + i);
			rate = new Float64(0.1);
			dimension = new Range(start, end, rate);

			node->beginSegment (start, end, dimension, dataArray);

			for(j = 0; j < 2; j++) {
				currData[j] = i+1;
			}

			printf ("[%02d] putSegment ... \n", i);

			Array *subArr = new Float32Array(currData, 2);

			node->putSegment (subArr, -1);

			Event::setEvent (EVENT_NAME);

			cout << "Data (" << node->getNumSegments() << ") : " << node->getData() << endl;

			/* Free stuff */
			//deleteData(start);
			//deleteData(end);
			//deleteData(rate);
			deleteData(dimension);
			delete(subArr);

			sleep (2);
		}
		delete(t);
	}
	catch(MdsException *exc) {
		cout << "Error appending segments: " << exc->what();
	}
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:88,代码来源:mdsobjex.cpp


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