本文整理汇总了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();
}
}
示例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;
}
示例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);
}
}
示例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();
}
}