QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_archive.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(ON_ARCHIVE_INC_)
17#define ON_ARCHIVE_INC_
18
19
20#if defined(ON_COMPILER_MSC)
21
22extern "C"
23{
24
25/*
26Description:
27 ON_DebugWriteObject is a debugging utility that can be called
28 from a debugger's evaluate expression window to dump objects
29 for future inspection.
30Parameters:
31 pObject - [in]
32Returns:
33 If successful, and integer >= N which indicates the object
34 was saved in a file named /debug_file_0000N.3dm.
35See Also:
36 ON_DebugWritePoint
37*/
39int ON_DebugWriteObject( const class ON_Object* pObject );
40
41/*
42Description:
43 ON_DebugWrite3dPoint is a debugging utility that can be called
44 from a debugger's evaluate expression window to dump points
45 for future inspection.
46Parameters:
47 p3dPoint - [in]
48Returns:
49 If successful, and integer >= N which indicates the object
50 was saved in a file named /debug_file_0000N.3dm.
51See Also:
52 ON_DebugWriteObject
53*/
55int ON_DebugWritePoint( const class ON_3dPoint* p3dPoint );
56
57}
58
59#endif
60
62//
63// ON_BinaryArchive
64// virtual class for CPU independent serialization
65//
66// ON_BinaryFile
67// simple class for CPU independent binary file I/O
68// includes optional CRC support
69//
70
71class ON_Object;
72class ON_Group;
73class ON_Font;
74class ON_DimStyle;
75class ON_Arc;
76class ON_ObjectAttributes;
78class ON_HatchPattern;
79class ON_Linetype;
80
82{
83 size_t m_offset; // In read or write_using_fseek mode, this is the
84 // file position of first byte after chunk's length.
85 // In write_using_buffer mode, this of the m_buffer[]
86 // position of first byte after chunk's length.
87 unsigned int m_typecode;
89 int m_do_length; // true if chunk is a long chunk with length
90 ON__UINT16 m_do_crc16; // 16 bit CRC using CCITT polynomial
92 ON__UINT32 m_do_crc32; // 32 bit CRC
94};
95
97{
98 ON__UINT64 m_big_offset; // In read or write_using_fseek mode, this is the
99 // file position of first byte after chunk's length.
100 // In write_using_buffer mode, this of the m_buffer[]
101 // position of first byte after chunk's length.
102
103 ON__UINT64 Length() const; // 0 for short chunks
104
107
108 ON__UINT8 m_bLongChunk; // true if chunk is a long chunk and m_big_value is a length.
112
113 // CRC settings
114 ON__UINT8 m_do_crc16; // true (1) if we are calculating 16 bit CRC
115 ON__UINT8 m_do_crc32; // true (1) if we are calculating 32 bit CRC
116 ON__UINT16 m_crc16; // current 16 bit CRC value
117 ON__UINT32 m_crc32; // current 32 bit CRC value
118};
119
121
123
124#if defined(ON_DLL_TEMPLATE)
125// This stuff is here because of a limitation in the way Microsoft
126// handles templates and DLLs. See Microsoft's knowledge base
127// article ID Q168958 for details.
128#pragma warning( push )
129#pragma warning( disable : 4231 )
130ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_3DM_CHUNK>;
131ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_3DM_BIG_CHUNK>;
132#pragma warning( pop )
133#endif
134
135class ON_Light;
136class ON_Bitmap;
138class ON_Material;
139class ON_Layer;
140class ON_3dmProperties;
141class ON_3dmSettings;
143class ON_3dmGoo;
144
145class ON_BinaryArchive;
146
147// Used int ON_3dmProperties::Read() to set ON_BinaryArchive.m_3dm_opennurbs_version
148// Do not call directly.
150
151class ON_CLASS ON_BinaryArchive // use for generic serialization of binary data
152{
153public:
154 ON_BinaryArchive( ON::archive_mode );
155 virtual ~ON_BinaryArchive();
156
157 virtual
158 size_t CurrentPosition( // current offset (in bytes) into archive ( like ftell() )
159 ) const = 0;
160 virtual
161 bool SeekFromCurrentPosition( // seek from current position ( like fseek( ,SEEK_CUR) )
162 int // byte offset ( >= -CurrentPostion() )
163 ) = 0;
164 virtual
165 bool SeekFromStart( // seek from current position ( like fseek( ,SEEK_SET) )
166 size_t // byte offset ( >= 0 )
167 ) = 0;
168 virtual
169 bool AtEnd() const = 0; // true if at end of file
170
171 bool BigSeekFromStart( ON__UINT64 offset );
172 bool BigSeekForward( ON__UINT64 offset );
173 bool BigSeekBackward( ON__UINT64 offset );
174 bool BigSeekFromCurrentPosition( ON__INT64 offset );
175
176 /*
177 Description:
178 Tool for swapping bytes when doing I/O on
179 using big endian CPUs.
180 Remarks:
181 3dm files are always saved with little endian byte order.
182 See Also:
183 ON_BinaryArchive::Endian
184 */
185 static
186 bool ToggleByteOrder(
187 int, // number of elements
188 int, // size of element (2,4, or 8)
189 const void*, // source buffer
190 void* // destination buffer (can be same a source buffer)
191 );
192
193 static
194 const char* TypecodeName( unsigned int tcode );
195
196 static
197 char* ON_TypecodeParse( unsigned int tcode, char* typecode_name, size_t max_length );
198
199 bool ReadMode() const; // true if reading is permitted
200 bool WriteMode() const; // true if writing is permitted
201
202 /*
203 Returns:
204 Endian-ness of the cpu reading this file.
205 Remarks:
206 3dm files are alwasy saved with little endian byte order.
207 */
208 ON::endian Endian() const; // endian-ness of cpu
209
210 int BadCRCCount() const; // number of chunks read with bad CRC
211
212 bool ReadByte( size_t, void* ); // must fail if mode is not read or readwrite
213
214 bool WriteByte( size_t, const void* ); // must fail if mode is not write or readwrite
215
216 /*
217 Description:
218 Expert user function that uses Read() to load a buffer.
219 Paramters:
220 sizeof_buffer - [in] number of bytes to attempt to read.
221 buffer - [out] read bytes are stored in this buffer
222 Returns:
223 Number of bytes actually read, which may be less than
224 sizeof_buffer if the end of file is encountered.
225 */
226 ON__UINT64 ReadBuffer( ON__UINT64 sizeof_buffer, void* buffer );
227
228 /*
229 Description:
230 Expert user function to control CRC calculation while reading and writing.
231 Typically this is used when seeking around and reading/writing information
232 in non-serial order.
233 Parameters:
234 bEnable - [in]
235 Returns:
236 Current state of CRC calculation. Use the returned value to restore the
237 CRC calculation setting after you are finished doing your fancy pants
238 expert IO.
239 */
240 bool EnableCRCCalculation( bool bEnable );
241
242 // ReadCompressedBuffer()/WriteCompressedBuffer() use zlib 1.1.3
243 // to inflate/deflate the data buffer.
244 // Care must be used to get an endian independent file.
245 // See ON_Mesh::Read()/ON_Mesh::Write() for an example of an endian
246 // independent use of compression. See also ToggleByteOrder() and Endian().
247 //
248 // To read data archived by WriteCompressedBuffer( sizeof_buffer, buffer )
249 // do something like:
250 //
251 // size_t sizeof_buffer = 0;
252 // ReadCompressedBufferSize(&sizeof_buffer);
253 // buffer = something with sizeof_buffer bytes.
254 // int bFailedCRC = false;
255 // bool ok = ReadCompressedBuffer( sizeof_buffer, buffer, &bFailedCRC );
256 //
257
258
259 /*
260 Description:
261 Red the size of a compressed buffer.
262 Parameters:
263 sizeof__outbuffer - [out] size of the uncompressed buffer in bytes
264 Returns:
265 True if read was successful.
266 */
267 bool ReadCompressedBufferSize( size_t* sizeof__outbuffer );
268
269 /*
270 Description:
271 Read compressed information from an archive and uncompress it.
272 Parameters:
273 sizeof__outbuffer - [in] size of the uncompressed buffer in bytes
274 outbuffer - [out] uncompressed buffer returned here
275 bFailedCRC - [out] true if cyclic redundancy check fails
276 on uncompressed buffer
277
278 Example:
279
280 size_t sizeof_buffer = 0;
281 ReadCompressedBufferSize(&sizeof_buffer);
282 buffer = ...; // something with sizeof_buffer bytes.
283 int bFailedCRC = false;
284 bool ok = ReadCompressedBuffer( sizeof_buffer, buffer, &bFailedCRC );
285
286 Returns:
287 True if read was successful. You need to check the value
288 of bFailedCRC to see if the information that was read is valid.
289 */
290 bool ReadCompressedBuffer(
291 size_t sizeof__outbuffer,
292 void* outbuffer,
293 int* bFailedCRC
294 );
295
296 /*
297 Description:
298 Compress buffer and write the compressed information to the archive.
299 Parameters:
300 sizeof__inbuffer - [in] size of the uncompressed buffer in bytes
301 inbuffer - [in] uncompressed buffer
302 Returns:
303 True if write was successful.
304 */
305 bool WriteCompressedBuffer(
306 size_t sizeof__inbuffer,
307 const void* inbuffer
308 );
309
310 bool ReadBool( bool* );
311
312 bool ReadChar( // Read an array of 8 bit chars
313 size_t, // number of chars to read
314 char*
315 );
316 bool ReadChar( // Read an array of 8 bit unsigned chars
317 size_t, // number of unsigned chars to read
318 unsigned char*
319 );
320 bool ReadChar( // Read a single 8 bit char
321 char*
322 );
323 bool ReadChar( // Read a single 8 bit unsigned char
324 unsigned char*
325 );
326
327 bool ReadShort( // Read an array of 16 bit shorts
328 size_t, // number of shorts to read
329 short*
330 );
331 bool ReadShort( // Read an array of 16 bit unsigned shorts
332 size_t, // number of shorts to read
333 unsigned short*
334 );
335 bool ReadShort( // Read a single 16 bit short
336 short*
337 );
338 bool ReadShort( // Read a single 16 bit unsigned short
339 unsigned short*
340 );
341
342 bool ReadInt( // Read an array of 32 bit integers
343 size_t, // number of ints to read
344 int*
345 );
346 bool ReadInt( // Read an array of 32 bit integers
347 size_t, // number of ints to read
348 unsigned int*
349 );
350 bool ReadInt( // Read a single 32 bit integer
351 int*
352 );
353 bool ReadInt( // Read a single 32 bit unsigned integer
354 unsigned int*
355 );
356
357 bool ReadLong( // Read an array of 32 bit integers
358 size_t, // number of ints to read
359 long*
360 );
361 bool ReadLong( // Read an array of 32 bit integers
362 size_t, // number of ints to read
363 unsigned long*
364 );
365 bool ReadLong( // Read a single 32 bit integer
366 long*
367 );
368 bool ReadLong( // Read a single 32 bit unsigned integer
369 unsigned long*
370 );
371 bool ReadSize( // Read a single size_t
372 size_t*
373 );
374
375 bool ReadBigSize( size_t* ); // 64 bits
376
377 bool ReadBigTime( time_t* ); // UCT seconds since 1 January 1970 (64 bits)
378
379
380 bool ReadFloat( // Read an array of floats
381 size_t, // number of floats
382 float*
383 );
384 bool ReadFloat( // Read a single float
385 float*
386 );
387 bool ReadDouble( // Read an array of IEEE doubles
388 size_t, // number of doubles
389 double*
390 );
391 bool ReadDouble( // Read a single double
392 double*
393 );
394
395 bool ReadColor(
396 ON_Color&
397 );
398
399 bool ReadPoint (
401 );
402 bool ReadPoint (
404 );
405 bool ReadPoint (
407 );
408 bool ReadVector (
410 );
411 bool ReadVector (
413 );
414
415 bool ReadBoundingBox(ON_BoundingBox&);
416
417 bool ReadXform(ON_Xform&);
418
419 bool ReadPlaneEquation(ON_PlaneEquation&);
420
421 bool ReadPlane(ON_Plane&);
422
423 bool ReadLine(ON_Line&);
424
425 bool ReadArc(ON_Arc&);
426
427 bool ReadCircle(ON_Circle&);
428
429 bool ReadInterval( ON_Interval& );
430
431 bool ReadUuid( ON_UUID& );
432
433 bool ReadDisplayMaterialRef( ON_DisplayMaterialRef& );
434
435 bool ReadLinetypeSegment( ON_LinetypeSegment& );
436
437 // All times are stored in coordinated universal time
438 // ( a.k.a GMT, UTC ). Use ANSI C time() and gmtime() calls.
439 bool ReadTime( struct tm& );
440
441 bool ReadStringSize( // Read size of NULL terminated string
442 size_t* // (returned size includes NULL terminator)
443 );
444 bool ReadString( // Read NULL terminated string
445 size_t, // length = value from ReadStringSize()
446 char* // array[length]
447 );
448 bool ReadString( // Read NULL terminated string
449 size_t, // length = value from ReadStringSize()
450 unsigned char* // array[length]
451 );
452 bool ReadString( // Read NULL terminated wide (unicode) string
453 size_t, // length = value from ReadStringSize()
454 unsigned short* // array[length]
455 );
456 bool ReadString( ON_String& );
457 bool ReadString( ON_wString& );
458
459 bool ReadComponentIndex( ON_COMPONENT_INDEX& );
460
461 bool ReadArray( ON_SimpleArray<bool>& );
462 bool ReadArray( ON_SimpleArray<char>& );
463 bool ReadArray( ON_SimpleArray<short>& );
464 bool ReadArray( ON_SimpleArray<int>& );
465 bool ReadArray( ON_SimpleArray<float>& );
466 bool ReadArray( ON_SimpleArray<double>& );
467 bool ReadArray( ON_SimpleArray<ON_Color>& );
468 bool ReadArray( ON_SimpleArray<ON_2dPoint>& );
469 bool ReadArray( ON_SimpleArray<ON_3dPoint>& );
470 bool ReadArray( ON_SimpleArray<ON_4dPoint>& );
471 bool ReadArray( ON_SimpleArray<ON_2dVector>& );
472 bool ReadArray( ON_SimpleArray<ON_3dVector>& );
473 bool ReadArray( ON_SimpleArray<ON_Xform>& );
474 bool ReadArray( ON_SimpleArray<ON_2fPoint>& );
475 bool ReadArray( ON_SimpleArray<ON_3fPoint>& );
476 bool ReadArray( ON_SimpleArray<ON_4fPoint>& );
477 bool ReadArray( ON_SimpleArray<ON_2fVector>& );
478 bool ReadArray( ON_SimpleArray<ON_3fVector>& );
479 bool ReadArray( ON_SimpleArray<ON_UUID>& );
480 bool ReadArray( ON_SimpleArray<ON_UuidIndex>& );
481 bool ReadArray( ON_SimpleArray<ON_SurfaceCurvature>& );
482 bool ReadArray( ON_ClassArray<ON_String>& );
483 bool ReadArray( ON_ClassArray<ON_wString>& );
484 bool ReadArray( ON_SimpleArray<ON_DisplayMaterialRef>& );
485 bool ReadArray( ON_SimpleArray<ON_LinetypeSegment>& );
486 bool ReadArray( ON_SimpleArray<ON_MappingChannel>& );
487 bool ReadArray( ON_ClassArray<ON_MaterialRef>& );
488 bool ReadArray( ON_ClassArray<ON_MappingRef>& );
489 bool ReadArray( ON_ClassArray<class ON_ObjRef>& );
491
492 bool WriteBool( bool );
493
494 bool WriteChar( // Write an array of 8 bit chars
495 size_t, // number of chars to write
496 const char*
497 );
498 bool WriteChar( // Write an array of 8 bit unsigned chars
499 size_t, // number of unsigned chars to write
500 const unsigned char*
501 );
502 bool WriteChar( // Write a single 8 bit char
503 char
504 );
505 bool WriteChar( // Write a single 8 bit unsigned char
506 unsigned char
507 );
508
509 bool WriteShort( // Write an array of 16 bit shorts
510 size_t, // number of shorts to write
511 const short*
512 );
513 bool WriteShort( // Write an array of 16 bit unsigned shorts
514 size_t, // number of shorts to write
515 const unsigned short*
516 );
517 bool WriteShort( // Write a single 16 bit short
518 short
519 );
520 bool WriteShort( // Write a single 16 bit unsigned short
521 unsigned short
522 );
523
524 bool WriteInt( // Write an array of 32 bit integers
525 size_t, // number of ints to write
526 const int*
527 );
528 bool WriteInt( // Write an array of 32 bit integers
529 size_t, // number of ints to write
530 const unsigned int*
531 );
532 bool WriteInt( // Write a single 32 bit integer
533 int
534 );
535 bool WriteInt( // Write a single 32 bit unsigned integer
536 unsigned int
537 );
538
539 bool WriteLong( // Write an array of 32 bit integers
540 size_t, // number of ints to write
541 const long*
542 );
543 bool WriteLong( // Write an array of 32 bit integers
544 size_t, // number of ints to write
545 const unsigned long*
546 );
547 bool WriteLong( // Write a single 32 bit integer
548 long
549 );
550 bool WriteLong( // Write a single 32 bit unsigned integer
551 unsigned long
552 );
553 bool WriteSize( // Write a single size_t
554 size_t
555 );
556
557 bool WriteBigSize( size_t ); // 64 bits
558
559 bool WriteBigTime( time_t ); // UCT seconds since 1 January 1970 (64 bits)
560
561 bool WriteFloat( // Write a number of IEEE floats
562 size_t, // number of doubles
563 const float*
564 );
565 bool WriteFloat( // Write a single float
566 float
567 );
568 bool WriteDouble( // Write a single double
569 size_t,
570 const double*
571 );
572 bool WriteDouble( // Write a single double
573 double
574 );
575
576 bool WriteColor (
577 const ON_Color&
578 );
579
580 bool WritePoint (
581 const ON_2dPoint&
582 );
583 bool WritePoint (
584 const ON_3dPoint&
585 );
586 bool WritePoint (
587 const ON_4dPoint&
588 );
589 bool WriteVector (
590 const ON_2dVector&
591 );
592 bool WriteVector (
593 const ON_3dVector&
594 );
595
596 bool WriteBoundingBox(const ON_BoundingBox&);
597
598 bool WriteXform(const ON_Xform&);
599
600 bool WritePlaneEquation(const ON_PlaneEquation&);
601
602 bool WritePlane(const ON_Plane&);
603
604 bool WriteLine(const ON_Line&);
605
606 bool WriteArc(const ON_Arc&);
607
608 bool WriteCircle(const ON_Circle&);
609
610 bool WriteInterval( const ON_Interval& );
611
612 bool WriteUuid( const ON_UUID& );
613
614 bool WriteDisplayMaterialRef( const ON_DisplayMaterialRef& );
615
616 bool WriteLinetypeSegment( const ON_LinetypeSegment& );
617
618 // All times are stored in universal coordinated time
619 // ( a.k.a GMT, UCT ). Use ANSI C time() and gmtime() calls.
620 bool WriteTime( const struct tm& );
621
622 // To read strings written with WriteString(), first call
623 // ReadStringLength() to get the length of the string (including
624 // the NULL terminator, then call ReadString() with enought memory
625 // to load the string.
626 bool WriteString( // Write NULL terminated string
627 const char*
628 );
629 bool WriteString( // Write NULL terminated string
630 const unsigned char*
631 );
632 bool WriteString( // Write NULL terminated wide (unicode) string
633 const unsigned short* // array[length]
634 );
635 bool WriteString( const ON_String& );
636 bool WriteString( const ON_wString& );
637
638 bool WriteComponentIndex( const ON_COMPONENT_INDEX& );
639
640 bool WriteArray( const ON_SimpleArray<bool>& );
641 bool WriteArray( const ON_SimpleArray<char>& );
642 bool WriteArray( const ON_SimpleArray<short>& );
643 bool WriteArray( const ON_SimpleArray<int>& );
644 bool WriteArray( const ON_SimpleArray<float>& );
645 bool WriteArray( const ON_SimpleArray<double>& );
646
647 bool WriteArray( const ON_SimpleArray<ON_Color>& );
648
649 bool WriteArray( const ON_SimpleArray<ON_2dPoint>& );
650 bool WriteArray( const ON_SimpleArray<ON_3dPoint>& );
651 bool WriteArray( const ON_SimpleArray<ON_4dPoint>& );
652 bool WriteArray( const ON_SimpleArray<ON_2dVector>& );
653 bool WriteArray( const ON_SimpleArray<ON_3dVector>& );
654
655 bool WriteArray( const ON_SimpleArray<ON_2fPoint>& );
656 bool WriteArray( const ON_SimpleArray<ON_3fPoint>& );
657 bool WriteArray( const ON_SimpleArray<ON_4fPoint>& );
658 bool WriteArray( const ON_SimpleArray<ON_2fVector>& );
659 bool WriteArray( const ON_SimpleArray<ON_3fVector>& );
660 bool WriteArray( const ON_SimpleArray<ON_Xform>& );
661 bool WriteArray( const ON_SimpleArray<ON_UUID>& );
662 bool WriteArray( const ON_SimpleArray<ON_UuidIndex>& );
663 bool WriteArray( const ON_SimpleArray<ON_SurfaceCurvature>& );
664 bool WriteArray( const ON_ClassArray<ON_String>& );
665 bool WriteArray( const ON_ClassArray<ON_wString>& );
666 bool WriteArray( const ON_SimpleArray<ON_DisplayMaterialRef>& );
667 bool WriteArray( const ON_SimpleArray<ON_LinetypeSegment>& );
668 bool WriteArray( const ON_SimpleArray<ON_MappingChannel>& );
669 bool WriteArray( const ON_ClassArray<ON_MaterialRef>& );
670 bool WriteArray( const ON_ClassArray<ON_MappingRef>& );
671 bool WriteArray( const ON_ClassArray<class ON_ObjRef>& );
672 bool WriteArray( const ON_SimpleArray<class ON_ObjRef_IRefID>& );
673
675 //
676 // Read/Write classes derived from ON_Object
677 //
678
679 /*
680 Description:
681 Reads and object from a 3dm archive;
682 Parameters:
683 ppObject - [out] object is allocated and a pointer to the
684 allocated object is returned as *ppObject;
685 Returns:
686 0: failure - unable to read object because of file IO problems
687 1: success
688 3: unable to read object because it's UUID is not registered
689 this could happen in cases where old code is attempting to read
690 new objects.
691 */
692 int ReadObject(
693 ON_Object** ppObject
694 );
695
696
697 /*
698 Description:
699 Reads and object from a 3dm archive.
700 Parameters:
701 object - [in] The value of object.ON_ClassId()->Uuid() must
702 exactly match the class uuid in of the next
703 object in the archive.
704 Returns:
705 0: failure - unable to read object because of file IO problems.
706 1: success
707 2: unable to read object because the class id in the archive
708 did not match pObject->ClassId.
709 */
710 int ReadObject(
711 ON_Object& object
712 );
713
714 bool WriteObject( const ON_Object* ); // writes object definition
715 bool WriteObject( const ON_Object& ); // writes object definition
716
717
720 //
721 // 3DM Interface - ignore if not reading/writing a 3DM file
722 // this is here so that the infrastructure
723 // for writing 3dm archives is available for
724 // any type of serialization device.
725 //
726 bool EnableSave3dmRenderMeshes( ON_BOOL32 = true ); // returns previous state
727 bool Save3dmRenderMeshes() const;
728
729 bool EnableSave3dmAnalysisMeshes( ON_BOOL32 = true ); // returns previous state
730 bool Save3dmAnalysisMeshes() const;
731
732 bool EnableSaveUserData( ON_BOOL32 = true ); // returns previous state
733 bool SaveUserData() const;
734
736 // Step 1: REQUIRED - Write/Read Start Section
737 //
738 bool Write3dmStartSection(
739 int, // version = 1, 2, 3, 4, or 5
740 const char* // NULL or ASCII string with application name, etc.
741 // This information is primarily used when debugging files
742 // that contain problems. McNeel and Associates stores
743 // application name, application version, compile date,
744 // OS in use when file was written.
745 );
746 bool Read3dmStartSection(
747 int*, // returns version (1 - 5)
748 ON_String&
749 );
750
752 // Step 2: REQUIRED - Write/Read properties table
753 //
754 bool Write3dmProperties(
755 const ON_3dmProperties&
756 );
757 bool Read3dmProperties(
759 );
760
762 // Step 3: REQUIRED - Write/Read settings table
763 //
764 bool Write3dmSettings(
765 const ON_3dmSettings&
766 );
767 bool Read3dmSettings(
769 );
770
772 // Step 4: REQUIRED - Write/Read bitmap table (it can be empty)
773 //
774 bool BeginWrite3dmBitmapTable();
775 bool Write3dmBitmap( const ON_Bitmap& );
776 bool EndWrite3dmBitmapTable();
777
778 bool BeginRead3dmBitmapTable();
779 int Read3dmBitmap( // returns 0 at end of light table
780 // 1 bitmap successfully read
781 ON_Bitmap** // bitmap returned here
782 );
783 bool EndRead3dmBitmapTable();
784
786 // Step 5: REQUIRED - Write/Read render material table (it can be empty)
787 //
788 bool BeginWrite3dmTextureMappingTable();
789 bool Write3dmTextureMapping( const ON_TextureMapping& );
790 bool EndWrite3dmTextureMappingTable();
791
792 bool BeginRead3dmTextureMappingTable();
793 int Read3dmTextureMapping( // returns 0 at end of table
794 ON_TextureMapping** // layer returned here
795 );
796 bool EndRead3dmTextureMappingTable();
797
799 // Step 6: REQUIRED - Write/Read render material table (it can be empty)
800 //
801 bool BeginWrite3dmMaterialTable();
802 bool Write3dmMaterial( const ON_Material& );
803 bool EndWrite3dmMaterialTable();
804
805 bool BeginRead3dmMaterialTable();
806 int Read3dmMaterial( // returns 0 at end of table
807 ON_Material** // layer returned here
808 );
809 bool EndRead3dmMaterialTable();
810
812 // Step 7: REQUIRED - Write/Read linetype table (it can be empty)
813 //
814 bool BeginWrite3dmLinetypeTable();
815 bool Write3dmLinetype( const ON_Linetype&);
816 bool EndWrite3dmLinetypeTable();
817
818 bool BeginRead3dmLinetypeTable();
819 int Read3dmLinetype(ON_Linetype**);
820 bool EndRead3dmLinetypeTable();
821
823 // Step 8: REQUIRED - Write/Read layer table (it can be empty)
824 //
825 bool BeginWrite3dmLayerTable();
826 bool Write3dmLayer( const ON_Layer& );
827 bool EndWrite3dmLayerTable();
828
829 bool BeginRead3dmLayerTable();
830 int Read3dmLayer( // returns 0 at end of table
831 ON_Layer** // layer returned here
832 );
833 bool EndRead3dmLayerTable();
834
836 // Step 9: REQUIRED - Write/Read group table (it can be empty)
837 //
838 bool BeginWrite3dmGroupTable();
839 bool Write3dmGroup( const ON_Group& );
840 bool EndWrite3dmGroupTable();
841
842 bool BeginRead3dmGroupTable();
843
844 // Description:
845 // Reads groups from group table. If the group definition is
846 // read, a group is created by calling new ON_Group(),
847 // initialized with values stored in the archive, and
848 // returned.
849 //
850 // Parameters:
851 // ppGroup - If the group definition is
852 // read, a group is created by calling new ON_Group(),
853 // initialized with values stored in the archive, and
854 // a pointer to the new group is returned in *ppGroup.
855 //
856 // Returns:
857 //
858 // @untitled table
859 // 0 at the end of the group table
860 // 1 group definition was successfully read
861 // -1 archive is corrupt at this point
862 //
863 // Example:
864 // Calls to Read3dmGroup need to be bracketed by calls
865 // to BeginRead3dmGroupTable() / EndRead3dmGroupTable().
866 //
867 // archive.BeginRead3dmGroupTable();
868 // ON_Group* pGroup;
869 // int rc = 1;
870 // while(rc==1)
871 // { //
872 // pGroup = 0;
873 // archive.Read3dmGroup(&pGroup);
874 // if ( pGroup )
875 // do something with pGroup
876 // } //
877 // archive.EndRead3dmGroupTable();
878 //
879 int Read3dmGroup(
880 ON_Group** // ppGroup
881 );
882
883 bool EndRead3dmGroupTable();
884
885
887 // Step 10: REQUIRED - Write/Read font table (it can be empty)
888 //
889 bool BeginWrite3dmFontTable();
890 bool Write3dmFont( const ON_Font& );
891 bool EndWrite3dmFontTable();
892
893 bool BeginRead3dmFontTable();
894
895 // Description:
896 // Reads fonts from font table. If the font definition is
897 // read, a font is created by calling new ON_Font(),
898 // initialized with values stored in the archive, and
899 // returned.
900 //
901 // Parameters:
902 // ppFont - If the font definition is
903 // read, a font is created by calling new ON_Font(),
904 // initialized with values stored in the archive, and
905 // a pointer to the new font is returned in *ppFont.
906 //
907 // Returns:
908 //
909 // @untitled table
910 // 0 at the end of the font table
911 // 1 font definition was successfully read
912 // -1 archive is corrupt at this point
913 //
914 // Example:
915 // Calls to Read3dmFont need to be bracketed by calls
916 // to BeginRead3dmFontTable() / EndRead3dmFontTable().
917 //
918 // archive.BeginRead3dmFontTable();
919 // int rc = 1;
920 // ON_Font* pFont;
921 // while(rc==1)
922 // { //
923 // pFont = 0;
924 // archive.Read3dmFont(&pFont);
925 // if ( pFont )
926 // do something with pFont
927 // } //
928 // archive.EndRead3dmFontTable();
929 //
930 int Read3dmFont(
931 ON_Font** // ppFont
932 );
933
934 bool EndRead3dmFontTable();
935
936
938 // Step 11: REQUIRED - Write/Read dimstyle table (it can be empty)
939 //
940 bool BeginWrite3dmDimStyleTable();
941 bool Write3dmDimStyle( const ON_DimStyle& );
942 bool EndWrite3dmDimStyleTable();
943
944 bool BeginRead3dmDimStyleTable();
945
946 // Description:
947 // Reads annotation dimension styles from dimension style table.
948 // If the dimension style definition is read,
949 // a dimension style is created by calling new ON_DimStyle(),
950 // initialized with values stored in the archive, and
951 // returned.
952 //
953 // Parameters:
954 // ppDimStyle - If the dimstyle definition is
955 // read, a dimstyle is created by calling new ON_DimStyle(),
956 // initialized with values stored in the archive, and
957 // a pointer to the new dimstyle is returned in *ppDimStyle.
958 //
959 // Returns:
960 //
961 // @untitled table
962 // 0 at the end of the dimension style table
963 // 1 dimension style definition was successfully read
964 // -1 archive is corrupt at this point
965 //
966 // Example:
967 // Calls to Read3dmDimStyle need to be bracketed by calls
968 // to BeginRead3dmDimStyleTable() / EndRead3dmDimStyleTable().
969 //
970 // archive.BeginRead3dmDimStyleTable();
971 // int rc = 1;
972 // ON_DimStyle* pDimStyle;
973 // while(rc==1)
974 // { //
975 // pDimStyle = 0;
976 // archive.Read3dmDimStyle(&pDimStyle);
977 // if ( pDimStyle )
978 // do something with pDimStyle
979 // } //
980 // archive.EndRead3dmDimStyleTable();
981 //
982 int Read3dmDimStyle(
983 ON_DimStyle** // ppDimStyle
984 );
985
986 bool EndRead3dmDimStyleTable();
987
988
990 // Step 12: REQUIRED - Write/Read render light table (it can be empty)
991 //
992 bool BeginWrite3dmLightTable();
993 bool Write3dmLight( const ON_Light&,
994 const ON_3dmObjectAttributes* // optional
995 );
996 bool EndWrite3dmLightTable();
997
998 bool BeginRead3dmLightTable();
999 int Read3dmLight( // returns 0 at end of light table
1000 // 1 light successfully read
1001 // -1 if file is corrupt
1002 ON_Light**, // light returned here
1003 ON_3dmObjectAttributes* // optional - if NOT NULL, object attributes are
1004 // returned here
1005 );
1006 bool EndRead3dmLightTable();
1007
1008
1010 // Step 13: REQUIRED - Write/Read hatch pattern table (it can be empty)
1011 //
1012 bool BeginWrite3dmHatchPatternTable();
1013 bool Write3dmHatchPattern( const ON_HatchPattern&);
1014 bool EndWrite3dmHatchPatternTable();
1015
1016 bool BeginRead3dmHatchPatternTable();
1017 int Read3dmHatchPattern(ON_HatchPattern**);
1018 bool EndRead3dmHatchPatternTable();
1019
1021 // Step 14: REQUIRED - Write/Read instance definition table (it can be empty)
1022 //
1023 bool BeginWrite3dmInstanceDefinitionTable();
1024 bool Write3dmInstanceDefinition( const ON_InstanceDefinition& );
1025 bool EndWrite3dmInstanceDefinitionTable();
1026
1027 bool BeginRead3dmInstanceDefinitionTable();
1028
1029 /*
1030 Description:
1031 Reads instance definitions from instance defintion table.
1032
1033 Parameters:
1034 ppInstanceDefinition - If an instance defintion is
1035 read, an instance defintion is created by calling new
1036 ON_InstanceDefinition(), initialized with values stored
1037 in the archive, and a pointer to the new instance defintion
1038 is returned in *ppInstanceDefinition.
1039
1040 Returns:
1041
1042 @untitled table
1043 0 at the end of the instance defintion table
1044 1 instance defintion was successfully read
1045 -1 archive is corrupt at this point
1046
1047 Example:
1048 Calls to Read3dmInstanceDefinition need to be bracketed by calls
1049 to BeginRead3dmInstanceDefinitionTable() / EndRead3dmInstanceDefinitionTable().
1050
1051 archive.BeginRead3dmInstanceDefinitionTable();
1052 int rc = 1;
1053 ON_InstanceDefinition* pInstanceDefinition;
1054 while(rc==1)
1055 {
1056 pInstanceDefinition = 0;
1057 archive.Read3dmInstanceDefinition(&pInstanceDefinition);
1058 if ( pInstanceDefinition )
1059 do something with pInstanceDefinition
1060 }
1061 archive.EndRead3dmInstanceDefinitionTable();
1062 */
1063 int Read3dmInstanceDefinition(
1064 ON_InstanceDefinition** // ppInstanceDefinition
1065 );
1066
1067 bool EndRead3dmInstanceDefinitionTable();
1068
1070 // Step 15: REQUIRED - Write/Read geometry and annotation table (it can be empty)
1071 //
1072 bool BeginWrite3dmObjectTable();
1073 bool Write3dmObject(
1074 const ON_Object&,
1075 const ON_3dmObjectAttributes* // optional
1076 );
1077 bool EndWrite3dmObjectTable();
1078
1079 bool BeginRead3dmObjectTable();
1080 int Read3dmObject( // returns 0 at end of object table
1081 // 1 if object is read
1082 // 2 if object is skipped because it does not match filter
1083 // -1 if file is corrupt
1084 ON_Object**, // object returned here (NULL if skipped)
1085 ON_3dmObjectAttributes*, // optional - if NOT NULL, object attributes are
1086 // returned here
1087 unsigned int = 0 // optional filter made by setting ON::object_type bits
1088 ); // returns NULL at end of object table
1089 bool EndRead3dmObjectTable();
1090
1092 // Step 16: REQUIRED - Write/Read history record table (it can be empty)
1093 //
1094 bool BeginWrite3dmHistoryRecordTable();
1095 bool Write3dmHistoryRecord(
1096 const class ON_HistoryRecord&
1097 );
1098 bool EndWrite3dmHistoryRecordTable();
1099
1100 bool BeginRead3dmHistoryRecordTable();
1101
1102 /*
1103 Returns:
1104 0 at end of object table
1105 1 if object is read
1106 -1 if file is corrupt
1107 */
1108 int Read3dmHistoryRecord(
1109 class ON_HistoryRecord*&
1110 );
1111 bool EndRead3dmHistoryRecordTable();
1112
1114 // Step 17: OPTIONAL - Write/Read 0 or more user tables
1115 //
1116
1117 /*
1118 Description:
1119 Write the user table header information that must precede
1120 the user table information written by a plug-in.
1121 Parameters:
1122 plugin_id - [in]
1123 bSavingGoo - [in]
1124 Set to false if a plug-in will be used to write
1125 the user table. Set to true if a user table written by
1126 a missing plug-in is being resaved. In this case,
1127 goo_3dm_version and goo_opennurbs_version must also be
1128 set. In practice, you should use Write3dmAnonymousUserTableRecord()
1129 to handle writing "goo" and use this function only when
1130 the plug-in in present.
1131 goo_3dm_version - [in]
1132 If bSavingGoo is false, this parameter must be zero and
1133 ON_BinaryArchive::Archive3dmVersion() will be used.
1134 If bSavingGoo is true, this parameter must be the version of
1135 the 3dm archive (1,2,3,4,5,50,...) the plug-in code used to
1136 write the user table.
1137 goo_opennurbs_version - [in]
1138 If bSavingGoo is false, this parameter must be zero and
1139 ON_BinaryArchive::ArchiveOpenNURBSVersion() will be used.
1140 If bSavingGoo is true, this parameter must be the version
1141 of the opennurbs (YYYYMMDDN) the plug-in code used to
1142 write the user table.
1143 Returns:
1144 True if the the user information can be written.
1145 False if user informtion should not be written.
1146 */
1147 bool BeginWrite3dmUserTable(
1148 const ON_UUID& plugin_id,
1149 bool bSavingGoo,
1150 int goo_3dm_version,
1151 int goo_opennurbs_version
1152 );
1153
1154 bool EndWrite3dmUserTable();
1155
1156 /*
1157 Description:
1158 If Read3dmAnaonymousUserTable() was used to read ON_3dmGoo because a
1159 plug-in was not present, then use Write3dmAnonymousUserTableRecord()
1160 to put than information back into the archive.
1161 Write3dmAnonymousUserTableRecord() writes the entire record.
1162 Do NOT call BeginWrite3dmUserTable() / EndWrite3dmUserTable() when
1163 using Write3dmAnonymousUserTableRecord().
1164 Parameters:
1165 plugin_id - [in]
1166 goo_version - [in]
1167 The version of the archive (1,2,3,4,5,50,...) that was used when
1168 the plug-in wrote the user table.
1169 goo_opennurbs_version - [in]
1170 The version of opennurbs ( YYYMMDDN ) that was used when the
1171 plug-in wrote the user table.
1172 goo - [in]
1173 Returns:
1174 True if the goo was written or skipped because it could not be robustly
1175 saved. False if a catastrophic IO error occured.
1176 */
1177 bool Write3dmAnonymousUserTableRecord(
1178 const ON_UUID& plugin_id,
1179 int goo_3dm_version,
1180 int goo_opennurbs_version,
1181 const ON_3dmGoo& goo
1182 );
1183
1184 // OBSOLETE - use BeginWrite3dmUserTable(plugin_id, bSavingGoo, 3dm_version, opennurbs_version )
1185#if defined(ON_COMPILER_MSC)
1186 __declspec(deprecated)
1187#endif
1188 bool BeginWrite3dmUserTable( const ON_UUID& );
1189
1190 // OBSOLETE - use Write3dmAnonymousUserTableRecord(plugin_id, ..., goo)
1191#if defined(ON_COMPILER_MSC)
1192 __declspec(deprecated)
1193#endif
1194 bool Write3dmAnonymousUserTable( const ON_3dmGoo& );
1195
1196 /*
1197 Parameters:
1198 plugin_id - [out]
1199 id of plug-in that wrote the user table
1200 bLastSavedAsGoo - [out]
1201 True if this table was saved into this archive as goo because
1202 the plug-in was not present at the time of the save.
1203 archive_3dm_version - [out]
1204 Version of the archive the plug-in wrote to. When bLastSavedAsGoo
1205 is true, this number can be different from Archive3dmVersion().
1206 archive_opennurbs_version - [out]
1207 Version of opennurbs the plug-in used to write the archive.
1208 When bLastSavedAsGoo is true, this number can be different
1209 from ArchiveOpenNURBSVersion().
1210 Returns:
1211 False when there are no more user tables or an IO error occurs.
1212 */
1213 bool BeginRead3dmUserTable(
1214 ON_UUID& plugin_id,
1215 bool* bLastSavedAsGoo,
1216 int* archive_3dm_version,
1217 int* archive_opennurbs_version
1218 );
1219
1220 /*
1221 Description:
1222 If the plug-in that wrote the user table is not present and you need
1223 to read and resave the user table, then use Read3dmAnonymousUserTable()
1224 to load the information into "goo".
1225 If you do not need to resave the information, then simply call EndRead3dmUserTable()
1226 to skip over this table.
1227 */
1228 bool Read3dmAnonymousUserTable(
1229 int archive_3dm_version,
1230 int archive_opennurbs_version,
1231 ON_3dmGoo& goo
1232 );
1233
1234 bool EndRead3dmUserTable();
1235
1236 // OBSOLETE - use BeginRead3dmUserTable( plugin_id, bLastSavedAsGoo, archive_3dm_version, ... )
1237#if defined(ON_COMPILER_MSC)
1238 __declspec(deprecated)
1239#endif
1240 bool BeginRead3dmUserTable(
1241 ON_UUID&
1242 );
1243
1244 // OBSOLETE - use Read3dmAnonymousUserTable( archive_3dm_version, archive_opennurbs_version, goo )
1245#if defined(ON_COMPILER_MSC)
1246 __declspec(deprecated)
1247#endif
1248 bool Read3dmAnonymousUserTable( ON_3dmGoo& );
1249
1250
1251
1252
1254 // Step 18: REQUIRED when writing / OPTIONAL when reading
1255 // Write end of file marker. This information is primarily
1256 // used when debugging files to make sure the end of the file
1257 // hasn't been cut off.
1258 //
1259
1260 // Description:
1261 // Writes a TCODE_ENDOFFILE chunk that contains the number
1262 // of bytes in the archive.
1263 //
1264 // Returns:
1265 // true if successful, false if unable to write to archive.
1266 bool Write3dmEndMark();
1267
1268 // Description:
1269 // Checks for a TCODE_ENDOFFILE chunk at the current position.
1270 // If it finds one, it reads it and returns the number
1271 // of bytes in the archive. Comparing this number with
1272 // the current file position can help detect files that
1273 // have been damaged by loosing sections.
1274 //
1275 // Parameters:
1276 // sizeof_archive - [out] number of bytes written to archive
1277 //
1278 // Returns:
1279 // true if successful, false if unable to find or read
1280 // a TCODE_ENDOFFILE chunk.
1281 bool Read3dmEndMark(
1282 size_t* // sizeof_archive
1283 );
1284
1287 // Low level tools to Write/Read chunks. See opennurbs_3dm.h for details
1288 // about the structure of chunks. Every chunk must begin with a
1289 // call to BeginWrite/ReadChunk().
1290 // If BeginWriteChunk()/BeginReadChunk() returns true, then
1291 // you must call EndWrite/ReadChunk() or cease using the archive.
1292
1293 // Description:
1294 // Writes a chunk header containing 4 byte typecode and value.
1295 //
1296 // Parameters:
1297 // typecode - [in] a TCODE_* number from opennurbs_3dm.h
1298 // value - [in] if (typecode&TCODE_SHORT) is nonzero, then
1299 // this is the value to be saved. Othewise, pass
1300 // a zero and the EndWrite3dmChunk() call will
1301 // store the length of the chunk.
1302 //
1303 // Returns:
1304 // true if write was successful.
1305 bool BeginWrite3dmChunk(
1306 unsigned int, // typecode
1307 int // value
1308 );
1309
1310 bool BeginWrite3dmBigChunk(
1311 ON__UINT32 typecode,
1312 ON__INT64 value
1313 );
1314
1315 /*
1316 Description:
1317 Begins writing a chunk.
1318 Parameters:
1319 tcode - [in] chunk's typecode from opennurbs_3dm.h. This cannot be a short tcode.
1320 major_version - [in] ( >= 1)
1321 minor_version - [in] ( >= 0 )
1322 Returns:
1323 True if input was valid and chunk was started. In this case
1324 You must call EndWrite3dmChunk(), even if something goes wrong
1325 while you attempt to write the contents of the chunk.
1326 False if input was not valid or the write failed.
1327 */
1328 bool BeginWrite3dmChunk(
1329 unsigned int tcode,
1330 int major_version,
1331 int minor_version
1332 );
1333
1334
1335 // updates length in chunk header
1336 bool EndWrite3dmChunk();
1337
1338 bool Write3dmGoo( const ON_3dmGoo& ); // call to write "goo"
1339
1340 // OBSOLETE - Use BeginRead3dmBigChunk()
1341#if defined(ON_COMPILER_MSC)
1342 __declspec(deprecated)
1343#endif
1344 bool BeginRead3dmChunk(
1345 unsigned int*, // typecode from opennurbs_3dm.h
1346 int* // value
1347 );
1348
1349 // When the end of the 3dm file is reached, BeginReadChunk() will
1350 // return true with a typecode of TCODE_ENDOFFILE.
1351 bool BeginRead3dmBigChunk(
1352 unsigned int*, // typecode from opennurbs_3dm.h
1353 ON__INT64* // value
1354 );
1355 /*
1356 Description:
1357 Begins reading a chunk that must be in the archive at this location.
1358 Parameters:
1359 expected_tcode - [in] chunk's typecode from opennurbs_3dm.h
1360 major_version - [out]
1361 minor_version - [out]
1362 Returns:
1363 True if beginning of the chunk was read. In this case
1364 You must call EndRead3dmChunk(), even if something goes wrong
1365 while you attempt to read the interior of the chunk.
1366 False if the chunk did not exist at the current location in the file.
1367 */
1368 bool BeginRead3dmChunk(
1369 unsigned int expected_tcode,
1370 int* major_version,
1371 int* minor_version
1372 );
1373
1374 /*
1375 Description:
1376 Calling this will skip rest of stuff in chunk if it was only partially read.
1377 */
1378 bool EndRead3dmChunk();
1379
1380
1381
1383 //
1384 // Tools for dictionary IO (used in .NET)
1385 //
1386
1387 /*
1388 Description:
1389 Begins writing a dictionary.
1390 Parameters:
1391 dictionary_id - [in]
1392 version - [in]
1393 It is suggested that you use YYYYMMDD as the version number.
1394 dictionary_name - [in]
1395 You may pass NULL.
1396 Remarks:
1397 Begins a new chunk with tcode TCODE_DICTIONARY and then writes
1398 a TCODE_DICTIONARY_ID chunk containing the id, version and name.
1399 After calling this function, you may either write entries by
1400 calling
1401 BeginWriteDictionaryEntry();
1402 write entry definition...
1403 EndWriteDictionaryEntry();
1404 or you may finish writing the dictionay by calling
1405 EndWriteDictionary();
1406 */
1407 bool BeginWriteDictionary(
1408 ON_UUID dictionary_id,
1409 unsigned int version,
1410 const wchar_t* dictionary_name
1411 );
1412 /*
1413 Description:
1414 Begins writing a dictionary entry.
1415 Parameters:
1416 de_type - [in]
1417 entry_name - [in]
1418 Returns:
1419 true
1420 Entry header was written and you must call EndWriteDictionary()
1421 after writing the entry data.
1422 false
1423 Failed to write entry header. Do not call EndWriteDictionary().
1424 Remarks:
1425 Begins a new chunk with tcode TCODE_DICTIONARY_ENTRY,
1426 then writes the int, and then writes the string.
1427 */
1428 bool EndWriteDictionary();
1429
1430 /*
1431 Description:
1432 Begins writing a dictionary entry.
1433 Parameters:
1434 de_type - [in]
1435 entry_name - [in]
1436 Returns:
1437 true
1438 Entry header was written and you must call EndWriteDictionary()
1439 after writing the entry data.
1440 false
1441 Failed to write entry header. Do not call EndWriteDictionary().
1442 Remarks:
1443 Begins a new chunk with tcode TCODE_DICTIONARY_ENTRY,
1444 then writes the int, and then writes the string.
1445 */
1446 bool BeginWriteDictionaryEntry(
1447 int de_type,
1448 const wchar_t* entry_name
1449 );
1450 bool EndWriteDictionaryEntry();
1451
1452 bool BeginReadDictionary(
1453 ON_UUID* dictionary_id,
1454 unsigned int* version,
1455 ON_wString& dictionary_name
1456 );
1457 bool EndReadDictionary();
1458
1459 /*
1460 Description:
1461 Begin reading a dictionary entry.
1462 Parameters:
1463 de_type - [out]
1464 entry_name - [out]
1465 Returns:
1466 0: serious IO error
1467 1: success
1468 read information and then call EndReadDictionaryEntry()
1469 2: at end of dictionary
1470 */
1471 int BeginReadDictionaryEntry(
1472 int* de_type,
1473 ON_wString& entry_name
1474 );
1475 bool EndReadDictionaryEntry();
1476
1477 bool Read3dmGoo( ON_3dmGoo& ); // Call to read "goo"
1478
1479 // OBSOLETE - Use PeekAt3dmBigChunkType()
1480#if defined(ON_COMPILER_MSC)
1481 __declspec(deprecated)
1482#endif
1483 bool PeekAt3dmChunkType( // does not change file position
1484 unsigned int*, // typecode from opennurbs_3dm.h
1485 int* // value
1486 );
1487
1488 bool PeekAt3dmBigChunkType( // does not change file position
1489 ON__UINT32* typecode,
1490 ON__INT64* big_value
1491 );
1492
1493 bool Seek3dmChunkFromStart(
1494 // beginning at the start of the active chunk, search portion of
1495 // archive included in active chunk for the start of a subchunk
1496 // with the specified type.
1497 // if true is returned, then the position is set so the next call to
1498 // BeginRead3dmChunk() will read a chunk with the specified typecode
1499 unsigned int // typecode from opennurbs_3dm.h
1500 );
1501 bool Seek3dmChunkFromCurrentPosition(
1502 // beginning at the current position, search portion of archive
1503 // included in active chunk for the start of a subchunk with the
1504 // specified type.
1505 // if true is returned, then the position is set so the next call to
1506 // BeginRead3dmChunk() will read a chunk with the specified typecode
1507 unsigned int // typecode from opennurbs_3dm.h
1508 );
1509
1510 // A chunk version is a single byte that encodes a major.minor
1511 // version number. Useful when creating I/O code for 3dm chunks
1512 // that may change in the future. Increment the minor version
1513 // number if new information is added to the end of the chunk.
1514 // Increment the major version if the format of the chunk changes
1515 // in some other way.
1516 bool Write3dmChunkVersion(
1517 int, // major // 0 to 15
1518 int // minor // 0 to 16
1519 );
1520 bool Read3dmChunkVersion(
1521 int*, // major // 0 to 15
1522 int* // minor // 0 to 16
1523 );
1524
1525 /*
1526 Description:
1527 Low level tool to writes user data attached to the
1528 object. This function should never be called
1529 directly.
1530 Parameters:
1531 object - [in]
1532 Returns:
1533 True if successful.
1534 */
1535 bool WriteObjectUserData( const ON_Object& object );
1536
1537 /*
1538 Description:
1539 Low level tool to read user data and attach it to
1540 the object. This function should never be called
1541 directly.
1542 Parameters:
1543 object - [in/out]
1544 Returns:
1545 True if successful.
1546 */
1547 bool ReadObjectUserData( ON_Object& object );
1548
1549 /*
1550 Description:
1551 If a 3dm archive is being read or written, then this is the
1552 version of the 3dm archive format (1, 2, 3, 4 or 5).
1553 Returns:
1554 @untitle table
1555 0 a 3dm archive is not being read/written
1556 1 a version 1 3dm archive is being read/written
1557 2 a version 2 3dm archive is being read/written
1558 3 a version 3 3dm archive is being read/written
1559 4 a version 4 3dm archive is being read/written
1560 5 an old version 5 3dm archive is being read
1561 50 a version 5 3dm archive is being read/written
1562 See Also:
1563 ON_BinaryArchive::ArchiveOpenNURBSVersion
1564 */
1565 int Archive3dmVersion() const;
1566
1567 /*
1568 Description:
1569 If a 3dm archive is being read, then this is the version
1570 of openNURBS that was used to write the archive. This value
1571 is only available after ON_BinaryArchive::Read3dmProperties
1572 is called.
1573 See Also:
1574 ON_BinaryArchive::Archive3dmVersion
1575 ON_BinaryArchive::Read3dmProperties
1576 Returns:
1577 Version of openNURBS used to write the archive. The openNURBS
1578 version is the value returned by ON::Version.
1579 See Also:
1580 ON::Version
1581 ON_BinaryArchive::Read3dmProperties
1582 ON_BinaryArchive::Archive3dmVersion
1583 Remarks:
1584 This value is rarely needed. You probably want to
1585 use ON_BinaryArchive::Archive3dmVersion.
1586 */
1587 int ArchiveOpenNURBSVersion() const;
1588
1589 /*
1590 Description:
1591 When a 3dm archive is saved from an MFC application that
1592 supports Windows linking/embedding, the first 5kb to 1mb
1593 of the file contains information that is put there by MFC.
1594 ArchiveStartOffset() returns the offset into the file where
1595 the 3dm archive actually begins. The call to
1596 ON_BinaryArchive::Read3dmStartSection() calculates this
1597 offset and stores the value in m_3dm_start_section_offset.
1598 Returns:
1599 Offset into the binary "file" where the actual 3dm archive
1600 begins.
1601 Remarks:
1602 Generally, this value can be ignored. This function is
1603 a diagnostice tool that is used to analyzed damaged files.
1604 */
1605 size_t ArchiveStartOffset() const;
1606
1627
1628 /*
1629 Description:
1630 Expert user function for reading damaged files.
1631 Parameters:
1632 chunk - [out] current chunk.
1633 Returns:
1634 Level of the chunk or 0 if there is no current
1635 chunk.
1636 */
1637 int GetCurrentChunk(ON_3DM_CHUNK& chunk) const;
1638 int GetCurrentChunk(ON_3DM_BIG_CHUNK& big_chunk) const;
1639
1640 /*
1641 Description:
1642 Expert user function for reading damaged files. The search starts
1643 at the beginning of the file.
1644 Parameters:
1645 tcode_table - [in] typecode of the table
1646 tcode_record - [in] typecode of the record
1647 class_uuid - [in] id of the opennurbs class in the record
1648 min_length_data - [in] minimum size of the opennurbs class data
1649 Returns:
1650 True if the table start is found. In this case the current
1651 position of the archive is at the start of the table and
1652 the standared BeginRead3dm...Table() function can be used.
1653 False if the table start is not found.
1654 */
1655 bool FindTableInDamagedArchive(
1656 unsigned int tcode_table,
1657 unsigned int tcode_record,
1658 ON_UUID class_uuid,
1659 int min_length_data
1660 );
1661
1662 /*
1663 Description:
1664 Expert user function for studying contents of a file.
1665 The primary use is as an aid to help dig through files
1666 that have been damaged (bad disks, transmission errors, etc.)
1667 If an error is found, a line that begins with the word
1668 "ERROR" is printed.
1669 Parameters:
1670 text_log - [in] place to print informtion
1671 recursion_depth - [in] simply a counter
1672 to aid in debugging.
1673 Returns:
1674 0 if something went wrong, otherwise the typecode
1675 of the chunk that was just studied.
1676 */
1677 unsigned int
1678 Dump3dmChunk(
1679 ON_TextLog& text_log,
1680 int recursion_depth = 0
1681 );
1682
1683protected:
1684
1685 /*
1686 Description:
1687 Works like the C runtrim fread().
1688 Returns:
1689 actual number of bytes read (like fread())
1690 */
1691 virtual
1692 size_t Read( size_t, void* ) = 0;
1693
1694 /*
1695 Description:
1696 Works like the C runtrim fwrite().
1697 Returns:
1698 actual number of bytes written (like fwrite())
1699 */
1700 virtual
1701 size_t Write( size_t, const void* ) = 0;
1702
1703 /*
1704 Description:
1705 Force Write() to flush any buffered data to physical archive.
1706 Returns:
1707 True if succesful or if there is nothing to flush. False if
1708 information could not be flushed.
1709 */
1710 virtual
1711 bool Flush() = 0;
1712
1713 /*
1714 Description:
1715 When ON_BinaryArchive::ReadObject() encounters userdata and
1716 the user data class id is not present, LoadUserDataApplication
1717 is called to load the application that created user data.
1718 Returns:
1719 0 - could not load the application
1720 1 - successfully loaded the application
1721 2 - the application was already loaded
1722 */
1723 virtual
1724 int LoadUserDataApplication(
1725 ON_UUID application_id
1726 );
1727
1728 bool SetArchive3dmVersion(int);
1729
1730private:
1731 // 16 bit integer IO
1732 bool WriteInt8( size_t, const ON__INT8* );
1733 bool ReadInt8( size_t, ON__INT8* );
1734
1735 // 16 bit integer IO
1736 bool WriteInt16( size_t, const ON__INT16* );
1737 bool ReadInt16( size_t, ON__INT16* );
1738
1739 // 32 bit integer IO
1740 bool WriteInt32( size_t, const ON__INT32* );
1741 bool ReadInt32( size_t, ON__INT32* );
1742
1743 // 64 bit integer IO
1744 bool WriteInt64( size_t, const ON__INT64* );
1745 bool ReadInt64( size_t, ON__INT64* );
1746
1747 bool BeginWrite3dmTable(
1748 unsigned int // tcode
1749 );
1750 bool EndWrite3dmTable(
1751 unsigned int // tcode
1752 );
1753 bool BeginRead3dmTable(
1754 unsigned int // tcode
1755 );
1756 bool EndRead3dmTable(
1757 unsigned int // tcode
1758 );
1759
1760 bool Read3dmV1Layer( ON_Layer*& );
1761 int Read3dmV1Light( // returns 0 at end of light table
1762 // 1 light successfully read
1763 // -1 if file is corrupt
1764 ON_Light**, // light returned here
1765 ON_3dmObjectAttributes* // optional - if NOT NULL, object attributes are
1766 // returned here
1767 );
1768 int Read3dmV1Material( ON_Material** );
1769 int Read3dmV1Object( // returns 0 at end of object table
1770 // 1 if object is read
1771 // 2 if object is skipped because it does not match filter
1772 // -1 if file is corrupt
1773 ON_Object**, // object returned here (NULL if skipped)
1774 ON_3dmObjectAttributes*, // optional - if NOT NULL, object attributes are
1775 // returned here
1776 unsigned int = 0 // optional filter made by setting ON::object_type bits
1777 ); // returns NULL at end of object table
1778
1779 bool Read3dmV1AttributesOrMaterial(
1780 ON_3dmObjectAttributes*, // attributes,
1781 ON_Material*, // material,
1782 ON_BOOL32&, // bHaveMat
1783 unsigned int, // end_mark_tcode
1784 class ON__3dmV1_XDATA* = 0 // v1 "xdata"
1785 );
1786 bool Read3dmV1String( ON_String& );
1787 int Read3dmV1LayerIndex( const char* ) const;
1788
1789public:
1790 // helpers for reading V1 objects
1791 bool ReadV1_TCODE_RH_POINT(ON_Object**,ON_3dmObjectAttributes*);
1792 bool ReadV1_TCODE_MESH_OBJECT(ON_Object**,ON_3dmObjectAttributes*);
1793 bool ReadV1_TCODE_LEGACY_CRV(ON_Object**,ON_3dmObjectAttributes*);
1794 bool ReadV1_TCODE_LEGACY_FAC(ON_Object**,ON_3dmObjectAttributes*);
1795 bool ReadV1_TCODE_LEGACY_SHL(ON_Object**,ON_3dmObjectAttributes*);
1796 bool ReadV1_TCODE_RHINOIO_OBJECT_NURBS_CURVE(ON_Object**,ON_3dmObjectAttributes*);
1797 bool ReadV1_TCODE_RHINOIO_OBJECT_NURBS_SURFACE(ON_Object**,ON_3dmObjectAttributes*);
1798 bool ReadV1_TCODE_RHINOIO_OBJECT_BREP(ON_Object**,ON_3dmObjectAttributes*);
1799 bool ReadV1_TCODE_ANNOTATION(unsigned int,ON_Object**,ON_3dmObjectAttributes*);
1800
1801private:
1802 ON::archive_mode Mode() const; // current read/write mode
1803 void UpdateCRC( size_t, const void* );
1804 int ReadObjectHelper(ON_Object**);
1805
1809
1810 // The bits in m_error_message_mask are used to mask errors
1811 // when we know we are doing something that may generate an
1812 // error.
1813 //
1814 // bit 0x00000001
1815 // V1 files do not have a table structure and are read using
1816 // multiple passes and there are valid situations where a
1817 // 4 byte read is attempted at the end of a file.
1818 //
1819 // bit 0x00000002
1820 // Some v1 files do not have an end mark. When reading
1821 // these v1 files bit 0x02 is set.
1822 //
1823 // bit 0x00000004
1824 // Requested read may go beyond end of file.
1825 // One situation where this happens is when a table is not at the
1826 // expected location in a file,
1827
1829protected:
1830 unsigned int ErrorMessageMask() const;
1831 /*
1832 Paramters:
1833 sizeof_request - [in]
1834 value of count parameter passed to virtual Read() function.
1835 sizeof_read - [in]
1836 number of bytes actually read by the virtual Read() function.
1837 Returns:
1838 True if a call to Read() is permitted to ask for more bytes
1839 than are left in the file. This value varies as the file
1840 is read and must be checked at each failure.
1841 */
1842 bool MaskReadError( ON__UINT64 sizeof_request, ON__UINT64 sizeof_read ) const;
1843private:
1844
1845
1846 // When a 3DM archive is read, m_3dm_opennurbs_version records the version of
1847 // OpenNURBS used to create the archive. Otherwise, m_3dm_opennurbs_version
1848 // is zero.
1849 //
1850 // Read3dmProperties() sets this to the version of OpenNURBS that was
1851 // used to write file file. If the file was created using a version
1852 // of OpenNURBS before 200012210, this number will be zero.
1853 //
1854 // Write3dmProperties() stores the value returned by ON::Version() in
1855 // the archive's properties table.
1858
1859 // When a 3dm archive is saved from an MFC application that supports
1860 // Windows linking/embedding, the first 5kb to 1mb of the file contains
1861 // information that is put there by MFC. m_3dm_start_section_offset
1862 // records the offset into the file where the 3dm archive actually begins.
1864
1866
1867 table_type TableTypeFromTypecode( unsigned int ); // table type from tcode
1868
1870
1871 // stack of chunks
1872 bool PushBigChunk( ON__UINT32 typecode, ON__INT64 value );
1873
1874 bool WriteChunkTypecode( ON__UINT32 );
1875 bool ReadChunkTypecode( ON__UINT32* );
1876 bool WriteChunkValue( ON__UINT32 typecode, ON__INT64 );
1877 bool WriteChunkLength( ON__UINT64 );
1878 bool ReadChunkValue( ON__UINT32 typecode, ON__INT64* value64 );
1879 bool FindMisplacedTable(
1880 ON__UINT64 filelength,
1881 const ON__UINT32 table_tocde,
1882 const ON__UINT32 table_record_record,
1883 const ON_UUID class_uuid,
1884 const ON__UINT64 min_length_data
1885 );
1886
1887 bool ReadObjectUserDataAnonymousChunk(
1888 const ON__UINT64 length_TCODE_ANONYMOUS_CHUNK,
1889 const int archive_3dm_version,
1890 const int archive_opennurbs_version,
1891 class ON_UserData* ud );
1892
1893public:
1894 size_t SizeofChunkLength() const;
1895
1896private:
1897 bool WriteEOFSizeOfFile( ON__UINT64 );
1898 bool ReadEOFSizeOfFile( ON__UINT64* );
1899
1900 bool m_bDoChunkCRC; // true if active chunk crc status should be checked
1901 // and updated.
1902 int m_bad_CRC_count; // number of chunks that have a bad crc
1903
1904
1905private:
1906 // compressed buffer I/O uses zlib 1.1.3 inflate()/deflate()
1907 struct
1908 {
1909 ON::archive_mode mode; // ON::read = read and inflate, ON::write = deflate and write
1910 enum
1911 {
1912 sizeof_x_buffer = 16384
1914 unsigned char buffer[sizeof_x_buffer];
1916 } m_zlib;
1917
1918 // returns number of bytes written
1919 size_t WriteDeflate(
1920 size_t, // sizeof uncompressed input data
1921 const void* // uncompressed input data
1922 );
1923 bool ReadInflate(
1924 size_t, // sizeof uncompressed input data
1925 void* // buffer to hold uncompressed data
1926 );
1927 bool CompressionInit();
1928 void CompressionEnd();
1929
1930private:
1931 // endian-ness of the cpu reading this file.
1932 // 3dm files are alwasy saved with little endian byte order.
1933 ON::endian m_endian;
1934
1935 ON::archive_mode m_mode;
1936
1937 // 3dm write options
1938 bool m_bSaveUserData; // true to save user data (increases file size)
1939 bool m_bSavePreviewImage; // true to save 200x200 preview bitmap (increases file size)
1940 bool m_bEmbedTextureBitmaps; // true to embed texture, bump, trace, and wallpaper bitmaps (increases file size)
1941 bool m_bSaveRenderMeshes; // true to save meshes used to render B-rep objects (increases file size)
1942 bool m_bSaveAnalysisMeshes; // true to save meshes used in surface analysis (increases file size)
1943
1944 // ids of plug-ins that support saving older (V3) versions
1945 // of user data. This information is filled in from the
1946 // list of plug-ins passed in whenteh settings are saved.
1948
1950
1951 // prohibit default construction, copy construction, and operator=
1953 ON_BinaryArchive( const ON_BinaryArchive& ); // no implementation
1954 ON_BinaryArchive& operator=( const ON_BinaryArchive& ); // no implementation
1955
1956};
1957
1959{
1960 // used to store goo
1961public:
1962 ON_3dmGoo();
1963 ~ON_3dmGoo();
1964 ON_3dmGoo( const ON_3dmGoo& );
1965 ON_3dmGoo& operator=( const ON_3dmGoo& );
1966
1967 void Dump(ON_TextLog&) const;
1968
1969 unsigned int m_typecode;
1971 unsigned char* m_goo;
1974};
1975
1976
1978{
1979public:
1980 ON_BinaryFile( ON::archive_mode );
1981 ON_BinaryFile( ON::archive_mode, FILE* ); // pointer from fopen(...,"rb") or fopoen(...,"wb")
1982 virtual ~ON_BinaryFile();
1983
1984 // ON_BinaryArchive overrides
1985 size_t CurrentPosition() const;
1986 bool SeekFromCurrentPosition(int);
1987 bool SeekFromStart(size_t);
1988 bool AtEnd() const;
1989
1990 // fseek from end (since the file has an end)
1991 bool SeekFromEnd( int );
1992
1994 // To use custom memory buffering instead of relying
1995 // on fread()/fwrite()'s build in buffering, call
1996 // EnableMemoryBuffer() with the buffer size immediately
1997 // after constructing the ON_BinaryFile. There appear
1998 // to be enough bugs in existing Windows NT/2000 NETWORK
1999 // I/O that using this hack will speed up I/O by factors
2000 // of 10 to 100.
2001 void EnableMemoryBuffer(
2002 int=16384 // capacity of memory buffer
2003 );
2004
2005protected:
2006 size_t Read( size_t, void* );
2007 size_t Write( size_t, const void* );
2008 bool Flush();
2009
2010private:
2011 // Implementation
2012 FILE* m_fp;
2013
2014 // if m_memory_buffer_capacity is zero, then Write() uses
2015 // fwrite() directly. If m_memory_buffer_capacity is
2016 // greater than zero, then Write() buffers its results
2017 // into m_memory_buffer. This is provided to work around
2018 // bugs in some networks that result in extremely slow
2019 // performance when seeking is used.
2023 unsigned char* m_memory_buffer;
2024
2025private:
2026 // prohibit default construction, copy construction, and operator=
2027 ON_BinaryFile( ); // no implementation
2028 ON_BinaryFile( const ON_BinaryFile& ); // no implementation
2029 ON_BinaryFile& operator=( const ON_BinaryFile& ); // no implementation
2030};
2031
2033{
2034public:
2035
2036 /*
2037 Description:
2038 Construct an ON_BinaryArchive for reading information from a memory buffer.
2039 Parameters:
2040 sizeof_buffer - [in] size of buffer in bytes (>0)
2041 buffer - [in] memory buffer containing binary archive
2042 bCopyBuffer - [in]
2043 true - copy the input buffer.
2044 Useful when the buffer may be destroyed while this class is still in use.
2045 false - Do not copy the input buffer.
2046 In this case you are responsible for making certain the input buffer
2047 is valid while this class is in use.
2048 archive_3dm_version - [in] (1,2,3,4 or 5)
2049 archive_opennurbs_version - [in] YYYYMMDDn
2050 */
2052 size_t sizeof_buffer,
2053 const void* buffer,
2054 bool bCopyBuffer,
2055 int archive_3dm_version,
2056 int archive_opennurbs_version
2057 );
2058
2060
2061 /*
2062 Returns:
2063 value of m_sizeof_buffer
2064 */
2065 size_t SizeOfBuffer() const;
2066
2067 /*
2068 Returns:
2069 value of m_buffer
2070 */
2071 const void* Buffer() const;
2072
2073 // ON_BinaryArchive overrides
2074 size_t CurrentPosition() const;
2075 bool SeekFromCurrentPosition(int);
2076 bool SeekFromStart(size_t);
2077 bool AtEnd() const;
2078
2079protected:
2080 // ON_BinaryArchive overrides
2081 size_t Read( size_t, void* ); // return actual number of bytes read (like fread())
2082 size_t Write( size_t, const void* );
2083 bool Flush();
2084
2085private:
2086 void* m_p;
2087 const unsigned char* m_buffer;
2094
2095private:
2096 // prohibit use - no implementation
2100};
2101
2102
2103/*
2104Description:
2105 Create a simple archive that contains a single geometric object.
2106Parameters:
2107 archive - [in] destination archive.
2108 version - [in] (2 to 5) format version.archive version number.
2109 Version 2 format can be read by Rhino 2 and Rhino 3. Version
2110 3 format can be read by Rhino 3.
2111 object - [in] object to be saved in the archive's object table.
2112 This is typically some type of ON_Curve, ON_Surface, ON_Mesh,
2113 or ON_Brep.
2114Returns:
2115 @untitled table
2116 true archive successfully written.
2117 false archive not successfully written.
2118Example:
2119
2120 const char* filename = "myfile.3dm";
2121 FILE* fp = ON::OpenFile( filename, "wb" );
2122 ON_BinaryFile file( fp, ON::write3dm );
2123 ON_BOOL32 ok = ON_WriteArchive( archive, geometry );
2124 ON::CloseFile( fp );
2125
2126Remarks:
2127 The object table in the archive will contain a single
2128 object.
2129*/
2130ON_DECL
2132 ON_BinaryArchive& archive,
2133 int version,
2134 const ON_Object& object
2135 );
2136
2137#endif
2138
void version()
Prints version information.
Definition autostart.js:59
Definition opennurbs_point.h:253
Definition opennurbs_point.h:655
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_archive.h:1959
unsigned char * m_goo
Definition opennurbs_archive.h:1971
unsigned int m_typecode
Definition opennurbs_archive.h:1969
int m_value
Definition opennurbs_archive.h:1970
ON_3dmGoo * m_prev_goo
Definition opennurbs_archive.h:1973
ON_3dmGoo * m_next_goo
Definition opennurbs_archive.h:1972
Definition opennurbs_3dm_attributes.h:41
Definition opennurbs_3dm_properties.h:105
Definition opennurbs_3dm_settings.h:684
Definition opennurbs_point.h:555
Definition opennurbs_archive.cpp:8341
Definition opennurbs_arc.h:34
Definition opennurbs_archive.h:152
ON::archive_mode m_mode
Definition opennurbs_archive.h:1935
ON_SimpleArray< ON_UUID > m_V3_plugin_id_list
Definition opennurbs_archive.h:1947
table_type m_active_table
Definition opennurbs_archive.h:1865
bool m_bDoChunkCRC
Definition opennurbs_archive.h:1900
bool WriteInt8(size_t, const ON__INT8 *)
virtual size_t Read(size_t, void *)=0
int m_3dm_v1_layer_index
Definition opennurbs_archive.h:1807
bool m_bSaveRenderMeshes
Definition opennurbs_archive.h:1941
virtual bool AtEnd() const =0
virtual size_t Write(size_t, const void *)=0
ON::endian m_endian
Definition opennurbs_archive.h:1933
virtual bool SeekFromCurrentPosition(int)=0
virtual bool SeekFromStart(size_t)=0
size_t m_3dm_start_section_offset
Definition opennurbs_archive.h:1863
ON_BinaryArchive(const ON_BinaryArchive &)
virtual size_t CurrentPosition() const =0
struct ON__3dmV1LayerIndex * m_V1_layer_list
Definition opennurbs_archive.h:1949
bool m_bSaveUserData
Definition opennurbs_archive.h:1938
int m_3dm_version
Definition opennurbs_archive.h:1806
virtual bool Flush()=0
bool ReadInt8(size_t, ON__INT8 *)
ON::archive_mode mode
Definition opennurbs_archive.h:1909
ON_SimpleArray< ON_3DM_BIG_CHUNK > m_chunk
Definition opennurbs_archive.h:1869
ON_BinaryArchive & operator=(const ON_BinaryArchive &)
bool m_bSaveAnalysisMeshes
Definition opennurbs_archive.h:1942
int m_bad_CRC_count
Definition opennurbs_archive.h:1902
z_stream strm
Definition opennurbs_archive.h:1915
unsigned int m_error_message_mask
Definition opennurbs_archive.h:1828
int m_3dm_opennurbs_version
Definition opennurbs_archive.h:1857
bool m_bEmbedTextureBitmaps
Definition opennurbs_archive.h:1940
int m_3dm_v1_material_index
Definition opennurbs_archive.h:1808
bool m_bSavePreviewImage
Definition opennurbs_archive.h:1939
table_type
Definition opennurbs_archive.h:1608
@ bitmap_table
Definition opennurbs_archive.h:1612
@ object_table
Definition opennurbs_archive.h:1618
@ texture_mapping_table
Definition opennurbs_archive.h:1613
@ dimstyle_table
Definition opennurbs_archive.h:1621
@ font_table
Definition opennurbs_archive.h:1620
@ light_table
Definition opennurbs_archive.h:1617
@ settings_table
Definition opennurbs_archive.h:1611
@ material_table
Definition opennurbs_archive.h:1614
@ historyrecord_table
Definition opennurbs_archive.h:1624
@ properties_table
Definition opennurbs_archive.h:1610
@ instance_definition_table
Definition opennurbs_archive.h:1623
@ linetype_table
Definition opennurbs_archive.h:1615
@ hatchpattern_table
Definition opennurbs_archive.h:1622
@ group_table
Definition opennurbs_archive.h:1619
@ layer_table
Definition opennurbs_archive.h:1616
Definition opennurbs_archive.h:1978
size_t m_memory_buffer_size
Definition opennurbs_archive.h:2021
size_t m_memory_buffer_capacity
Definition opennurbs_archive.h:2020
ON_BinaryFile(const ON_BinaryFile &)
ON_BinaryFile & operator=(const ON_BinaryFile &)
unsigned char * m_memory_buffer
Definition opennurbs_archive.h:2023
FILE * m_fp
Definition opennurbs_archive.h:2012
size_t m_memory_buffer_ptr
Definition opennurbs_archive.h:2022
Definition opennurbs_bitmap.h:28
Definition opennurbs_bounding_box.h:25
Definition opennurbs_circle.h:33
Definition opennurbs_array.h:760
Definition opennurbs_color.h:24
Definition opennurbs_dimstyle.h:20
Definition opennurbs_linestyle.h:43
Definition opennurbs_font.h:20
Definition opennurbs_group.h:20
Definition opennurbs_hatch.h:313
Definition opennurbs_object_history.h:30
Definition opennurbs_instance.h:27
Definition opennurbs_point.h:46
Definition opennurbs_layer.h:20
Definition opennurbs_light.h:20
Definition opennurbs_line.h:20
Definition opennurbs_linetype.h:40
Definition opennurbs_linestyle.h:83
Definition opennurbs_material.h:25
Definition opennurbs_object.h:393
Definition opennurbs_point.h:1169
Definition opennurbs_plane.h:20
Definition opennurbs_archive.h:2033
ON__INT_PTR m_reserved2
Definition opennurbs_archive.h:2091
size_t m_sizeof_buffer
Definition opennurbs_archive.h:2088
size_t m_buffer_position
Definition opennurbs_archive.h:2089
ON__INT_PTR m_reserved4
Definition opennurbs_archive.h:2093
ON__INT_PTR m_reserved3
Definition opennurbs_archive.h:2092
ON_Read3dmBufferArchive(const ON_Read3dmBufferArchive &)
ON__INT_PTR m_reserved1
Definition opennurbs_archive.h:2090
const unsigned char * m_buffer
Definition opennurbs_archive.h:2087
ON_Read3dmBufferArchive & operator=(const ON_Read3dmBufferArchive &)
void * m_p
Definition opennurbs_archive.h:2086
Definition opennurbs_array.h:46
Definition opennurbs_string.h:150
Definition opennurbs_textlog.h:20
Definition opennurbs_texture_mapping.h:37
Definition opennurbs_uuid.h:31
Definition opennurbs_userdata.h:20
Definition opennurbs_xform.h:28
Definition opennurbs_string.h:392
bool ON_IsLongChunkTypecode(ON__UINT32 typecode)
Definition opennurbs_archive.cpp:66
void ON_SetBinaryArchiveOpenNURBSVersion(ON_BinaryArchive &, int)
Definition opennurbs_3dm_properties.cpp:342
bool ON_IsShortChunkTypecode(ON__UINT32 typecode)
ON_DECL bool ON_WriteOneObjectArchive(ON_BinaryArchive &archive, int version, const ON_Object &object)
Definition opennurbs_archive.cpp:12646
#define ON_DECL
Definition opennurbs_defines.h:92
#define ON_CLASS
Definition opennurbs_defines.h:91
short ON__INT16
Definition opennurbs_system.h:317
long long ON__INT64
Definition opennurbs_system.h:353
char ON__INT8
Definition opennurbs_system.h:311
unsigned char ON__UINT8
Definition opennurbs_system.h:314
unsigned long long ON__UINT64
Definition opennurbs_system.h:356
int ON__INT32
Definition opennurbs_system.h:323
unsigned short ON__UINT16
Definition opennurbs_system.h:320
int ON_BOOL32
Definition opennurbs_system.h:362
unsigned int ON__UINT32
Definition opennurbs_system.h:326
int ON__INT_PTR
Definition opennurbs_system.h:377
Definition opennurbs_archive.h:97
ON__UINT64 Length() const
Definition opennurbs_archive.cpp:4130
ON__UINT8 m_reserved2
Definition opennurbs_archive.h:110
ON__UINT64 m_big_offset
Definition opennurbs_archive.h:98
ON__UINT8 m_do_crc16
Definition opennurbs_archive.h:114
ON__UINT16 m_crc16
Definition opennurbs_archive.h:116
ON__UINT32 m_typecode
Definition opennurbs_archive.h:106
ON__INT64 m_big_value
Definition opennurbs_archive.h:105
ON__UINT8 m_bLongChunk
Definition opennurbs_archive.h:108
ON__UINT32 m_crc32
Definition opennurbs_archive.h:117
ON__UINT8 m_do_crc32
Definition opennurbs_archive.h:115
ON__UINT8 m_reserved1
Definition opennurbs_archive.h:109
ON__UINT8 m_reserved3
Definition opennurbs_archive.h:111
Definition opennurbs_archive.h:82
ON__UINT32 m_do_crc32
Definition opennurbs_archive.h:92
int m_do_length
Definition opennurbs_archive.h:89
size_t m_offset
Definition opennurbs_archive.h:83
ON__UINT32 m_crc32
Definition opennurbs_archive.h:93
ON__UINT16 m_crc16
Definition opennurbs_archive.h:91
unsigned int m_typecode
Definition opennurbs_archive.h:87
ON__UINT16 m_do_crc16
Definition opennurbs_archive.h:90
int m_value
Definition opennurbs_archive.h:88
Definition opennurbs_archive.cpp:120
Definition zlib.h:82