| OpenMesh

OMFormat.hh
1 /* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42
43
44
45 #ifndef OPENMESH_IO_OMFORMAT_HH
46 #define OPENMESH_IO_OMFORMAT_HH
47
48
49 //=== INCLUDES ================================================================
50
51 #include <OpenMesh/Core/System/config.h>
52 #include <OpenMesh/Core/System/omstream.hh>
53 #include <OpenMesh/Core/IO/SR_store.hh>
54 #include <OpenMesh/Core/Utils/GenProg.hh>
55 #include <OpenMesh/Core/Utils/Endian.hh>
56 #include <OpenMesh/Core/Utils/vector_traits.hh>
57 // --------------------
58 #include <iostream>
59 #if defined(OM_CC_GCC) && (OM_GCC_VERSION < 30000)
60 # include <OpenMesh/Tools/Utils/NumLimitsT.hh>
61 # define OM_MISSING_HEADER_LIMITS 1
62 #else
63 # include <limits>
64 #endif
65
66
67 //== NAMESPACES ==============================================================
68
69 #ifndef DOXY_IGNORE_THIS
70 namespace OpenMesh {
71 namespace IO {
72 namespace OMFormat {
73
74
75 //=== IMPLEMENTATION ==========================================================
76
77
81
82 //-----------------------------------------------------------------------------
83
84 // <:Header>
85 // <:Comment>
86 // Chunk 0
87 // <:ChunkHeader>
88 // <:Comment>
89 // data
90 // Chunk 1
91 // <:ChunkHeader>
92 // <:Comment>
93 // data
94 // .
95 // .
96 // .
97 // Chunk N
98
99 //
100 // NOTICE!
101 //
102 // The usage of data types who differ in size
103 // on different pc architectures (32/64 bit) and/or
104 // operating systems, e.g. (unsigned) long, size_t,
105 // is not recommended because of inconsistencies
106 // in case of cross writing and reading.
107 //
108 // Basic types that are supported are:
109
110
111 typedef unsigned char uchar;
112 typedef uint8_t uint8;
113 typedef uint16_t uint16;
114 typedef uint32_t uint32;
115 typedef uint64_t uint64;
116 typedef int8_t int8;
117 typedef int16_t int16;
118 typedef int32_t int32;
119 typedef int64_t int64;
120 typedef float32_t float32;
121 typedef float64_t float64;
122
123 struct Header
124 {
125 uchar magic_[2]; // OM
126 uchar mesh_; // [T]riangles, [Q]uads, [P]olygonals
127 uint8 version_;
128 uint32 n_vertices_;
129 uint32 n_faces_;
130 uint32 n_edges_;
131
132 size_t store( std::ostream& _os, bool _swap ) const
133 {
134 _os.write( (char*)this, 4); // magic_, mesh_, version_
135 size_t bytes = 4;
136 bytes += binary<uint32_t>::store( _os, n_vertices_, _swap );
137 bytes += binary<uint32_t>::store( _os, n_faces_, _swap );
138 bytes += binary<uint32_t>::store( _os, n_edges_, _swap );
139 return bytes;
140 }
141
142 size_t restore( std::istream& _is, bool _swap )
143 {
144 if (_is.read( (char*)this, 4 ).eof())
145 return 0;
146
147 size_t bytes = 4;
148 bytes += binary<uint32_t>::restore( _is, n_vertices_, _swap );
149 bytes += binary<uint32_t>::restore( _is, n_faces_, _swap );
150 bytes += binary<uint32_t>::restore( _is, n_edges_, _swap );
151 return bytes;
152 }
153
154 };
155
156 struct Chunk
157 {
158 // Hardcoded this size to an uint32 to make the system 32/64 bit compatible.
159 // Needs further investigation!
160 typedef uint32 esize_t; // element size, used for custom properties
161
162 enum Type {
163 Type_Pos = 0x00,
164 Type_Normal = 0x01,
165 Type_Texcoord = 0x02,
166 Type_Status = 0x03,
167 Type_Color = 0x04,
168 Type_Custom = 0x06,
169 Type_Topology = 0x07
170 };
171
172 enum Entity {
173 Entity_Vertex = 0x00,
174 Entity_Mesh = 0x01,
175 Entity_Face = 0x02,
176 Entity_Edge = 0x04,
177 Entity_Halfedge = 0x06,
178 Entity_Sentinel = 0x07
179 };
180
181 enum Dim {
182 Dim_1D = 0x00,
183 Dim_2D = 0x01,
184 Dim_3D = 0x02,
185 Dim_4D = 0x03,
186 Dim_5D = 0x04,
187 Dim_6D = 0x05,
188 Dim_7D = 0x06,
189 Dim_8D = 0x07
190 };
191
192 enum Integer_Size {
193 Integer_8 = 0x00, // 1 byte for (unsigned) char
194 Integer_16 = 0x01, // 2 bytes for short
195 Integer_32 = 0x02, // 4 bytes for long
196 Integer_64 = 0x03 // 8 bytes for long long
197 };
198
199 enum Float_Size {
200 Float_32 = 0x00, // 4 bytes for float
201 Float_64 = 0x01, // 8 bytes for double
202 Float_128 = 0x02 // 16 bytes for long double (an assumption!)
203 };
204
205 static const int SIZE_RESERVED = 1; // 1
206 static const int SIZE_NAME = 1; // 2
207 static const int SIZE_ENTITY = 3; // 5
208 static const int SIZE_TYPE = 4; // 9
209
210 static const int SIZE_SIGNED = 1; // 10
211 static const int SIZE_FLOAT = 1; // 11
212 static const int SIZE_DIM = 3; // 14
213 static const int SIZE_BITS = 2; // 16
214
215 static const int OFF_RESERVED = 0; // 0
216 static const int OFF_NAME = SIZE_RESERVED + OFF_RESERVED; // 2
217 static const int OFF_ENTITY = SIZE_NAME + OFF_NAME; // 3
218 static const int OFF_TYPE = SIZE_ENTITY + OFF_ENTITY; // 5
219 static const int OFF_SIGNED = SIZE_TYPE + OFF_TYPE; // 9
220 static const int OFF_FLOAT = SIZE_SIGNED + OFF_SIGNED; // 10
221 static const int OFF_DIM = SIZE_FLOAT + OFF_FLOAT; // 11
222 static const int OFF_BITS = SIZE_DIM + OFF_DIM; // 14
223
224 // !Attention! When changing the bit size, the operators
225 // << (uint16, Header) and << (Header, uint16) must be changed as well
226 //
227 // Entries signed_, float_, dim_, bits_ are not used when type_
228 // equals Type_Custom
229 //
230 struct Header // 16 bits long
231 {
232 unsigned reserved_: SIZE_RESERVED;
233 unsigned name_ : SIZE_NAME; // 1 named property, 0 anonymous
234 unsigned entity_ : SIZE_ENTITY; // 0 vertex, 1 mesh, 2 edge,
235 // 4 halfedge, 6 face
236 unsigned type_ : SIZE_TYPE; // 0 pos, 1 normal, 2 texcoord,
237 // 3 status, 4 color 6 custom 7 topology
238 unsigned signed_ : SIZE_SIGNED; // bool
239 unsigned float_ : SIZE_FLOAT; // bool
240 unsigned dim_ : SIZE_DIM; // 0 1D, 1 2D, 2 3D, .., 7 8D
241 unsigned bits_ : SIZE_BITS; // {8, 16, 32, 64} | {32, 64, 128}
242 // (integer) (float)
243 unsigned unused_ : 16; // fill up to 32 bits
244 }; // struct Header
245
246
247 class PropertyName : public std::string
248 {
249 public:
250
251 static const size_t size_max = 256;
252
253 PropertyName( ) { }
254
255 PropertyName( const std::string& _name ) { *this = _name; }
256
257 bool is_valid() const { return is_valid( size() ); }
258
259 static bool is_valid( size_t _s ) { return _s <= size_max; }
260
261 PropertyName& operator = ( const std::string& _rhs )
262 {
263 assert( is_valid( _rhs.size() ) );
264
265 if ( is_valid( _rhs.size() ) )
266 std::string::operator = ( _rhs );
267 else
268 {
269 omerr() << "Warning! Property name too long. Will be shortened!\n";
270 this->std::string::operator = ( _rhs.substr(0, size_max) );
271 }
272
273 return *this;
274 }
275
276 };
277
278 }; // Chunk
279
280 // ------------------------------------------------------------ Helper
281
282 // -------------------- get size information
283
285 inline size_t header_size(void) { return sizeof(Header); }
286
287
289 inline size_t chunk_header_size( void ) { return sizeof(uint16); }
290
291
293 inline size_t scalar_size( const Chunk::Header& _hdr )
294 {
295 return _hdr.float_ ? (0x01 << _hdr.bits_) : (0x04 << _hdr.bits_);
296 }
297
298
300 inline size_t dimensions(const Chunk::Header& _chdr) { return _chdr.dim_+1; }
301
302
304 inline size_t vector_size( const Chunk::Header& _chdr )
305 {
306 return dimensions(_chdr)*scalar_size(_chdr);
307 }
308
309
311 inline size_t chunk_data_size( Header& _hdr, Chunk::Header& _chunk_hdr )
312 {
313 size_t C;
314 switch( _chunk_hdr.entity_ )
315 {
316 case Chunk::Entity_Vertex: C = _hdr.n_vertices_; break;
317 case Chunk::Entity_Face: C = _hdr.n_faces_; break;
318 case Chunk::Entity_Halfedge: C = _hdr.n_edges_*2; break;
319 case Chunk::Entity_Edge: C = _hdr.n_edges_; break;
320 case Chunk::Entity_Mesh: C = 1; break;
321 default:
322 C = 0;
323 std::cerr << "Invalid value in _chunk_hdr.entity_\n";
324 assert( false );
325 break;
326 }
327
328 return C * vector_size( _chunk_hdr );
329 }
330
331 inline size_t chunk_size( Header& _hdr, Chunk::Header& _chunk_hdr )
332 {
333 return chunk_header_size() + chunk_data_size( _hdr, _chunk_hdr );
334 }
335
336 // -------------------- convert from Chunk::Header to storage type
337
338 uint16& operator << (uint16& val, const Chunk::Header& hdr);
339 Chunk::Header& operator << (Chunk::Header& hdr, const uint16 val);
340
341
342 // -------------------- type information
343
344 template <typename T> bool is_float(const T&)
345 {
346 #if defined(OM_MISSING_HEADER_LIMITS)
347 return !Utils::NumLimitsT<T>::is_integer();
348 #else
349 return !std::numeric_limits<T>::is_integer;
350 #endif
351 }
352
353 template <typename T> bool is_integer(const T)
354 {
355 #if defined(OM_MISSING_HEADER_LIMITS)
356 return Utils::NumLimitsT<T>::is_integer();
357 #else
358 return std::numeric_limits<T>::is_integer;
359 #endif
360 }
361
362 template <typename T> bool is_signed(const T&)
363 {
364 #if defined(OM_MISSING_HEADER_LIMITS)
365 return Utils::NumLimitsT<T>::is_signed();
366 #else
367 return std::numeric_limits<T>::is_signed;
368 #endif
369 }
370
371 // -------------------- conversions (format type <- type/value)
372
373 template <typename VecType>
374 inline
375 Chunk::Dim dim( VecType )
376 {
377 assert( vector_traits< VecType >::size() < 9 );
378 return static_cast<Chunk::Dim>(vector_traits< VecType >::size() - 1);
379 }
380
381 template <typename VecType>
382 inline
383 Chunk::Dim dim( const Chunk::Header& _hdr )
384 {
385 return static_cast<Chunk::Dim>( _hdr.dim_ );
386 }
387
388 // calc minimum (power-of-2) number of bits needed
389 Chunk::Integer_Size needed_bits( size_t s );
390
391 // Convert size of type to Integer_Size
392 #ifdef NDEBUG
393 template <typename T> Chunk::Integer_Size integer_size(const T&)
394 #else
395 template <typename T> Chunk::Integer_Size integer_size(const T& d)
396 #endif
397 {
398 #ifndef NDEBUG
399 assert( is_integer(d) );
400 #endif
401
402 switch( sizeof(T) )
403 {
404 case 1: return OMFormat::Chunk::Integer_8;
405 case 2: return OMFormat::Chunk::Integer_16;
406 case 4: return OMFormat::Chunk::Integer_32;
407 case 8: return OMFormat::Chunk::Integer_64;
408 default:
409 std::cerr << "Invalid value in integer_size\n";
410 assert( false );
411 break;
412 }
413 return Chunk::Integer_Size(0);
414 }
415
416
417 // Convert size of type to FLoat_Size
418 #ifdef NDEBUG
419 template <typename T> Chunk::Float_Size float_size(const T&)
420 #else
421 template <typename T> Chunk::Float_Size float_size(const T& d)
422 #endif
423 {
424 #ifndef NDEBUG
425 assert( is_float(d) );
426 #endif
427
428 switch( sizeof(T) )
429 {
430 case 4: return OMFormat::Chunk::Float_32;
431 case 8: return OMFormat::Chunk::Float_64;
432 case 16: return OMFormat::Chunk::Float_128;
433 default:
434 std::cerr << "Invalid value in float_size\n";
435 assert( false );
436 break;
437 }
438 return Chunk::Float_Size(0);
439 }
440
441 // Return the storage type (Chunk::Header::bits_)
442 template <typename T>
443 inline
444 unsigned int bits(const T& val)
445 {
446 return is_integer(val)
447 ? (static_cast<unsigned int>(integer_size(val)))
448 : (static_cast<unsigned int>(float_size(val)));
449 }
450
451 // -------------------- create/read version
452
453 inline uint8 mk_version(const uint16 major, const uint16 minor)
454 { return (major & 0x07) << 5 | (minor & 0x1f); }
455
456
457 inline uint16 major_version(const uint8 version)
458 { return (version >> 5) & 0x07; }
459
460
461 inline uint16 minor_version(const uint8 version)
462 { return (version & 0x001f); }
463
464
465 // ---------------------------------------- convenience functions
466
467 std::string as_string(uint8 version);
468
469 const char *as_string(Chunk::Type t);
470 const char *as_string(Chunk::Entity e);
471 const char *as_string(Chunk::Dim d);
472 const char *as_string(Chunk::Integer_Size d);
473 const char *as_string(Chunk::Float_Size d);
474
475 std::ostream& operator << ( std::ostream& _os, const Header& _h );
476 std::ostream& operator << ( std::ostream& _os, const Chunk::Header& _c );
477
479 } // namespace OMFormat
480
481 // -------------------- (re-)store header
482
483 template <> inline
484 size_t store( std::ostream& _os, const OMFormat::Header& _hdr, bool _swap)
485 { return _hdr.store( _os, _swap ); }
486
487 template <> inline
488 size_t restore( std::istream& _is, OMFormat::Header& _hdr, bool _swap )
489 { return _hdr.restore( _is, _swap ); }
490
491
492 // -------------------- (re-)store chunk header
493
494 template <> inline
495 size_t
496 store( std::ostream& _os, const OMFormat::Chunk::Header& _hdr, bool _swap)
497 {
498 OMFormat::uint16 val; val << _hdr;
499 return binary<uint16_t>::store( _os, val, _swap );
500 }
501
502 template <> inline
503 size_t
504 restore( std::istream& _is, OMFormat::Chunk::Header& _hdr, bool _swap )
505 {
506 OMFormat::uint16 val;
507 size_t bytes = binary<uint16_t>::restore( _is, val, _swap );
508
509 _hdr << val;
510
511 return bytes;
512 }
513
514 // -------------------- (re-)store integer with wanted number of bits (bytes)
515
516 typedef GenProg::TrueType t_signed;
517 typedef GenProg::FalseType t_unsigned;
518
519 // helper to store a an integer
520 template< typename T >
521 size_t
522 store( std::ostream& _os,
523 const T& _val,
524 OMFormat::Chunk::Integer_Size _b,
525 bool _swap,
526 t_signed);
527
528 // helper to store a an unsigned integer
529 template< typename T >
530 size_t
531 store( std::ostream& _os,
532 const T& _val,
533 OMFormat::Chunk::Integer_Size _b,
534 bool _swap,
535 t_unsigned);
536
538 template< typename T >
539 inline
540 size_t
541 store( std::ostream& _os,
542 const T& _val,
543 OMFormat::Chunk::Integer_Size _b,
544 bool _swap)
545 {
546 assert( OMFormat::is_integer( _val ) );
547
548 if ( OMFormat::is_signed( _val ) )
549 return store( _os, _val, _b, _swap, t_signed() );
550 return store( _os, _val, _b, _swap, t_unsigned() );
551 }
552
553 // helper to store a an integer
554 template< typename T > inline
555 size_t restore( std::istream& _is,
556 T& _val,
557 OMFormat::Chunk::Integer_Size _b,
558 bool _swap,
559 t_signed);
560
561 // helper to store a an unsigned integer
562 template< typename T > inline
563 size_t restore( std::istream& _is,
564 T& _val,
565 OMFormat::Chunk::Integer_Size _b,
566 bool _swap,
567 t_unsigned);
568
570 template< typename T >
571 inline
572 size_t
573 restore( std::istream& _is,
574 T& _val,
575 OMFormat::Chunk::Integer_Size _b,
576 bool _swap)
577 {
578 assert( OMFormat::is_integer( _val ) );
579
580 if ( OMFormat::is_signed( _val ) )
581 return restore( _is, _val, _b, _swap, t_signed() );
582 return restore( _is, _val, _b, _swap, t_unsigned() );
583 }
584
585
586 //
587 // ---------------------------------------- storing vectors
588 template <typename VecT> inline
589 size_t store( std::ostream& _os, const VecT& _vec, GenProg::Int2Type<2>,
590 bool _swap )
591 {
592 size_t bytes = store( _os, _vec[0], _swap );
593 bytes += store( _os, _vec[1], _swap );
594 return bytes;
595 }
596
597 template <typename VecT> inline
598 size_t store( std::ostream& _os, const VecT& _vec, GenProg::Int2Type<3>,
599 bool _swap )
600 {
601 size_t bytes = store( _os, _vec[0], _swap );
602 bytes += store( _os, _vec[1], _swap );
603 bytes += store( _os, _vec[2], _swap );
604 return bytes;
605 }
606
607 template <typename VecT> inline
608 size_t store( std::ostream& _os, const VecT& _vec, GenProg::Int2Type<4>,
609 bool _swap )
610 {
611 size_t bytes = store( _os, _vec[0], _swap );
612 bytes += store( _os, _vec[1], _swap );
613 bytes += store( _os, _vec[2], _swap );
614 bytes += store( _os, _vec[3], _swap );
615 return bytes;
616 }
617
618 template <typename VecT> inline
619 size_t store( std::ostream& _os, const VecT& _vec, GenProg::Int2Type<1>,
620 bool _swap )
621 {
622 return store( _os, _vec[0], _swap );
623 }
624
626 template <typename VecT> inline
627 size_t vector_store( std::ostream& _os, const VecT& _vec, bool _swap )
628 {
629 return store( _os, _vec,
630 GenProg::Int2Type< vector_traits<VecT>::size_ >(),
631 _swap );
632 }
633
634 // ---------------------------------------- restoring vectors
635 template <typename VecT>
636 inline
637 size_t
638 restore( std::istream& _is, VecT& _vec, GenProg::Int2Type<2>,
639 bool _swap )
640 {
641 size_t bytes = restore( _is, _vec[0], _swap );
642 bytes += restore( _is, _vec[1], _swap );
643 return bytes;
644 }
645
646 template <typename VecT>
647 inline
648 size_t
649 restore( std::istream& _is, VecT& _vec, GenProg::Int2Type<3>,
650 bool _swap )
651 {
652 typedef typename vector_traits<VecT>::value_type scalar_type;
653 size_t bytes;
654
655 bytes = binary<scalar_type>::restore( _is, _vec[0], _swap );
656 bytes += binary<scalar_type>::restore( _is, _vec[1], _swap );
657 bytes += binary<scalar_type>::restore( _is, _vec[2], _swap );
658 return bytes;
659 }
660
661 template <typename VecT>
662 inline
663 size_t
664 restore( std::istream& _is, VecT& _vec, GenProg::Int2Type<4>,
665 bool _swap )
666 {
667 typedef typename vector_traits<VecT>::value_type scalar_type;
668 size_t bytes;
669
670 bytes = binary<scalar_type>::restore( _is, _vec[0], _swap );
671 bytes += binary<scalar_type>::restore( _is, _vec[1], _swap );
672 bytes += binary<scalar_type>::restore( _is, _vec[2], _swap );
673 bytes += binary<scalar_type>::restore( _is, _vec[3], _swap );
674 return bytes;
675 }
676
677 template <typename VecT>
678 inline
679 size_t
680 restore( std::istream& _is, VecT& _vec, GenProg::Int2Type<1>,
681 bool _swap )
682 {
683 return restore( _is, _vec[0], _swap );
684 }
685
687 template <typename VecT>
688 inline
689 size_t
690 vector_restore( std::istream& _is, VecT& _vec, bool _swap )
691 {
692 return restore( _is, _vec,
693 GenProg::Int2Type< vector_traits<VecT>::size_ >(),
694 _swap );
695 }
696
697
698 // ---------------------------------------- storing property names
699
700 template <>
701 inline
702 size_t store( std::ostream& _os, const OMFormat::Chunk::PropertyName& _pn,
703 bool _swap )
704 {
705 store( _os, _pn.size(), OMFormat::Chunk::Integer_8, _swap ); // 1 byte
706 if ( _pn.size() )
707 _os.write( _pn.c_str(), _pn.size() ); // size bytes
708 return _pn.size() + 1;
709 }
710
711 template <>
712 inline
713 size_t restore( std::istream& _is, OMFormat::Chunk::PropertyName& _pn,
714 bool _swap )
715 {
716 size_t size;
717
718 restore( _is, size, OMFormat::Chunk::Integer_8, _swap); // 1 byte
719
720 assert( OMFormat::Chunk::PropertyName::is_valid( size ) );
721
722 if ( size > 0 )
723 {
724 char buf[256];
725 _is.read( buf, size ); // size bytes
726 buf[size] = '\0';
727 _pn.resize(size);
728 _pn = buf;
729 }
730 return size+1;
731 }
732
733 //=============================================================================
734 } // namespace IO
735 } // namespace OpenMesh
736 #endif
737 //=============================================================================
738 #if defined(OM_MISSING_HEADER_LIMITS)
739 # undef OM_MISSING_HEADER_LIMITS
740 #endif
741 //=============================================================================
742 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_IO_OMFORMAT_CC)
743 # define OPENMESH_IO_OMFORMAT_TEMPLATES
744 # include "OMFormatT_impl.hh"
745 #endif
746 //=============================================================================
747 #endif
748 //=============================================================================
NumLimitsT.hh
Temporary solution until std::numeric_limits is standard.
OpenMesh::operator<<
auto operator<<(std::ostream &os, const VectorT< Scalar, DIM > &_vec) -> typename std::enable_if< sizeof(decltype(os<< _vec[0])) >=0
output a vector by printing its space-separated compontens
OpenMesh::IO::float64_t
double float64_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:93
OpenMesh::IO::int16_t
short int16_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:81
OpenMesh::IO::int32_t
int int32_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:85
OpenMesh::IO::float32_t
float float32_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:92
OpenMesh::IO::uint8_t
unsigned char uint8_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:80
OpenMesh::IO::uint32_t
unsigned int uint32_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:85
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
OpenMesh::IO::uint64_t
unsigned long long uint64_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:89
OpenMesh::IO::int64_t
long long int64_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:89
OpenMesh::vector_traits::size
static size_t size()
size/dimension of the vector
Definition: vector_traits.hh:100
OpenMesh::IO::uchar
unsigned char uchar
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:76
OpenMesh::vector_traits::value_type
T::value_type value_type
Type of the scalar value.
Definition: vector_traits.hh:94
omstream.hh
This file provides the streams omlog, omout, and omerr.
OpenMesh::vector_traits::size_
static const size_t size_
size/dimension of the vector
Definition: vector_traits.hh:97
OpenMesh::IO::uint16_t
unsigned short uint16_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:81
OpenMesh::IO::int8_t
signed char int8_t
Binary read a short from _is and perform byte swapping if _swap is true.
Definition: SR_types.hh:80