1 /* Copyright 2015 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_LIB_IO_BLOCK_H_ 17 #define TENSORFLOW_LIB_IO_BLOCK_H_ 18 19 #include <stddef.h> 20 #include <stdint.h> 21 #include "tensorflow/core/lib/io/iterator.h" 22 23 namespace tensorflow { 24 namespace table { 25 26 struct BlockContents; 27 28 class Block { 29 public: 30 // Initialize the block with the specified contents. 31 explicit Block(const BlockContents& contents); 32 33 ~Block(); 34 size()35 size_t size() const { return size_; } 36 Iterator* NewIterator(); 37 38 private: 39 uint32 NumRestarts() const; 40 41 const char* data_; 42 size_t size_; 43 uint32 restart_offset_; // Offset in data_ of restart array 44 bool owned_; // Block owns data_[] 45 46 // No copying allowed 47 Block(const Block&); 48 void operator=(const Block&); 49 50 class Iter; 51 }; 52 53 } // namespace table 54 } // namespace tensorflow 55 56 #endif // TENSORFLOW_LIB_IO_BLOCK_H_ 57