diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-10-05 03:46:13 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-10-05 03:49:51 -0700 |
commit | 220515bffdf1df5379a7f8921f5a12deb2e0dee7 (patch) | |
tree | 7bace952b5ff55d3eaa62ec4153fc28d3d28bc1d /tensorflow/c/checkpoint_reader.h | |
parent | f6b15b08bbedc500549b0793b236bc90289d07dc (diff) |
Replace owning raw pointers with unique pointers
PiperOrigin-RevId: 171132628
Diffstat (limited to 'tensorflow/c/checkpoint_reader.h')
-rw-r--r-- | tensorflow/c/checkpoint_reader.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tensorflow/c/checkpoint_reader.h b/tensorflow/c/checkpoint_reader.h index 1124416380..470c8d1e10 100644 --- a/tensorflow/c/checkpoint_reader.h +++ b/tensorflow/c/checkpoint_reader.h @@ -16,6 +16,9 @@ limitations under the License. #ifndef TENSORFLOW_C_CHECKPOINT_READER_H #define TENSORFLOW_C_CHECKPOINT_READER_H +#include <memory> +#include <string> + #include "tensorflow/c/tf_status_helper.h" #include "tensorflow/core/framework/tensor_shape.h" #include "tensorflow/core/lib/core/status.h" @@ -24,7 +27,6 @@ limitations under the License. #include "tensorflow/core/util/tensor_slice_reader.h" namespace tensorflow { - namespace checkpoint { class TensorSliceReader; @@ -38,7 +40,6 @@ class TensorSliceReader; class CheckpointReader { public: CheckpointReader(const string& filepattern, TF_Status* out_status); - ~CheckpointReader(); bool HasTensor(const string& name) const; const string DebugString() const; @@ -56,12 +57,12 @@ class CheckpointReader { private: // Uses "v2_reader_" to build a "var name -> shape" map; owned by caller. // REQUIRES: "v2_reader_ != nullptr && v2_reader_.status().ok()". - TensorSliceReader::VarToShapeMap* BuildV2VarToShapeMap(); + std::unique_ptr<TensorSliceReader::VarToShapeMap> BuildV2VarToShapeMap(); - // Invariant: exactly one of "reader_" and "v2_reader_" is non-nullptr. - TensorSliceReader* reader_; // Owned. - BundleReader* v2_reader_; // Owned. - TensorSliceReader::VarToShapeMap* var_to_shape_map_ptr_; // Owned. + // Invariant: exactly one of "reader_" and "v2_reader_" is non-null. + std::unique_ptr<TensorSliceReader> reader_; + std::unique_ptr<BundleReader> v2_reader_; + std::unique_ptr<TensorSliceReader::VarToShapeMap> var_to_shape_map_ptr_; TF_DISALLOW_COPY_AND_ASSIGN(CheckpointReader); }; |