File: metaDTITube.cxx

package info (click to toggle)
paraview 5.13.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 544,220 kB
  • sloc: cpp: 3,374,605; ansic: 1,332,409; python: 150,381; xml: 122,166; sql: 65,887; sh: 7,317; javascript: 5,262; yacc: 4,417; java: 3,977; perl: 2,363; lex: 1,929; f90: 1,397; makefile: 170; objc: 153; tcl: 59; pascal: 50; fortran: 29
file content (734 lines) | stat: -rw-r--r-- 17,624 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
/*============================================================================
  MetaIO
  Copyright 2000-2010 Insight Software Consortium

  Distributed under the OSI-approved BSD License (the "License");
  see accompanying file Copyright.txt for details.

  This software is distributed WITHOUT ANY WARRANTY; without even the
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the License for more information.
============================================================================*/
#ifdef _MSC_VER
#  pragma warning(disable : 4786)
#  pragma warning(disable : 4702)
#  pragma warning(disable : 4284)
#endif

#include "metaDTITube.h"


#if (METAIO_USE_NAMESPACE)
namespace METAIO_NAMESPACE
{
#endif

DTITubePnt::DTITubePnt(int dim)
{
  m_Dim = static_cast<unsigned int>(dim);
  m_X = new float[m_Dim];
  m_TensorMatrix = new float[6];

  unsigned int i = 0;
  for (i = 0; i < m_Dim; i++)
  {
    m_X[i] = 0;
  }

  // Initialize the tensor matrix to identity
  for (i = 0; i < 6; i++)
  {
    m_TensorMatrix[i] = 0;
  }
  m_TensorMatrix[0] = 1;
  m_TensorMatrix[3] = 1;
  m_TensorMatrix[5] = 1;
}

DTITubePnt::~DTITubePnt()
{
  delete[] m_X;
  delete[] m_TensorMatrix;
  m_ExtraFields.clear();
}

const DTITubePnt::FieldListType &
DTITubePnt::GetExtraFields() const
{
  return m_ExtraFields;
}

void
DTITubePnt::AddField(const char * name, float value)
{
  FieldType field(name, value);
  m_ExtraFields.push_back(field);
}

float
DTITubePnt::GetField(const char * name) const
{
  auto it = m_ExtraFields.begin();
  auto itEnd = m_ExtraFields.end();
  while (it != itEnd)
  {
    if (!strcmp((*it).first.c_str(), name))
    {
      return (*it).second;
    }
    ++it;
  }
  return -1;
}


/** MetaDTITube Constructors */
MetaDTITube::MetaDTITube()
{
  META_DEBUG_PRINT( "MetaDTITube()" );
  MetaDTITube::Clear();
}


MetaDTITube::MetaDTITube(const char * _headerName)
{
  META_DEBUG_PRINT( "MetaDTITube()" );
  MetaDTITube::Clear();
  MetaDTITube::Read(_headerName);
}


MetaDTITube::MetaDTITube(const MetaDTITube * _dtiTube)
{
  META_DEBUG_PRINT( "MetaDTITube()" );
  MetaDTITube::Clear();
  MetaDTITube::CopyInfo(_dtiTube);
}


MetaDTITube::MetaDTITube(unsigned int dim)
  : MetaObject(dim)
{
  META_DEBUG_PRINT( "MetaDTITube()" );
  MetaDTITube::Clear();
}

/** Destructor */
MetaDTITube::~MetaDTITube()
{
  // Delete the list of pointers to DTITubes.
  auto it = m_PointList.begin();
  while (it != m_PointList.end())
  {
    DTITubePnt * pnt = *it;
    ++it;
    delete pnt;
  }
  m_PointList.clear();
  MetaObject::M_Destroy();
}

//
void
MetaDTITube::PrintInfo() const
{
  MetaObject::PrintInfo();
  std::cout << "ParentPoint = " << m_ParentPoint << std::endl;
  if (m_Root)
  {
    std::cout << "Root = "
              << "True" << std::endl;
  }
  else
  {
    std::cout << "Root = "
              << "True" << std::endl;
  }
  std::cout << "PointDim = " << m_PointDim.c_str() << std::endl;
  std::cout << "NPoints = " << m_NPoints << std::endl;
  char str[255];
  MET_TypeToString(m_ElementType, str);
  std::cout << "ElementType = " << str << std::endl;
}

void
MetaDTITube::CopyInfo(const MetaObject * _object)
{
  MetaObject::CopyInfo(_object);
}


void
MetaDTITube::PointDim(const char * pointDim)
{
  m_PointDim = pointDim;
}

const char *
MetaDTITube::PointDim() const
{
  return m_PointDim.c_str();
}

void
MetaDTITube::NPoints(int npnt)
{
  m_NPoints = npnt;
}

int
MetaDTITube::NPoints() const
{
  return m_NPoints;
}

void
MetaDTITube::Root(bool root)
{
  m_Root = root;
}

bool
MetaDTITube::Root() const
{
  return m_Root;
}


void
MetaDTITube::ParentPoint(int parentpoint)
{
  m_ParentPoint = parentpoint;
}

int
MetaDTITube::ParentPoint() const
{
  return m_ParentPoint;
}

/** Clear DTITube information */
void
MetaDTITube::Clear()
{
  META_DEBUG_PRINT( "MetaDTITube: Clear" );

  MetaObject::Clear();

  strcpy(m_ObjectTypeName, "Tube");
  strcpy(m_ObjectSubTypeName, "DTI");

  // Delete the list of pointers to DTITubes.
  auto it = m_PointList.begin();
  while (it != m_PointList.end())
  {
    DTITubePnt * pnt = *it;
    ++it;
    delete pnt;
  }
  m_PointList.clear();

  m_ParentPoint = -1;
  m_Root = false;
  m_NPoints = 0;
  m_PointDim = "x y z tensor1 tensor2 tensor3 tensor4 tensor5 tensor6";
  m_ElementType = MET_FLOAT;
}

/** Set Read fields */
void
MetaDTITube::M_SetupReadFields()
{
  META_DEBUG_PRINT( "MetaDTITube: M_SetupReadFields" );

  MetaObject::M_SetupReadFields();

  MET_FieldRecordType * mF;

  // int nDimsRecNum = MET_GetFieldRecordNumber("NDims", &m_Fields);

  mF = new MET_FieldRecordType;
  MET_InitReadField(mF, "ParentPoint", MET_INT, false);
  m_Fields.push_back(mF);

  mF = new MET_FieldRecordType;
  MET_InitReadField(mF, "Root", MET_STRING, false);
  m_Fields.push_back(mF);

  mF = new MET_FieldRecordType;
  MET_InitReadField(mF, "PointDim", MET_STRING, true);
  m_Fields.push_back(mF);

  mF = new MET_FieldRecordType;
  MET_InitReadField(mF, "NPoints", MET_INT, true);
  m_Fields.push_back(mF);

  mF = new MET_FieldRecordType;
  MET_InitReadField(mF, "Points", MET_NONE, true);
  mF->terminateRead = true;
  m_Fields.push_back(mF);
}

void
MetaDTITube::M_SetupWriteFields()
{
  MetaObject::M_SetupWriteFields();

  MET_FieldRecordType * mF;

  if (m_ParentPoint >= 0 && m_ParentID >= 0)
  {
    mF = new MET_FieldRecordType;
    MET_InitWriteField(mF, "ParentPoint", MET_INT, m_ParentPoint);
    m_Fields.push_back(mF);
  }

  if (m_Root)
  {
    mF = new MET_FieldRecordType;
    MET_InitWriteField(mF, "Root", MET_STRING, strlen("True"), "True");
    m_Fields.push_back(mF);
  }
  else
  {
    mF = new MET_FieldRecordType;
    MET_InitWriteField(mF, "Root", MET_STRING, strlen("False"), "False");
    m_Fields.push_back(mF);
  }

  // Create the new PointDim field
  m_PointDim = "x y z tensor1 tensor2 tensor3 tensor4 tensor5 tensor6";

  // All the points in the tube have the same number of fields
  const DTITubePnt::FieldListType & extraList = (*(m_PointList.begin()))->GetExtraFields();
  auto                              itFields = extraList.begin();
  auto                              itFieldsEnd = extraList.end();
  while (itFields != itFieldsEnd)
  {
    m_PointDim += " ";
    m_PointDim += (*itFields).first;
    ++itFields;
  }

  if (!m_PointDim.empty())
  {
    mF = new MET_FieldRecordType;
    MET_InitWriteField(mF, "PointDim", MET_STRING, m_PointDim.size(), m_PointDim.c_str());
    m_Fields.push_back(mF);
  }

  m_NPoints = static_cast<int>(m_PointList.size());
  mF = new MET_FieldRecordType;
  MET_InitWriteField(mF, "NPoints", MET_INT, m_NPoints);
  m_Fields.push_back(mF);

  mF = new MET_FieldRecordType;
  MET_InitWriteField(mF, "Points", MET_NONE);
  m_Fields.push_back(mF);
}

/** Return the position given the name of the field */
int
MetaDTITube::GetPosition(const char * name) const
{
  auto it = m_Positions.begin();
  auto itEnd = m_Positions.end();
  while (it != itEnd)
  {
    if (!strcmp((*it).first.c_str(), name))
    {
      return (*it).second;
    }
    ++it;
  }

  return -1;
}

bool
MetaDTITube::M_Read()
{
  META_DEBUG_PRINT( "MetaDTITube: M_Read: Loading Header" );

  if (!MetaObject::M_Read())
  {
    std::cout << "MetaDTITube: M_Read: Error parsing file" << std::endl;
    return false;
  }

  META_DEBUG_PRINT( "MetaDTITube: M_Read: Parsing Header" );

  MET_FieldRecordType * mF;

  mF = MET_GetFieldRecord("ParentPoint", &m_Fields);
  if (mF->defined)
  {
    m_ParentPoint = static_cast<int>(mF->value[0]);
  }

  m_Root = false;
  mF = MET_GetFieldRecord("Root", &m_Fields);
  if (mF->defined)
  {
    if (*(reinterpret_cast<char *>(mF->value)) == 'T' || *(reinterpret_cast<char *>(mF->value)) == 't' || *(reinterpret_cast<char *>(mF->value)) == '1')
    {
      m_Root = true;
    }
    else
    {
      m_Root = false;
    }
  }

  mF = MET_GetFieldRecord("NPoints", &m_Fields);
  if (mF->defined)
  {
    m_NPoints = static_cast<int>(mF->value[0]);
  }

  mF = MET_GetFieldRecord("PointDim", &m_Fields);
  if (mF->defined)
  {
    m_PointDim = reinterpret_cast<char *>(mF->value);
  }

  int i;

  int     pntDim;
  char ** pntVal = nullptr;
  char    pointDim[255];

  for (unsigned t = 0; t < m_PointDim.size(); t++)
  {
    pointDim[t] = m_PointDim[t];
  }
  pointDim[m_PointDim.size()] = '\0';

  MET_StringToWordArray(pointDim, &pntDim, &pntVal);

  META_DEBUG_PRINT( "MetaDTITube: Parsing point dim" );

  int j;
  m_Positions.clear();
  for (j = 0; j < pntDim; j++)
  {
    PositionType p(pntVal[j], static_cast<const unsigned int &>(j));
    m_Positions.push_back(p);
  }

  for (i = 0; i < pntDim; i++)
  {
    delete[] pntVal[i];
  }
  delete[] pntVal;

  float v[50];

  if (m_Event)
  {
    m_Event->StartReading(static_cast<unsigned int>(m_NPoints));
  }

  if (m_BinaryData)
  {
    int elementSize;
    MET_SizeOfType(m_ElementType, &elementSize);
    int readSize = m_NPoints * pntDim * elementSize;

    char * _data = new char[readSize];
    m_ReadStream->read(_data, readSize);

    int gc = static_cast<int>(m_ReadStream->gcount());
    if (gc != readSize)
    {
      std::cout << "MetaLine: m_Read: data not read completely" << std::endl;
      std::cout << "   ideal = " << readSize << " : actual = " << gc << std::endl;
      delete[] _data;
      return false;
    }

    i = 0;
    int          d;
    unsigned int k;
    for (j = 0; j < m_NPoints; j++)
    {
      auto * pnt = new DTITubePnt(m_NDims);

      for (d = 0; d < m_NDims; d++)
      {
        float        td;
        char * const num = reinterpret_cast<char *>(&td);
        for (k = 0; k < sizeof(float); k++)
        {
          num[k] = _data[i + k];
        }
        MET_SwapByteIfSystemMSB(&td, MET_FLOAT);
        i += sizeof(float);
        pnt->m_X[d] = td;
      }

      for (d = 0; d < 6; d++)
      {
        float        td;
        char * const num = reinterpret_cast<char *>(&td);
        for (k = 0; k < sizeof(float); k++)
        {
          num[k] = _data[i + k];
        }
        MET_SwapByteIfSystemMSB(&td, MET_FLOAT);
        i += sizeof(float);
        pnt->m_TensorMatrix[d] = td;
      }

      std::vector<PositionType>::const_iterator itFields = m_Positions.begin();
      std::vector<PositionType>::const_iterator itFieldsEnd = m_Positions.end();
      while (itFields != itFieldsEnd)
      {
        if (strcmp((*itFields).first.c_str(), "x") != 0 && strcmp((*itFields).first.c_str(), "y") != 0 &&
            strcmp((*itFields).first.c_str(), "z") != 0 && strcmp((*itFields).first.c_str(), "tensor1") != 0 &&
            strcmp((*itFields).first.c_str(), "tensor2") != 0 && strcmp((*itFields).first.c_str(), "tensor3") != 0 &&
            strcmp((*itFields).first.c_str(), "tensor4") != 0 && strcmp((*itFields).first.c_str(), "tensor5") != 0 &&
            strcmp((*itFields).first.c_str(), "tensor6") != 0)
        {
          float        td;
          char * const num = reinterpret_cast<char *>(&td);
          for (k = 0; k < sizeof(float); k++)
          {
            num[k] = _data[i + k];
          }
          MET_SwapByteIfSystemMSB(&td, MET_FLOAT);
          i += sizeof(float);
          pnt->AddField((*itFields).first.c_str(), td);
        }
        ++itFields;
      }

      m_PointList.push_back(pnt);
    }
    delete[] _data;
  }
  else
  {
    for (j = 0; j < m_NPoints; j++)
    {
      if (m_Event)
      {
        m_Event->SetCurrentIteration(static_cast<unsigned int>(j + 1));
      }

      for (int k = 0; k < pntDim; k++)
      {
        *m_ReadStream >> v[k];
        m_ReadStream->get();
      }


      const int positionOfX = this->GetPosition("x");
      const int positionOfY = this->GetPosition("y");

      if (positionOfX < 0)
      {
        std::cerr << "MetaDTITube: M_Read: 'x' not found." << std::endl;
        return false;
      }

      if (positionOfY < 0)
      {
        std::cerr << "MetaDTITube: M_Read: 'y' not found." << std::endl;
        return false;
      }

      auto * pnt = new DTITubePnt(m_NDims);
      pnt->m_X[0] = v[positionOfX];
      pnt->m_X[1] = v[positionOfY];

      if (m_NDims == 3)
      {
        const int positionOfZ = this->GetPosition("z");

        if (positionOfZ < 0)
        {
          std::cerr << "MetaDTITube: M_Read: 'z' not found." << std::endl;
          delete pnt;
          return false;
        }

        pnt->m_X[2] = v[positionOfZ];
      }

      // Read tensor1
      if (this->GetPosition("tensor1") >= 0 && this->GetPosition("tensor1") < pntDim)
      {
        pnt->m_TensorMatrix[0] = v[this->GetPosition("tensor1")];
      }
      // Read tensor2
      if (this->GetPosition("tensor2") >= 0 && this->GetPosition("tensor2") < pntDim)
      {
        pnt->m_TensorMatrix[1] = v[this->GetPosition("tensor2")];
      }
      // Read tensor3
      if (this->GetPosition("tensor3") >= 0 && this->GetPosition("tensor3") < pntDim)
      {
        pnt->m_TensorMatrix[2] = v[this->GetPosition("tensor3")];
      }
      // Read tensor4
      if (this->GetPosition("tensor4") >= 0 && this->GetPosition("tensor4") < pntDim)
      {
        pnt->m_TensorMatrix[3] = v[this->GetPosition("tensor4")];
      }
      // Read tensor5
      if (this->GetPosition("tensor5") >= 0 && this->GetPosition("tensor5") < pntDim)
      {
        pnt->m_TensorMatrix[4] = v[this->GetPosition("tensor5")];
      }
      // Read tensor6
      if (this->GetPosition("tensor6") >= 0 && this->GetPosition("tensor6") < pntDim)
      {
        pnt->m_TensorMatrix[5] = v[this->GetPosition("tensor6")];
      }

      // Add the extrafields
      std::vector<PositionType>::const_iterator itFields = m_Positions.begin();
      std::vector<PositionType>::const_iterator itFieldsEnd = m_Positions.end();
      while (itFields != itFieldsEnd)
      {
        if (strcmp((*itFields).first.c_str(), "x") != 0 && strcmp((*itFields).first.c_str(), "y") != 0 &&
            strcmp((*itFields).first.c_str(), "z") != 0 && strcmp((*itFields).first.c_str(), "tensor1") != 0 &&
            strcmp((*itFields).first.c_str(), "tensor2") != 0 && strcmp((*itFields).first.c_str(), "tensor3") != 0 &&
            strcmp((*itFields).first.c_str(), "tensor4") != 0 && strcmp((*itFields).first.c_str(), "tensor5") != 0 &&
            strcmp((*itFields).first.c_str(), "tensor6") != 0)
        {
          pnt->AddField((*itFields).first.c_str(), v[this->GetPosition((*itFields).first.c_str())]);
        }
        ++itFields;
      }

      m_PointList.push_back(pnt);
    }

    char c = ' ';
    while ((c != '\n') && (!m_ReadStream->eof()))
    {
      c = static_cast<char>(m_ReadStream->get()); // to avoid unrecognize charactere
    }
  }

  if (m_Event)
  {
    m_Event->StopReading();
  }

  return true;
}

MET_ValueEnumType
MetaDTITube::ElementType() const
{
  return m_ElementType;
}

void
MetaDTITube::ElementType(MET_ValueEnumType _elementType)
{
  m_ElementType = _elementType;
}

bool
MetaDTITube::M_Write()
{

  if (!MetaObject::M_Write())
  {
    std::cout << "MetaDTITube: M_Read: Error parsing file" << std::endl;
    return false;
  }

  /** Then copy all DTITubes points */
  if (m_BinaryData)
  {
    PointListType::const_iterator it = m_PointList.begin();
    PointListType::const_iterator itEnd = m_PointList.end();
    int                           elementSize;
    MET_SizeOfType(m_ElementType, &elementSize);

    auto                      pntDim = static_cast<unsigned int>(m_NDims + 6);
    const DTITubePnt::FieldListType & extraList = (*(m_PointList.begin()))->GetExtraFields();
    pntDim += static_cast<unsigned int>(extraList.size());

    const size_t dataSize = pntDim * m_NPoints * elementSize;
    char * data = new char[dataSize];
    int    i = 0;
    int    d;
    while (it != itEnd)
    {
      for (d = 0; d < m_NDims; d++)
      {
        float x = (*it)->m_X[d];
        MET_SwapByteIfSystemMSB(&x, MET_FLOAT);
        MET_DoubleToValueN(static_cast<double>(x), m_ElementType, data, dataSize, i++);
      }

      for (d = 0; d < 6; d++)
      {
        float x = (*it)->m_TensorMatrix[d];
        MET_SwapByteIfSystemMSB(&x, MET_FLOAT);
        MET_DoubleToValueN(static_cast<double>(x), m_ElementType, data, dataSize, i++);
      }

      // Add the extra fields
      const DTITubePnt::FieldListType & extraList2 = (*it)->GetExtraFields();
      auto                              itFields = extraList2.begin();
      auto                              itFieldsEnd = extraList2.end();
      while (itFields != itFieldsEnd)
      {
        float x = (*itFields).second;
        MET_SwapByteIfSystemMSB(&x, MET_FLOAT);
        MET_DoubleToValueN(static_cast<double>(x), m_ElementType, data, dataSize, i++);
        ++itFields;
      }

      ++it;
    }

    m_WriteStream->write(data, i * elementSize);
    m_WriteStream->write("\n", 1);
    delete[] data;
  }
  else
  {
    PointListType::const_iterator it = m_PointList.begin();
    PointListType::const_iterator itEnd = m_PointList.end();

    int d;
    while (it != itEnd)
    {
      for (d = 0; d < m_NDims; d++)
      {
        *m_WriteStream << (*it)->m_X[d] << " ";
      }

      for (d = 0; d < 6; d++)
      {
        *m_WriteStream << (*it)->m_TensorMatrix[d] << " ";
      }

      // Add the extra fields
      const DTITubePnt::FieldListType & extraList = (*it)->GetExtraFields();
      auto                              itFields = extraList.begin();
      auto                              itFieldsEnd = extraList.end();
      while (itFields != itFieldsEnd)
      {
        *m_WriteStream << (*itFields).second << " ";
        ++itFields;
      }

      *m_WriteStream << std::endl;
      ++it;
    }
  }
  return true;
}

#if (METAIO_USE_NAMESPACE)
};
#endif