ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
E57Format.cpp
Go to the documentation of this file.
1 /*
2  * E57Format.cpp - implementation of public functions of the E57 format
3  * Reference Implementation.
4  *
5  * Original work Copyright 2009 - 2010 Kevin Ackley (kackley@gwi.net)
6  * Modified work Copyright 2018 - 2020 Andy Maloney <asmaloney@gmail.com>
7  *
8  * Permission is hereby granted, free of charge, to any person or organization
9  * obtaining a copy of the software and accompanying documentation covered by
10  * this license (the "Software") to use, reproduce, display, distribute,
11  * execute, and transmit the Software, and to prepare derivative works of the
12  * Software, and to permit third-parties to whom the Software is furnished to
13  * do so, all subject to the following:
14  *
15  * The copyright notices in the Software and this entire statement, including
16  * the above license grant, this restriction and the following disclaimer,
17  * must be included in all copies of the Software, in whole or in part, and
18  * all derivative works of the Software, unless such copies or derivative
19  * works are solely in the form of machine-executable object code generated by
20  * a source language processor.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
25  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
26  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  */
30 
32 
33 #include "BlobNodeImpl.h"
37 #include "FloatNodeImpl.h"
38 #include "ImageFileImpl.h"
39 #include "IntegerNodeImpl.h"
40 #include "ScaledIntegerNodeImpl.h"
41 #include "SourceDestBufferImpl.h"
42 #include "StringNodeImpl.h"
43 #include "VectorNodeImpl.h"
44 
45 using namespace e57;
46 
72 void Node::checkInvariant( bool doRecurse, bool doDowncast )
73 {
74  ImageFile imf = destImageFile();
75 
76  // If destImageFile not open, can't test invariant (almost every call would
77  // throw)
78  if ( !imf.isOpen() )
79  {
80  return;
81  }
82 
83  // Parent attachment state is same as this attachment state
84  if ( isAttached() != parent().isAttached() )
85  {
87  }
88 
89  // Parent destination ImageFile is same as this
90  if ( imf != parent().destImageFile() )
91  {
93  }
94 
95  // If this is the ImageFile root node
96  if ( *this == imf.root() )
97  {
98  // Must be attached
99  if ( !isAttached() )
100  {
102  }
103 
104  // Must be is a root node
105  if ( !isRoot() )
106  {
108  }
109  }
110 
111  // If this is a root node
112  if ( isRoot() )
113  {
114  // Absolute pathName is "/"
115  if ( pathName() != "/" )
116  {
118  }
119 
120  // parent() returns this node
121  if ( *this != parent() )
122  {
124  }
125  }
126  else
127  {
128  // Non-root can't be own parent
129  if ( *this == parent() )
130  {
132  }
133 
134  // pathName is concatenation of parent pathName and this elementName
135  if ( parent().isRoot() )
136  {
137  if ( pathName() != "/" + elementName() )
138  {
140  }
141  }
142  else
143  {
144  if ( pathName() != parent().pathName() + "/" + elementName() )
145  {
147  }
148  }
149 
150  // Non-root nodes must be children of either a VectorNode or StructureNode
151  if ( parent().type() == E57_VECTOR )
152  {
153  VectorNode v = static_cast<VectorNode>( parent() );
154 
155  // Must be defined in parent VectorNode with this elementName
156  if ( !v.isDefined( elementName() ) )
157  {
159  }
160 
161  // Getting child of parent with this elementName must return this
162  if ( v.get( elementName() ) != *this )
163  {
165  }
166  }
167  else if ( parent().type() == E57_STRUCTURE )
168  {
169  StructureNode s = static_cast<StructureNode>( parent() );
170 
171  // Must be defined in parent VectorNode with this elementName
172  if ( !s.isDefined( elementName() ) )
173  {
175  }
176 
177  // Getting child of parent with this elementName must return this
178  if ( s.get( elementName() ) != *this )
179  {
181  }
182  }
183  else
184  {
186  }
187  }
188 
189  // If this is attached
190  if ( isAttached() )
191  {
192  // Get root of this
193  Node n = *this;
194  while ( !n.isRoot() )
195  {
196  n = n.parent();
197  }
198 
199  // If in tree of ImageFile (could be in a prototype instead)
200  if ( n == imf.root() )
201  {
202  // pathName must be defined
203  if ( !imf.root().isDefined( pathName() ) )
204  {
206  }
207 
208  // Getting by absolute pathName must be this
209  if ( imf.root().get( pathName() ) != *this )
210  {
212  }
213  }
214  }
215 
216  // If requested, check invariants of derived types:
217  if ( doDowncast )
218  {
219  switch ( type() )
220  {
221  case E57_STRUCTURE:
222  {
223  StructureNode s( *this );
224  s.checkInvariant( doRecurse, false );
225  }
226  break;
227  case E57_VECTOR:
228  {
229  VectorNode v( *this );
230  v.checkInvariant( doRecurse, false );
231  }
232  break;
234  {
235  CompressedVectorNode cv( *this );
236  cv.checkInvariant( doRecurse, false );
237  }
238  break;
239  case E57_INTEGER:
240  {
241  IntegerNode i( *this );
242  i.checkInvariant( doRecurse, false );
243  }
244  break;
245  case E57_SCALED_INTEGER:
246  {
247  ScaledIntegerNode si( *this );
248  si.checkInvariant( doRecurse, false );
249  }
250  break;
251  case E57_FLOAT:
252  {
253  FloatNode f( *this );
254  f.checkInvariant( doRecurse, false );
255  }
256  break;
257  case E57_STRING:
258  {
259  StringNode s( *this );
260  s.checkInvariant( doRecurse, false );
261  }
262  break;
263  case E57_BLOB:
264  {
265  BlobNode b( *this );
266  b.checkInvariant( doRecurse, false );
267  }
268  break;
269  default:
270  break;
271  }
272  }
273 }
274 
360 void StructureNode::checkInvariant( bool doRecurse, bool doUpcast )
361 {
362  // If destImageFile not open, can't test invariant (almost every call would
363  // throw)
364  if ( !destImageFile().isOpen() )
365  {
366  return;
367  }
368 
369  // If requested, call Node::checkInvariant
370  if ( doUpcast )
371  {
372  static_cast<Node>( *this ).checkInvariant( false, false );
373  }
374 
375  // Check each child
376  for ( int64_t i = 0; i < childCount(); i++ )
377  {
378  Node child = get( i );
379 
380  // If requested, check children recursively
381  if ( doRecurse )
382  {
383  child.checkInvariant( doRecurse, true );
384  }
385 
386  // Child's parent must be this
387  if ( static_cast<Node>( *this ) != child.parent() )
388  {
390  }
391 
392  // Child's elementName must be defined
393  if ( !isDefined( child.elementName() ) )
394  {
396  }
397 
398  // Getting child by element name must yield same child
399  Node n = get( child.elementName() );
400  if ( n != child )
401  {
403  }
404  }
405 }
406 
409 void VectorNode::checkInvariant( bool doRecurse, bool doUpcast )
410 {
411  // If destImageFile not open, can't test invariant (almost every call would
412  // throw)
413  if ( !destImageFile().isOpen() )
414  {
415  return;
416  }
417 
418  // If requested, call Node::checkInvariant
419  if ( doUpcast )
420  {
421  static_cast<Node>( *this ).checkInvariant( false, false );
422  }
423 
424  // Check each child
425  for ( int64_t i = 0; i < childCount(); i++ )
426  {
427  Node child = get( i );
428 
429  // If requested, check children recursively
430  if ( doRecurse )
431  {
432  child.checkInvariant( doRecurse, true );
433  }
434 
435  // Child's parent must be this
436  if ( static_cast<Node>( *this ) != child.parent() )
437  {
439  }
440 
441  // Child's elementName must be defined
442  if ( !isDefined( child.elementName() ) )
443  {
445  }
446 
447  // Getting child by element name must yield same child
448  Node n = get( child.elementName() );
449  if ( n != child )
450  {
452  }
453  }
454 }
455 
458 void CompressedVectorNode::checkInvariant( bool doRecurse, bool doUpcast )
459 {
460  // If destImageFile not open, can't test invariant (almost every call would
461  // throw)
462  if ( !destImageFile().isOpen() )
463  {
464  return;
465  }
466 
467  // If requested, call Node::checkInvariant
468  if ( doUpcast )
469  {
470  static_cast<Node>( *this ).checkInvariant( false, false );
471  }
472 
473  // Check prototype is good Node
474  prototype().checkInvariant( doRecurse );
475 
476  // prototype attached state not same as this attached state
477  if ( prototype().isAttached() != isAttached() )
478  {
480  }
481 
482  // prototype not root
483  if ( !prototype().isRoot() )
484  {
486  }
487 
488  // prototype dest ImageFile not same as this dest ImageFile
489  if ( prototype().destImageFile() != destImageFile() )
490  {
492  }
493 
494  // Check codecs is good Node
495  codecs().checkInvariant( doRecurse );
496 
497  // codecs attached state not same as this attached state
498  if ( codecs().isAttached() != isAttached() )
499  {
501  }
502 
503  // codecs not root
504  if ( !codecs().isRoot() )
505  {
507  }
508 
509  // codecs dest ImageFile not same as this dest ImageFile
510  if ( codecs().destImageFile() != destImageFile() )
511  {
513  }
514 }
533 void IntegerNode::checkInvariant( bool /*doRecurse*/, bool doUpcast )
534 {
535  // If destImageFile not open, can't test invariant (almost every call would
536  // throw)
537  if ( !destImageFile().isOpen() )
538  {
539  return;
540  }
541 
542  // If requested, call Node::checkInvariant
543  if ( doUpcast )
544  {
545  static_cast<Node>( *this ).checkInvariant( false, false );
546  }
547 
548  if ( value() < minimum() || value() > maximum() )
549  {
551  }
552 }
553 
556 void ScaledIntegerNode::checkInvariant( bool /*doRecurse*/, bool doUpcast )
557 {
558  // If destImageFile not open, can't test invariant (almost every call would
559  // throw)
560  if ( !destImageFile().isOpen() )
561  {
562  return;
563  }
564 
565  // If requested, call Node::checkInvariant
566  if ( doUpcast )
567  {
568  static_cast<Node>( *this ).checkInvariant( false, false );
569  }
570 
571  // If value is out of bounds
572  if ( rawValue() < minimum() || rawValue() > maximum() )
573  {
575  }
576 
577  // If scale is zero
578  if ( scale() == 0 )
579  {
581  }
582 
583  // If scaled value is not calculated correctly
584  if ( scaledValue() != rawValue() * scale() + offset() )
585  {
587  }
588 }
591 void FloatNode::checkInvariant( bool /*doRecurse*/, bool doUpcast )
592 {
593  // If destImageFile not open, can't test invariant (almost every call would
594  // throw)
595  if ( !destImageFile().isOpen() )
596  {
597  return;
598  }
599 
600  // If requested, call Node::checkInvariant
601  if ( doUpcast )
602  {
603  static_cast<Node>( *this ).checkInvariant( false, false );
604  }
605 
606  if ( precision() == E57_SINGLE )
607  {
608  if ( static_cast<float>( minimum() ) < E57_FLOAT_MIN || static_cast<float>( maximum() ) > E57_FLOAT_MAX )
609  {
611  }
612  }
613 
614  // If value is out of bounds
615  if ( value() < minimum() || value() > maximum() )
616  {
618  }
619 }
622 void StringNode::checkInvariant( bool /*doRecurse*/, bool doUpcast )
623 {
624  // If destImageFile not open, can't test invariant (almost every call would
625  // throw)
626  if ( !destImageFile().isOpen() )
627  {
628  return;
629  }
630 
631  // If requested, call Node::checkInvariant
632  if ( doUpcast )
633  {
634  static_cast<Node>( *this ).checkInvariant( false, false );
635  }
637 }
640 void BlobNode::checkInvariant( bool /*doRecurse*/, bool doUpcast )
641 {
642  // If destImageFile not open, can't test invariant (almost every call would
643  // throw)
644  if ( !destImageFile().isOpen() )
645  {
646  return;
647  }
648 
649  // If requested, call Node::checkInvariant
650  if ( doUpcast )
651  {
652  static_cast<Node>( *this ).checkInvariant( false, false );
653  }
654 
655  if ( byteCount() < 0 )
656  {
658  }
659 }
672 void CompressedVectorReader::checkInvariant( bool /*doRecurse*/ )
673 {
674  // If this CompressedVectorReader is not open, can't test invariant (almost
675  // every call would throw)
676  if ( !isOpen() )
677  {
678  return;
679  }
680 
682  ImageFile imf = cv.destImageFile();
683 
684  // If destImageFile not open, can't test invariant (almost every call would
685  // throw)
686  if ( !imf.isOpen() )
687  {
688  return;
689  }
690 
691  // Associated CompressedVectorNode must be attached to ImageFile
692  if ( !cv.isAttached() )
693  {
695  }
696 
697  // Dest ImageFile must have at least 1 reader (this one)
698  if ( imf.readerCount() < 1 )
699  {
701  }
702 
703  // Dest ImageFile can't have any writers
704  if ( imf.writerCount() != 0 )
705  {
707  }
708 }
709 
712 void CompressedVectorWriter::checkInvariant( bool /*doRecurse*/ )
713 {
714  // If this CompressedVectorWriter is not open, can't test invariant (almost
715  // every call would throw)
716  if ( !isOpen() )
717  {
718  return;
719  }
720 
722  ImageFile imf = cv.destImageFile();
723 
724  // If destImageFile not open, can't test invariant (almost every call would
725  // throw)
726  if ( !imf.isOpen() )
727  {
728  return;
729  }
730 
731  // Associated CompressedVectorNode must be attached to ImageFile
732  if ( !cv.isAttached() )
733  {
735  }
736 
737  // Dest ImageFile must be writable
738  if ( !imf.isWritable() )
739  {
741  }
742 
743  // Dest ImageFile must have exactly 1 writer (this one)
744  if ( imf.writerCount() != 1 )
745  {
747  }
748 
749  // Dest ImageFile can't have any readers
750  if ( imf.readerCount() != 0 )
751  {
753  }
754 }
755 
773 void ImageFile::checkInvariant( bool doRecurse ) const
774 {
775  // If this ImageFile is not open, can't test invariant (almost every call
776  // would throw)
777  if ( !isOpen() )
778  {
779  return;
780  }
781 
782  // root() node must be a root node
783  if ( !root().isRoot() )
784  {
786  }
787 
788  // Can't have empty fileName
789  if ( fileName().empty() )
790  {
792  }
793 
794  int wCount = writerCount();
795  int rCount = readerCount();
796 
797  // Can't have negative number of readers
798  if ( rCount < 0 )
799  {
801  }
802 
803  // Can't have negative number of writers
804  if ( wCount < 0 )
805  {
807  }
808 
809  // Can't have more than one writer
810  if ( 1 < wCount )
811  {
813  }
814 
815  // If have writer
816  if ( wCount > 0 )
817  {
818  // Must be in write-mode
819  if ( !isWritable() )
820  {
822  }
823 
824  // Can't have any readers
825  if ( rCount > 0 )
826  {
828  }
829  }
830 
831  // Extension prefixes and URIs are unique
832  const size_t eCount = extensionsCount();
833  for ( size_t i = 0; i < eCount; i++ )
834  {
835  for ( size_t j = i + 1; j < eCount; j++ )
836  {
837  if ( extensionsPrefix( i ) == extensionsPrefix( j ) )
838  {
840  }
841  if ( extensionsUri( i ) == extensionsUri( j ) )
842  {
844  }
845  }
846  }
847 
848  // Verify lookup functions are correct
849  for ( size_t i = 0; i < eCount; i++ )
850  {
851  ustring goodPrefix = extensionsPrefix( i );
852  ustring goodUri = extensionsUri( i );
853  ustring prefix;
854  ustring uri;
855  if ( !extensionsLookupPrefix( goodPrefix, uri ) )
856  {
858  }
859  if ( uri != goodUri )
860  {
862  }
863  if ( !extensionsLookupUri( goodUri, prefix ) )
864  {
866  }
867  if ( prefix != goodPrefix )
868  {
870  }
871  }
872 
873  // If requested, check all objects "below" this one
874  if ( doRecurse )
875  {
876  root().checkInvariant( doRecurse );
877  }
878 }
879 
881 void SourceDestBuffer::checkInvariant( bool /*doRecurse*/ ) const
882 {
883  // Stride must be >= a memory type dependent value
884  size_t min_stride = 0;
885  switch ( memoryRepresentation() )
886  {
887  case E57_INT8:
888  min_stride = 1;
889  break;
890  case E57_UINT8:
891  min_stride = 1;
892  break;
893  case E57_INT16:
894  min_stride = 2;
895  break;
896  case E57_UINT16:
897  min_stride = 2;
898  break;
899  case E57_INT32:
900  min_stride = 4;
901  break;
902  case E57_UINT32:
903  min_stride = 4;
904  break;
905  case E57_INT64:
906  min_stride = 8;
907  break;
908  case E57_BOOL:
909  min_stride = 1;
910  break;
911  case E57_REAL32:
912  min_stride = 4;
913  break;
914  case E57_REAL64:
915  min_stride = 8;
916  break;
917  case E57_USTRING:
918  min_stride = sizeof( ustring );
919  break;
920  default:
922  }
923  if ( stride() < min_stride )
924  {
926  }
927 }
928 
943 {
944  return impl_->type();
945 }
946 
965 bool Node::isRoot() const
966 {
967  return impl_->isRoot();
968 }
969 
998 {
999  return Node( impl_->parent() );
1000 }
1001 
1031 {
1032  return impl_->pathName();
1033 }
1034 
1061 {
1062  return impl_->elementName();
1063 }
1064 
1084 {
1085  return ImageFile( impl_->destImageFile() );
1086 }
1087 
1105 bool Node::isAttached() const
1106 {
1107  return impl_->isAttached();
1108 }
1109 
1128 #ifdef E57_DEBUG
1129 void Node::dump( int indent, std::ostream &os ) const
1130 {
1131  impl_->dump( indent, os );
1132 }
1133 #else
1134 void Node::dump( int indent, std::ostream &os ) const
1135 {
1136 }
1137 #endif
1138 
1146 bool Node::operator==( Node n2 ) const
1147 {
1148  return ( impl_ == n2.impl_ );
1149 }
1150 
1158 bool Node::operator!=( Node n2 ) const
1159 {
1160  return ( impl_ != n2.impl_ );
1161 }
1162 
1165 Node::Node( NodeImplSharedPtr ni ) : impl_( ni )
1166 {
1167 }
1169 
1170 //=====================================================================================
1218 StructureNode::StructureNode( ImageFile destImageFile ) : impl_( new StructureNodeImpl( destImageFile.impl() ) )
1219 {
1220 }
1221 
1225 {
1226  return impl_->isRoot();
1227 }
1228 
1232 {
1233  return Node( impl_->parent() );
1234 }
1235 
1239 {
1240  return impl_->pathName();
1241 }
1242 
1246 {
1247  return impl_->elementName();
1248 }
1249 
1254 {
1255  return ImageFile( impl_->destImageFile() );
1256 }
1257 
1261 {
1262  return impl_->isAttached();
1263 }
1264 
1276 {
1277  return impl_->childCount();
1278 }
1279 
1297 bool StructureNode::isDefined( const ustring &pathName ) const
1298 {
1299  return impl_->isDefined( pathName );
1300 }
1301 
1319 Node StructureNode::get( int64_t index ) const
1320 {
1321  return Node( impl_->get( index ) );
1322 }
1323 
1342 Node StructureNode::get( const ustring &pathName ) const
1343 {
1344  return Node( impl_->get( pathName ) );
1345 }
1346 
1388 void StructureNode::set( const ustring &pathName, const Node &n )
1389 {
1390  impl_->set( pathName, n.impl(), false );
1391 }
1392 
1396 #ifdef E57_DEBUG
1397 void StructureNode::dump( int indent, std::ostream &os ) const
1398 {
1399  impl_->dump( indent, os );
1400 }
1401 #else
1402 void StructureNode::dump( int indent, std::ostream &os ) const
1403 {
1404 }
1405 #endif
1406 
1415 StructureNode::operator Node() const
1416 {
1419  return Node( impl_ );
1420 }
1421 
1435 {
1436  if ( n.type() != E57_STRUCTURE )
1437  {
1438  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
1439  }
1440 
1442  impl_ = std::static_pointer_cast<StructureNodeImpl>( n.impl() );
1443 }
1444 
1447 StructureNode::StructureNode( std::weak_ptr<ImageFileImpl> fileParent ) : impl_( new StructureNodeImpl( fileParent ) )
1448 {
1449 }
1450 
1451 StructureNode::StructureNode( std::shared_ptr<StructureNodeImpl> ni ) : impl_( ni )
1452 {
1453 }
1455 
1456 //=====================================================================================
1524 VectorNode::VectorNode( ImageFile destImageFile, bool allowHeteroChildren ) :
1525  impl_( new VectorNodeImpl( destImageFile.impl(), allowHeteroChildren ) )
1526 {
1527 }
1528 
1532 {
1533  return impl_->isRoot();
1534 }
1535 
1539 {
1540  return Node( impl_->parent() );
1541 }
1542 
1546 {
1547  return impl_->pathName();
1548 }
1549 
1553 {
1554  return impl_->elementName();
1555 }
1556 
1561 {
1562  return ImageFile( impl_->destImageFile() );
1563 }
1564 
1568 {
1569  return impl_->isAttached();
1570 }
1571 
1586 {
1587  return impl_->allowHeteroChildren();
1588 }
1589 
1599 int64_t VectorNode::childCount() const
1600 {
1601  return impl_->childCount();
1602 }
1603 
1624 bool VectorNode::isDefined( const ustring &pathName ) const
1625 {
1626  return impl_->isDefined( pathName );
1627 }
1628 
1641 Node VectorNode::get( int64_t index ) const
1642 {
1643  return Node( impl_->get( index ) );
1644 }
1645 
1668 Node VectorNode::get( const ustring &pathName ) const
1669 {
1670  return Node( impl_->get( pathName ) );
1671 }
1672 
1701 void VectorNode::append( const Node &n )
1702 {
1703  impl_->append( n.impl() );
1704 }
1705 
1709 #ifdef E57_DEBUG
1710 void VectorNode::dump( int indent, std::ostream &os ) const
1711 {
1712  impl_->dump( indent, os );
1713 }
1714 #else
1715 void VectorNode::dump( int indent, std::ostream &os ) const
1716 {
1717 }
1718 #endif
1719 
1728 VectorNode::operator Node() const
1729 {
1732  return Node( impl_ );
1733 }
1734 
1748 {
1749  if ( n.type() != E57_VECTOR )
1750  {
1751  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
1752  }
1753 
1755  impl_ = std::static_pointer_cast<VectorNodeImpl>( n.impl() );
1756 }
1757 
1760 VectorNode::VectorNode( std::shared_ptr<VectorNodeImpl> ni ) : impl_( ni )
1761 {
1762 }
1764 
1765 //=====================================================================================
1860 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, int8_t *b, const size_t capacity,
1861  bool doConversion, bool doScaling, size_t stride ) :
1862  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1863 {
1864  impl_->setTypeInfo<int8_t>( b, stride );
1865 }
1866 
1871 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, uint8_t *b, const size_t capacity,
1872  bool doConversion, bool doScaling, size_t stride ) :
1873  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1874 {
1875  impl_->setTypeInfo<uint8_t>( b, stride );
1876 }
1877 
1882 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, int16_t *b, const size_t capacity,
1883  bool doConversion, bool doScaling, size_t stride ) :
1884  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1885 {
1886  impl_->setTypeInfo<int16_t>( b, stride );
1887 }
1888 
1893 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, uint16_t *b,
1894  const size_t capacity, bool doConversion, bool doScaling, size_t stride ) :
1895  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1896 {
1897  impl_->setTypeInfo<uint16_t>( b, stride );
1898 }
1899 
1904 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, int32_t *b, const size_t capacity,
1905  bool doConversion, bool doScaling, size_t stride ) :
1906  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1907 {
1908  impl_->setTypeInfo<int32_t>( b, stride );
1909 }
1910 
1915 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, uint32_t *b,
1916  const size_t capacity, bool doConversion, bool doScaling, size_t stride ) :
1917  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1918 {
1919  impl_->setTypeInfo<uint32_t>( b, stride );
1920 }
1921 
1926 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, int64_t *b, const size_t capacity,
1927  bool doConversion, bool doScaling, size_t stride ) :
1928  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1929 {
1930  impl_->setTypeInfo<int64_t>( b, stride );
1931 }
1932 
1937 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, bool *b, const size_t capacity,
1938  bool doConversion, bool doScaling, size_t stride ) :
1939  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1940 {
1941  impl_->setTypeInfo<bool>( b, stride );
1942 }
1943 
1948 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, float *b, const size_t capacity,
1949  bool doConversion, bool doScaling, size_t stride ) :
1950  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1951 {
1952  impl_->setTypeInfo<float>( b, stride );
1953 }
1954 
1959 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, double *b, const size_t capacity,
1960  bool doConversion, bool doScaling, size_t stride ) :
1961  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, capacity, doConversion, doScaling ) )
1962 {
1963  impl_->setTypeInfo<double>( b, stride );
1964 }
1965 
2006 SourceDestBuffer::SourceDestBuffer( ImageFile destImageFile, const ustring &pathName, StringList *b ) :
2007  impl_( new SourceDestBufferImpl( destImageFile.impl(), pathName, b ) )
2008 {
2009 }
2010 
2031 {
2032  return impl_->pathName();
2033 }
2034 
2056 {
2057  return impl_->memoryRepresentation();
2058 }
2059 
2071 {
2072  return impl_->capacity();
2073 }
2074 
2105 {
2106  return impl_->doConversion();
2107 }
2108 
2142 {
2143  return impl_->doScaling();
2144 }
2145 
2159 {
2160  return impl_->stride();
2161 }
2162 
2166 #ifdef E57_DEBUG
2167 void SourceDestBuffer::dump( int indent, std::ostream &os ) const
2168 {
2169  impl_->dump( indent, os );
2170 }
2171 #else
2172 void SourceDestBuffer::dump( int indent, std::ostream &os ) const
2173 {
2174 }
2175 #endif
2176 
2177 //=====================================================================================
2222 CompressedVectorReader::CompressedVectorReader( std::shared_ptr<CompressedVectorReaderImpl> ni ) : impl_( ni )
2225 {
2226 }
2228 
2286 {
2287  return impl_->read();
2288 }
2289 
2355 unsigned CompressedVectorReader::read( std::vector<SourceDestBuffer> &dbufs )
2356 {
2357  return impl_->read( dbufs );
2358 }
2359 
2383 void CompressedVectorReader::seek( int64_t recordNumber )
2384 {
2385  impl_->seek( recordNumber );
2386 }
2387 
2401 {
2402  impl_->close();
2403 }
2404 
2413 {
2414  return impl_->isOpen();
2415 }
2416 
2429 {
2430  return impl_->compressedVectorNode();
2431 }
2432 
2436 #ifdef E57_DEBUG
2437 void CompressedVectorReader::dump( int indent, std::ostream &os ) const
2438 {
2439  impl_->dump( indent, os );
2440 }
2441 #else
2442 void CompressedVectorReader::dump( int indent, std::ostream &os ) const
2443 {
2444 }
2445 #endif
2446 
2447 //=====================================================================================
2493 CompressedVectorWriter::CompressedVectorWriter( std::shared_ptr<CompressedVectorWriterImpl> ni ) : impl_( ni )
2496 {
2497 }
2499 
2563 void CompressedVectorWriter::write( const size_t recordCount )
2564 {
2565  impl_->write( recordCount );
2566 }
2567 
2633 void CompressedVectorWriter::write( std::vector<SourceDestBuffer> &sbufs, const size_t recordCount )
2634 {
2635  impl_->write( sbufs, recordCount );
2636 }
2637 
2667 {
2668  impl_->close();
2669 }
2670 
2679 {
2680  return impl_->isOpen();
2681 }
2682 
2693 {
2694  return impl_->compressedVectorNode();
2695 }
2696 
2700 #ifdef E57_DEBUG
2701 void CompressedVectorWriter::dump( int indent, std::ostream &os ) const
2702 {
2703  impl_->dump( indent, os );
2704 }
2705 #else
2706 void CompressedVectorWriter::dump( int indent, std::ostream &os ) const
2707 {
2708 }
2709 #endif
2710 
2711 //=====================================================================================
2830 CompressedVectorNode::CompressedVectorNode( ImageFile destImageFile, const Node &prototype, const VectorNode &codecs ) :
2831  impl_( new CompressedVectorNodeImpl( destImageFile.impl() ) )
2832 {
2835  impl_->setPrototype( prototype.impl() );
2836  impl_->setCodecs( codecs.impl() );
2837 }
2838 
2842 {
2843  return impl_->isRoot();
2844 }
2845 
2849 {
2850  return Node( impl_->parent() );
2851 }
2852 
2856 {
2857  return impl_->pathName();
2858 }
2859 
2863 {
2864  return impl_->elementName();
2865 }
2866 
2871 {
2872  return ImageFile( impl_->destImageFile() );
2873 }
2874 
2878 {
2879  return impl_->isAttached();
2880 }
2881 
2895 {
2896  return impl_->childCount();
2897 }
2898 
2910 {
2911  return Node( impl_->getPrototype() );
2912 }
2913 
2926 {
2927  return VectorNode( impl_->getCodecs() );
2928 }
2929 
2933 #ifdef E57_DEBUG
2934 void CompressedVectorNode::dump( int indent, std::ostream &os ) const
2935 {
2936  impl_->dump( indent, os );
2937 }
2938 #else
2939 void CompressedVectorNode::dump( int indent, std::ostream &os ) const
2940 {
2941 }
2942 #endif
2943 
2952 CompressedVectorNode::operator Node() const
2953 {
2956  return Node( impl_ );
2957 }
2958 
2972 {
2973  if ( n.type() != E57_COMPRESSED_VECTOR )
2974  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
2975 
2977  impl_ = std::static_pointer_cast<CompressedVectorNodeImpl>( n.impl() );
2978 }
2979 
2982 CompressedVectorNode::CompressedVectorNode( std::shared_ptr<CompressedVectorNodeImpl> ni ) : impl_( ni )
2983 {
2984 }
2986 
3032 CompressedVectorWriter CompressedVectorNode::writer( std::vector<SourceDestBuffer> &sbufs )
3033 {
3034  return CompressedVectorWriter( impl_->writer( sbufs ) );
3035 }
3036 
3068 CompressedVectorReader CompressedVectorNode::reader( const std::vector<SourceDestBuffer> &dbufs )
3069 {
3070  return CompressedVectorReader( impl_->reader( dbufs ) );
3071 }
3072 
3073 //=====================================================================================
3142 IntegerNode::IntegerNode( ImageFile destImageFile, int64_t value, int64_t minimum, int64_t maximum ) :
3143  impl_( new IntegerNodeImpl( destImageFile.impl(), value, minimum, maximum ) )
3144 {
3145 }
3146 
3150 {
3151  return impl_->isRoot();
3152 }
3153 
3157 {
3158  return Node( impl_->parent() );
3159 }
3160 
3164 {
3165  return impl_->pathName();
3166 }
3167 
3171 {
3172  return impl_->elementName();
3173 }
3174 
3179 {
3180  return ImageFile( impl_->destImageFile() );
3181 }
3182 
3186 {
3187  return impl_->isAttached();
3188 }
3189 
3199 int64_t IntegerNode::value() const
3200 {
3201  return impl_->value();
3202 }
3203 
3213 int64_t IntegerNode::minimum() const
3214 {
3215  return impl_->minimum();
3216 }
3217 
3227 int64_t IntegerNode::maximum() const
3228 {
3229  return impl_->maximum();
3230 }
3231 
3235 #ifdef E57_DEBUG
3236 void IntegerNode::dump( int indent, std::ostream &os ) const
3237 {
3238  impl_->dump( indent, os );
3239 }
3240 #else
3241 void IntegerNode::dump( int indent, std::ostream &os ) const
3242 {
3243 }
3244 #endif
3245 
3254 IntegerNode::operator Node() const
3255 {
3258  return Node( impl_ );
3259 }
3260 
3274 {
3275  if ( n.type() != E57_INTEGER )
3276  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
3277 
3279  impl_ = std::static_pointer_cast<IntegerNodeImpl>( n.impl() );
3280 }
3281 
3284 IntegerNode::IntegerNode( std::shared_ptr<IntegerNodeImpl> ni ) : impl_( ni )
3285 {
3286 }
3288 
3289 //=====================================================================================
3368 ScaledIntegerNode::ScaledIntegerNode( ImageFile destImageFile, int64_t rawValue, int64_t minimum, int64_t maximum,
3369  double scale, double offset ) :
3370  impl_( new ScaledIntegerNodeImpl( destImageFile.impl(), rawValue, minimum, maximum, scale, offset ) )
3371 {
3372 }
3373 ScaledIntegerNode::ScaledIntegerNode( ImageFile destImageFile, int rawValue, int64_t minimum, int64_t maximum,
3374  double scale, double offset ) :
3375  impl_( new ScaledIntegerNodeImpl( destImageFile.impl(), static_cast<int64_t>( rawValue ), minimum, maximum, scale,
3376  offset ) )
3377 {
3378 }
3379 ScaledIntegerNode::ScaledIntegerNode( ImageFile destImageFile, int rawValue, int minimum, int maximum, double scale,
3380  double offset ) :
3381  impl_( new ScaledIntegerNodeImpl( destImageFile.impl(), static_cast<int64_t>( rawValue ),
3382  static_cast<int64_t>( minimum ), static_cast<int64_t>( maximum ), scale, offset ) )
3383 {
3384 }
3423 ScaledIntegerNode::ScaledIntegerNode( ImageFile destImageFile, double scaledValue, double scaledMinimum,
3424  double scaledMaximum, double scale, double offset ) :
3425  impl_( new ScaledIntegerNodeImpl( destImageFile.impl(), scaledValue, scaledMinimum, scaledMaximum, scale, offset ) )
3426 {
3427 }
3431 {
3432  return impl_->isRoot();
3433 }
3434 
3438 {
3439  return Node( impl_->parent() );
3440 }
3441 
3445 {
3446  return impl_->pathName();
3447 }
3448 
3452 {
3453  return impl_->elementName();
3454 }
3455 
3460 {
3461  return ImageFile( impl_->destImageFile() );
3462 }
3463 
3467 {
3468  return impl_->isAttached();
3469 }
3470 
3481 {
3482  return impl_->rawValue();
3483 }
3484 
3496 {
3497  return impl_->scaledValue();
3498 }
3499 
3510 {
3511  return impl_->minimum();
3512 }
3523 {
3524  return impl_->scaledMinimum();
3525 }
3536 {
3537  return impl_->maximum();
3538 }
3548 double ScaledIntegerNode::scaledMaximum() const // Added by SC
3549 {
3550  return impl_->scaledMaximum();
3551 }
3562 {
3563  return impl_->scale();
3564 }
3565 
3576 {
3577  return impl_->offset();
3578 }
3579 
3583 #ifdef E57_DEBUG
3584 void ScaledIntegerNode::dump( int indent, std::ostream &os ) const
3585 {
3586  impl_->dump( indent, os );
3587 }
3588 #else
3589 void ScaledIntegerNode::dump( int indent, std::ostream &os ) const
3590 {
3591 }
3592 #endif
3593 
3602 ScaledIntegerNode::operator Node() const
3603 {
3606  return Node( impl_ );
3607 }
3608 
3622 {
3623  if ( n.type() != E57_SCALED_INTEGER )
3624  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
3625 
3627  impl_ = std::static_pointer_cast<ScaledIntegerNodeImpl>( n.impl() );
3628 }
3629 
3632 ScaledIntegerNode::ScaledIntegerNode( std::shared_ptr<ScaledIntegerNodeImpl> ni ) : impl_( ni )
3633 {
3634 }
3636 
3637 //=====================================================================================
3726 FloatNode::FloatNode( ImageFile destImageFile, double value, FloatPrecision precision, double minimum,
3727  double maximum ) :
3728  impl_( new FloatNodeImpl( destImageFile.impl(), value, precision, minimum, maximum ) )
3729 {
3730 }
3731 
3734 bool FloatNode::isRoot() const
3735 {
3736  return impl_->isRoot();
3737 }
3738 
3742 {
3743  return Node( impl_->parent() );
3744 }
3745 
3749 {
3750  return impl_->pathName();
3751 }
3752 
3756 {
3757  return impl_->elementName();
3758 }
3759 
3764 {
3765  return ImageFile( impl_->destImageFile() );
3766 }
3767 
3771 {
3772  return impl_->isAttached();
3773 }
3774 
3787 double FloatNode::value() const
3788 {
3789  return impl_->value();
3790 }
3791 
3803 {
3804  return impl_->precision();
3805 }
3806 
3820 double FloatNode::minimum() const
3821 {
3822  return impl_->minimum();
3823 }
3824 
3838 double FloatNode::maximum() const
3839 {
3840  return impl_->maximum();
3841 }
3842 
3846 #ifdef E57_DEBUG
3847 void FloatNode::dump( int indent, std::ostream &os ) const
3848 {
3849  impl_->dump( indent, os );
3850 }
3851 #else
3852 void FloatNode::dump( int indent, std::ostream &os ) const
3853 {
3854 }
3855 #endif
3856 
3865 FloatNode::operator Node() const
3866 {
3869  return Node( impl_ );
3870 }
3871 
3885 {
3886  if ( n.type() != E57_FLOAT )
3887  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
3888 
3890  impl_ = std::static_pointer_cast<FloatNodeImpl>( n.impl() );
3891 }
3892 
3895 FloatNode::FloatNode( std::shared_ptr<FloatNodeImpl> ni ) : impl_( ni )
3896 {
3897 }
3899 
3900 //=====================================================================================
3957 StringNode::StringNode( ImageFile destImageFile, const ustring &value ) :
3958  impl_( new StringNodeImpl( destImageFile.impl(), value ) )
3959 {
3960 }
3961 
3965 {
3966  return impl_->isRoot();
3967 }
3968 
3972 {
3973  return Node( impl_->parent() );
3974 }
3975 
3979 {
3980  return impl_->pathName();
3981 }
3982 
3986 {
3987  return impl_->elementName();
3988 }
3989 
3994 {
3995  return ImageFile( impl_->destImageFile() );
3996 }
3997 
4001 {
4002  return impl_->isAttached();
4003 }
4004 
4014 {
4015  return impl_->value();
4016 }
4017 
4021 #ifdef E57_DEBUG
4022 void StringNode::dump( int indent, std::ostream &os ) const
4023 {
4024  impl_->dump( indent, os );
4025 }
4026 #else
4027 void StringNode::dump( int indent, std::ostream &os ) const
4028 {
4029 }
4030 #endif
4031 
4040 StringNode::operator Node() const
4041 {
4044  return Node( impl_ );
4045 }
4046 
4060 {
4061  if ( n.type() != E57_STRING )
4062  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
4063 
4065  impl_ = std::static_pointer_cast<StringNodeImpl>( n.impl() );
4066 }
4067 
4070 StringNode::StringNode( std::shared_ptr<StringNodeImpl> ni ) : impl_( ni )
4071 {
4072 }
4074 
4075 //=====================================================================================
4161 BlobNode::BlobNode( ImageFile destImageFile, int64_t byteCount ) :
4162  impl_( new BlobNodeImpl( destImageFile.impl(), byteCount ) )
4163 {
4164 }
4165 
4168 bool BlobNode::isRoot() const
4169 {
4170  return impl_->isRoot();
4171 }
4172 
4176 {
4177  return Node( impl_->parent() );
4178 }
4179 
4183 {
4184  return impl_->pathName();
4185 }
4186 
4190 {
4191  return impl_->elementName();
4192 }
4193 
4198 {
4199  return ImageFile( impl_->destImageFile() );
4200 }
4201 
4205 {
4206  return impl_->isAttached();
4207 }
4208 
4218 int64_t BlobNode::byteCount() const
4219 {
4220  return impl_->byteCount();
4221 }
4222 
4250 void BlobNode::read( uint8_t *buf, int64_t start, size_t count )
4251 {
4252  impl_->read( buf, start, count );
4253 }
4254 
4292 void BlobNode::write( uint8_t *buf, int64_t start, size_t count )
4293 {
4294  impl_->write( buf, start, count );
4295 }
4296 
4300 #ifdef E57_DEBUG
4301 void BlobNode::dump( int indent, std::ostream &os ) const
4302 {
4303  impl_->dump( indent, os );
4304 }
4305 #else
4306 void BlobNode::dump( int indent, std::ostream &os ) const
4307 {
4308 }
4309 #endif
4310 
4319 BlobNode::operator Node() const
4320 {
4323  return Node( impl_ );
4324 }
4325 
4339 {
4340  if ( n.type() != E57_BLOB )
4341  throw E57_EXCEPTION2( E57_ERROR_BAD_NODE_DOWNCAST, "nodeType=" + toString( n.type() ) );
4342 
4344  impl_ = std::static_pointer_cast<BlobNodeImpl>( n.impl() );
4345 }
4346 
4349 BlobNode::BlobNode( ImageFile destImageFile, int64_t fileOffset, int64_t length ) :
4350  impl_( new BlobNodeImpl( destImageFile.impl(), fileOffset, length ) )
4351 {
4352 }
4353 
4354 BlobNode::BlobNode( std::shared_ptr<BlobNodeImpl> ni ) : impl_( ni )
4355 {
4356 }
4358 
4359 //=====================================================================================
4498 ImageFile::ImageFile( const ustring &fname, const ustring &mode, ReadChecksumPolicy checksumPolicy ) :
4499  impl_( new ImageFileImpl( checksumPolicy ) )
4500 {
4502  impl_->construct2( fname, mode );
4503 }
4504 
4505 ImageFile::ImageFile( const char *input, const uint64_t size, ReadChecksumPolicy checksumPolicy ) :
4506  impl_( new ImageFileImpl( checksumPolicy ) )
4507 {
4508  impl_->construct2( input, size );
4509 }
4510 
4522 {
4523  return StructureNode( impl_->root() );
4524 }
4525 
4558 {
4559  impl_->close();
4560 }
4561 
4575 {
4576  impl_->cancel();
4577 }
4578 
4586 bool ImageFile::isOpen() const
4587 {
4588  return impl_->isOpen();
4589 }
4590 
4599 {
4600  return impl_->isWriter();
4601 }
4602 
4611 {
4612  return impl_->fileName();
4613 }
4614 
4631 {
4632  return impl_->writerCount();
4633 }
4634 
4651 {
4652  return impl_->readerCount();
4653 }
4654 
4697 void ImageFile::extensionsAdd( const ustring &prefix, const ustring &uri )
4698 {
4699  impl_->extensionsAdd( prefix, uri );
4700 }
4701 
4721 bool ImageFile::extensionsLookupPrefix( const ustring &prefix, ustring &uri ) const
4722 {
4723  return impl_->extensionsLookupPrefix( prefix, uri );
4724 }
4725 
4746 bool ImageFile::extensionsLookupUri( const ustring &uri, ustring &prefix ) const
4747 {
4748  return impl_->extensionsLookupUri( uri, prefix );
4749 }
4750 
4763 {
4764  return impl_->extensionsCount();
4765 }
4766 
4783 ustring ImageFile::extensionsPrefix( const size_t index ) const
4784 {
4785  return impl_->extensionsPrefix( index );
4786 }
4787 
4804 ustring ImageFile::extensionsUri( const size_t index ) const
4805 {
4806  return impl_->extensionsUri( index );
4807 }
4808 
4820 bool ImageFile::isElementNameExtended( const ustring &elementName ) const
4821 {
4822  return impl_->isElementNameExtended( elementName );
4823 }
4824 
4841 void ImageFile::elementNameParse( const ustring &elementName, ustring &prefix, ustring &localPart ) const
4842 {
4843  impl_->elementNameParse( elementName, prefix, localPart );
4844 }
4845 
4851 #ifdef E57_DEBUG
4852 void ImageFile::dump( int indent, std::ostream &os ) const
4853 {
4854  impl_->dump( indent, os );
4855 }
4856 #else
4857 void ImageFile::dump( int indent, std::ostream &os ) const
4858 {
4859 }
4860 #endif
4861 
4870 {
4871  return ( impl_ == imf2.impl_ );
4872 }
4873 
4882 {
4883  return ( impl_ != imf2.impl_ );
4884 }
4885 
4888 ImageFile::ImageFile( ImageFileImplSharedPtr imfi ) : impl_( imfi )
4889 {
4890 }
int size
int count
int offset
#define E57_EXCEPTION2(ecode, context)
Definition: Common.h:68
#define E57_EXCEPTION1(ecode)
!! inline these rather than macros?
Definition: Common.h:66
size_t stride
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:4168
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:4182
int64_t byteCount() const
Get size of blob declared when it was created.
Definition: E57Format.cpp:4218
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:4175
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether BlobNode class invariant is true.
Definition: E57Format.cpp:640
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:4301
void write(uint8_t *buf, int64_t start, size_t count)
Write a buffer of bytes to a blob.
Definition: E57Format.cpp:4292
ustring elementName() const
Get elementName string, that identifies the node in its parent..
Definition: E57Format.cpp:4189
BlobNode()=delete
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:4197
void read(uint8_t *buf, int64_t start, size_t count)
Read a buffer of bytes from a blob.
Definition: E57Format.cpp:4250
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:4204
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:2841
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:2848
CompressedVectorReader reader(const std::vector< SourceDestBuffer > &dbufs)
Create an iterator object for reading a series of blocks of data from a CompressedVectorNode.
Definition: E57Format.cpp:3068
Node prototype() const
Get the prototype tree that describes the types in the record.
Definition: E57Format.cpp:2909
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:2870
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:2934
int64_t childCount() const
Get current number of records in a CompressedVectorNode.
Definition: E57Format.cpp:2894
CompressedVectorWriter writer(std::vector< SourceDestBuffer > &sbufs)
Create an iterator object for writing a series of blocks of data to a CompressedVectorNode.
Definition: E57Format.cpp:3032
ustring elementName() const
Get elementName string, that identifies the node in its parent..
Definition: E57Format.cpp:2862
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:2877
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:2855
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether CompressedVectorNode class invariant is true.
Definition: E57Format.cpp:458
VectorNode codecs() const
Get the codecs tree that describes the encoder/decoder configuration of the CompressedVectorNode.
Definition: E57Format.cpp:2925
void checkInvariant(bool doRecurse=true)
Check whether CompressedVectorReader class invariant is true.
Definition: E57Format.cpp:672
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:2437
unsigned read()
Request transfer of blocks of data from CompressedVectorNode into previously designated destination b...
Definition: E57Format.cpp:2285
void close()
End the read operation.
Definition: E57Format.cpp:2400
CompressedVectorNode compressedVectorNode() const
Return the CompressedVectorNode being read.
Definition: E57Format.cpp:2428
void seek(int64_t recordNumber)
Set record number of CompressedVectorNode where next read will start.
Definition: E57Format.cpp:2383
bool isOpen()
Test whether CompressedVectorReader is still open for reading.
Definition: E57Format.cpp:2412
bool isOpen()
Test whether CompressedVectorWriter is still open for writing.
Definition: E57Format.cpp:2678
void write(const size_t recordCount)
Request transfer of blocks of data to CompressedVectorNode from previously designated source buffers.
Definition: E57Format.cpp:2563
void close()
End the write operation.
Definition: E57Format.cpp:2666
void checkInvariant(bool doRecurse=true)
Check whether CompressedVectorWriter class invariant is true.
Definition: E57Format.cpp:712
CompressedVectorNode compressedVectorNode() const
Return the CompressedVectorNode being written to.
Definition: E57Format.cpp:2692
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:2701
double minimum() const
Get the declared minimum that the value may take.
Definition: E57Format.cpp:3820
ustring elementName() const
Get elementName string, that identifies the node in its parent..
Definition: E57Format.cpp:3755
double maximum() const
Get the declared maximum that the value may take.
Definition: E57Format.cpp:3838
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:3741
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:3770
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:3734
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:3847
FloatNode()=delete
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:3748
double value() const
Get IEEE floating point value stored.
Definition: E57Format.cpp:3787
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:3763
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether FloatNode class invariant is true.
Definition: E57Format.cpp:591
FloatPrecision precision() const
Get declared precision of the floating point number.
Definition: E57Format.cpp:3802
StructureNode root() const
Get the pre-established root StructureNode of the E57 ImageFile.
Definition: E57Format.cpp:4521
bool isOpen() const
Test whether ImageFile is still open for accessing.
Definition: E57Format.cpp:4586
size_t extensionsCount() const
Get number of E57 extensions declared in the ImageFile.
Definition: E57Format.cpp:4762
bool extensionsLookupPrefix(const ustring &prefix, ustring &uri) const
Get URI associated with an E57 extension prefix in the ImageFile.
Definition: E57Format.cpp:4721
ImageFile()=delete
void elementNameParse(const ustring &elementName, ustring &prefix, ustring &localPart) const
Parse element name into prefix and localPart substrings.
Definition: E57Format.cpp:4841
bool extensionsLookupUri(const ustring &uri, ustring &prefix) const
Get an E57 extension prefix associated with a URI in the ImageFile.
Definition: E57Format.cpp:4746
int writerCount() const
Get current number of open CompressedVectorWriter objects writing to ImageFile.
Definition: E57Format.cpp:4630
void cancel()
Stop I/O operations and delete a partially written ImageFile on the disk.
Definition: E57Format.cpp:4574
void checkInvariant(bool doRecurse=true) const
Check whether ImageFile class invariant is true.
Definition: E57Format.cpp:773
ustring extensionsUri(const size_t index) const
Get an E57 extension URI declared in an ImageFile by index.
Definition: E57Format.cpp:4804
bool operator!=(ImageFile imf2) const
Test if two ImageFile handles refer to different underlying ImageFile.
Definition: E57Format.cpp:4881
bool operator==(ImageFile imf2) const
Test if two ImageFile handles refer to the same underlying ImageFile.
Definition: E57Format.cpp:4869
ustring fileName() const
Get the file name the ImageFile was created with.
Definition: E57Format.cpp:4610
int readerCount() const
Get current number of open CompressedVectorReader objects reading from ImageFile.
Definition: E57Format.cpp:4650
void extensionsAdd(const ustring &prefix, const ustring &uri)
Declare the use of an E57 extension in an ImageFile being written.
Definition: E57Format.cpp:4697
void close()
Complete any write operations on an ImageFile, and close the file on the disk.
Definition: E57Format.cpp:4557
ustring extensionsPrefix(const size_t index) const
Get an E57 extension prefix declared in an ImageFile by index.
Definition: E57Format.cpp:4783
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:4852
bool isWritable() const
Test whether ImageFile was opened in write mode.
Definition: E57Format.cpp:4598
bool isElementNameExtended(const ustring &elementName) const
Test whether an E57 element name has an extension prefix.
Definition: E57Format.cpp:4820
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:3236
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:3163
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether IntegerNode class invariant is true.
Definition: E57Format.cpp:533
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:3185
int64_t value() const
Get integer value stored.
Definition: E57Format.cpp:3199
int64_t maximum() const
Get the declared maximum that the value may take.
Definition: E57Format.cpp:3227
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:3178
IntegerNode()=delete
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:3156
int64_t minimum() const
Get the declared minimum that the value may take.
Definition: E57Format.cpp:3213
ustring elementName() const
Get elementName string, that identifies the node in its parent..
Definition: E57Format.cpp:3170
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:3149
ustring elementName() const
Get element name of node.
Definition: E57Format.cpp:1060
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:965
Node()=delete
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:1030
bool operator==(Node n2) const
Test if two node handles refer to the same underlying node.
Definition: E57Format.cpp:1146
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:997
NodeType type() const
Return the NodeType of a generic Node.
Definition: E57Format.cpp:942
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:1083
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:1105
bool operator!=(Node n2) const
Test if two node handles refer to different underlying nodes.
Definition: E57Format.cpp:1158
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:1129
void checkInvariant(bool doRecurse=true, bool doDowncast=true)
Check whether Node class invariant is true.
Definition: E57Format.cpp:72
int64_t rawValue() const
Get raw unscaled integer value of element.
Definition: E57Format.cpp:3480
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:3459
double scaledMinimum() const
Get the declared scaled minimum that the scaled value may take.
Definition: E57Format.cpp:3522
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:3430
ustring elementName() const
Get elementName string, that identifies the node in its parent..
Definition: E57Format.cpp:3451
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether ScaledIntegerNode class invariant is true.
Definition: E57Format.cpp:556
double scaledValue() const
Get scaled value of element.
Definition: E57Format.cpp:3495
double scale() const
Get declared scaling factor.
Definition: E57Format.cpp:3561
int64_t minimum() const
Get the declared minimum that the raw value may take.
Definition: E57Format.cpp:3509
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:3444
int64_t maximum() const
Get the declared maximum that the raw value may take.
Definition: E57Format.cpp:3535
double scaledMaximum() const
Get the declared scaled maximum that the scaled value may take.
Definition: E57Format.cpp:3548
double offset() const
Get declared offset.
Definition: E57Format.cpp:3575
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:3466
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:3437
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:3584
bool doScaling() const
Get whether scaling will be performed for ScaledIntegerNode transfers.
Definition: E57Format.cpp:2141
bool doConversion() const
Get whether conversions will be performed to match the memory type of buffer.
Definition: E57Format.cpp:2104
ustring pathName() const
Get path name in prototype that this SourceDestBuffer will transfer data to/from.
Definition: E57Format.cpp:2030
enum MemoryRepresentation memoryRepresentation() const
Get memory representation of the elements in this SourceDestBuffer.
Definition: E57Format.cpp:2055
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:2167
size_t stride() const
Get number of bytes between consecutive memory elements in buffer.
Definition: E57Format.cpp:2158
void checkInvariant(bool doRecurse=true) const
Check whether SourceDestBuffer class invariant is true.
Definition: E57Format.cpp:881
size_t capacity() const
Get total capacity of buffer.
Definition: E57Format.cpp:2070
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:3971
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:3978
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:4000
ustring value() const
Get Unicode character string value stored.
Definition: E57Format.cpp:4013
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether StringNode class invariant is true.
Definition: E57Format.cpp:622
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:3993
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:4022
StringNode()=delete
ustring elementName() const
Get elementName string, that identifies the node in its parent..
Definition: E57Format.cpp:3985
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:3964
ustring elementName() const
Get elementName string, that identifies the node in its parent.
Definition: E57Format.cpp:1245
bool isDefined(const ustring &pathName) const
Is the given pathName defined relative to this node.
Definition: E57Format.cpp:1297
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:1238
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:1224
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:1397
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether StructureNode class invariant is true.
Definition: E57Format.cpp:360
void set(const ustring &pathName, const Node &n)
Add a new child at a given path.
Definition: E57Format.cpp:1388
Node get(int64_t index) const
Get a child element by positional index.
Definition: E57Format.cpp:1319
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:1231
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:1260
int64_t childCount() const
Return number of child nodes contained by this StructureNode.
Definition: E57Format.cpp:1275
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:1253
StructureNode()=delete
bool isRoot() const
Is this a root node.
Definition: E57Format.cpp:1531
bool isAttached() const
Has node been attached into the tree of an ImageFile.
Definition: E57Format.cpp:1567
bool allowHeteroChildren() const
Get whether child elements are allowed to be different types?
Definition: E57Format.cpp:1585
Node get(int64_t index) const
Get a child element by positional index.
Definition: E57Format.cpp:1641
bool isDefined(const ustring &pathName) const
Is the given pathName defined relative to this node.
Definition: E57Format.cpp:1624
void append(const Node &n)
Append a child element to end of VectorNode.
Definition: E57Format.cpp:1701
ustring pathName() const
Get absolute pathname of node.
Definition: E57Format.cpp:1545
void checkInvariant(bool doRecurse=true, bool doUpcast=true)
Check whether VectorNode class invariant is true.
Definition: E57Format.cpp:409
Node parent() const
Return parent of node, or self if a root node.
Definition: E57Format.cpp:1538
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: E57Format.cpp:1560
int64_t childCount() const
Get number of child elements in this VectorNode.
Definition: E57Format.cpp:1599
ustring elementName() const
Get elementName string, that identifies the node in its parent..
Definition: E57Format.cpp:1552
void dump(int indent=0, std::ostream &os=std::cout) const
Diagnostic function to print internal state of object to output stream in an indented format.
Definition: E57Format.cpp:1710
VectorNode()=delete
__host__ __device__ float length(float2 v)
Definition: cutil_math.h:1162
int ReadChecksumPolicy
Specifies the percentage of checksums which are verified when reading an ImageFile (0-100%).
Definition: E57Format.h:95
std::shared_ptr< class NodeImpl > NodeImplSharedPtr
Definition: Common.h:190
std::shared_ptr< class ImageFileImpl > ImageFileImplSharedPtr
Definition: Common.h:188
FloatPrecision
The IEEE floating point number precisions supported.
Definition: E57Format.h:71
@ E57_SINGLE
32 bit IEEE floating point number format
Definition: E57Format.h:72
@ E57_ERROR_BAD_NODE_DOWNCAST
bad downcast from Node to specific node type
Definition: E57Exception.h:85
@ E57_ERROR_INVARIANCE_VIOLATION
class invariance constraint violation in debug mode
Definition: E57Exception.h:96
std::string ustring
UTF-8 encodeded Unicode string.
Definition: E57Format.h:54
MemoryRepresentation
Identifies the representations of memory elements API can transfer data to/from.
Definition: E57Format.h:79
@ E57_USTRING
Unicode UTF-8 std::string.
Definition: E57Format.h:90
@ E57_UINT32
32 bit unsigned integer
Definition: E57Format.h:85
@ E57_INT32
32 bit signed integer
Definition: E57Format.h:84
@ E57_UINT8
8 bit unsigned integer
Definition: E57Format.h:81
@ E57_INT64
64 bit signed integer
Definition: E57Format.h:86
@ E57_INT8
8 bit signed integer
Definition: E57Format.h:80
@ E57_REAL32
C++ float type.
Definition: E57Format.h:88
@ E57_UINT16
16 bit unsigned integer
Definition: E57Format.h:83
@ E57_BOOL
C++ boolean type.
Definition: E57Format.h:87
@ E57_INT16
16 bit signed integer
Definition: E57Format.h:82
@ E57_REAL64
C++ double type.
Definition: E57Format.h:89
NodeType
Identifiers for types of E57 elements.
Definition: E57Format.h:58
@ E57_COMPRESSED_VECTOR
CompressedVectorNode class.
Definition: E57Format.h:61
@ E57_BLOB
BlobNode class.
Definition: E57Format.h:66
@ E57_STRUCTURE
StructureNode class.
Definition: E57Format.h:59
@ E57_VECTOR
VectorNode class.
Definition: E57Format.h:60
@ E57_INTEGER
IntegerNode class.
Definition: E57Format.h:62
@ E57_SCALED_INTEGER
ScaledIntegerNode class.
Definition: E57Format.h:63
@ E57_FLOAT
FloatNode class.
Definition: E57Format.h:64
@ E57_STRING
StringNode class.
Definition: E57Format.h:65
std::string toString(T x)
Definition: Common.h:80
std::vector< std::string > StringList
Definition: Common.h:193
#define isOpen(pFd)
Definition: sqlite3.c:52420