ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
CompressedVectorWriterImpl.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * Original work Copyright 2009 - 2010 Kevin Ackley (kackley@gwi.net)
4  * Modified work Copyright 2018 - 2020 Andy Maloney <asmaloney@gmail.com>
5  *
6  * Permission is hereby granted, free of charge, to any person or organization
7  * obtaining a copy of the software and accompanying documentation covered by
8  * this license (the "Software") to use, reproduce, display, distribute,
9  * execute, and transmit the Software, and to prepare derivative works of the
10  * Software, and to permit third-parties to whom the Software is furnished to
11  * do so, all subject to the following:
12  *
13  * The copyright notices in the Software and this entire statement, including
14  * the above license grant, this restriction and the following disclaimer,
15  * must be included in all copies of the Software, in whole or in part, and
16  * all derivative works of the Software, unless such copies or derivative
17  * works are solely in the form of machine-executable object code generated by
18  * a source language processor.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
23  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
24  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  * DEALINGS IN THE SOFTWARE.
27  */
28 
29 #include "Encoder.h"
30 #include "Packet.h"
31 
32 namespace e57
33 {
35  {
36  public:
37  CompressedVectorWriterImpl( std::shared_ptr<CompressedVectorNodeImpl> ni, std::vector<SourceDestBuffer> &sbufs );
39  void write( const size_t requestedRecordCount );
40  void write( std::vector<SourceDestBuffer> &sbufs, const size_t requestedRecordCount );
41  bool isOpen() const;
42  std::shared_ptr<CompressedVectorNodeImpl> compressedVectorNode() const;
43  void close();
44 
45 #ifdef E57_DEBUG
46  void dump( int indent = 0, std::ostream &os = std::cout );
47 #endif
48 
49  private:
50  void checkImageFileOpen( const char *srcFileName, int srcLineNumber, const char *srcFunctionName ) const;
51  void checkWriterOpen( const char *srcFileName, int srcLineNumber, const char *srcFunctionName ) const;
52  void setBuffers( std::vector<SourceDestBuffer> &sbufs ); //???needed?
53  size_t totalOutputAvailable() const;
54  size_t currentPacketSize() const;
55  uint64_t packetWrite();
56  void flush();
57 
58  //??? no default ctor, copy, assignment?
59 
60  std::vector<SourceDestBuffer> sbufs_;
61  std::shared_ptr<CompressedVectorNodeImpl> cVector_;
62  NodeImplSharedPtr proto_;
63 
64  std::vector<std::shared_ptr<Encoder>> bytestreams_;
65  DataPacket dataPacket_;
66 
67  bool isOpen_;
68  uint64_t sectionHeaderLogicalStart_;
69  uint64_t sectionLogicalLength_;
70  uint64_t dataPhysicalOffset_;
71  uint64_t topIndexPhysicalOffset_;
72  uint64_t recordCount_;
73  uint64_t dataPacketsCount_;
74  uint64_t indexPacketsCount_;
75  };
76 }
void dump(int indent=0, std::ostream &os=std::cout)
std::shared_ptr< CompressedVectorNodeImpl > compressedVectorNode() const
void write(const size_t requestedRecordCount)
CompressedVectorWriterImpl(std::shared_ptr< CompressedVectorNodeImpl > ni, std::vector< SourceDestBuffer > &sbufs)
std::shared_ptr< class NodeImpl > NodeImplSharedPtr
Definition: Common.h:190