Esempio n. 1
0
File: pbf.hpp Progetto: Rub21/osmium
            /**
             * this little function checks primitive_block_contents counter against its maximum and calls
             * store_primitive_block to flush the block to the disk when it's reached. It's also responsible
             * for increasing this counter.
             *
             * this function also checks the estimated size of the current block and calls store_primitive_block
             * when the estimated size reaches buffer_fill_percent of the maximum uncompressed blob size.
             */
            void check_block_contents_counter() {
                if (primitive_block_contents >= max_block_contents) {
                    store_primitive_block();
                } else if (primitive_block_size > (static_cast<uint32_t>(OSMPBF::max_uncompressed_blob_size) * buffer_fill_percent / 100)) {
                    if (debug && has_debug_level(1)) {
                        std::cerr << "storing primitive_block with only " << primitive_block_contents << " items, because its ByteSize (" << primitive_block_size << ") reached " <<
                                  (static_cast<float>(primitive_block_size) / static_cast<float>(OSMPBF::max_uncompressed_blob_size) * 100.0) << "% of the maximum blob-size" << std::endl;
                    }

                    store_primitive_block();
                }

                primitive_block_contents++;
            }
Esempio n. 2
0
 /**
  * this little function checks primitive_block_contents counter against its maximum and calls
  * store_primitive_block to flush the block to the disk when it's reached. It's also responsible
  * for increasing this counter.
  */
 void check_block_contents_counter() {
     if (primitive_block_contents >= max_block_contents) {
         store_primitive_block();
     }
     primitive_block_contents++;
 }