MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Status

Class Status

tensorflow/core/lib/core/status.h:38–98  ·  view source on GitHub ↗

@ingroup core Denotes success or failure of a call in Tensorflow.

Source from the content-addressed store, hash-verified

36/// @ingroup core
37/// Denotes success or failure of a call in Tensorflow.
38class Status {
39 public:
40 /// Create a success status.
41 Status() {}
42
43 /// \brief Create a status with the specified error code and msg as a
44 /// human-readable string containing more detailed information.
45 Status(tensorflow::error::Code code, tensorflow::StringPiece msg);
46
47 /// Copy the specified status.
48 Status(const Status& s);
49 void operator=(const Status& s);
50
51 static Status OK() { return Status(); }
52
53 /// Returns true iff the status indicates success.
54 bool ok() const { return (state_ == NULL); }
55
56 tensorflow::error::Code code() const {
57 return ok() ? tensorflow::error::OK : state_->code;
58 }
59
60 const string& error_message() const {
61 return ok() ? empty_string() : state_->msg;
62 }
63
64 bool operator==(const Status& x) const;
65 bool operator!=(const Status& x) const;
66
67 /// \brief If `ok()`, stores `new_status` into `*this`. If `!ok()`,
68 /// preserves the current status, but may augment with additional
69 /// information about `new_status`.
70 ///
71 /// Convenient way of keeping track of the first error encountered.
72 /// Instead of:
73 /// `if (overall_status.ok()) overall_status = new_status`
74 /// Use:
75 /// `overall_status.Update(new_status);`
76 void Update(const Status& new_status);
77
78 /// \brief Return a string representation of this status suitable for
79 /// printing. Returns the string `"OK"` for success.
80 string ToString() const;
81
82 // Ignores any errors. This method does nothing except potentially suppress
83 // complaints from any tools that are checking that errors are not dropped on
84 // the floor.
85 void IgnoreError() const;
86
87 private:
88 static const string& empty_string();
89 struct State {
90 tensorflow::error::Code code;
91 string msg;
92 };
93 // OK status has a `NULL` state_. Otherwise, `state_` points to
94 // a `State` structure containing the error code and message(s)
95 std::unique_ptr<State> state_;

Callers 15

AppendToMessageFunction · 0.70
MakeDerivedMethod · 0.70
as_summary_statusMethod · 0.70
TESTFunction · 0.70
OKMethod · 0.70
FileExistsMethod · 0.50
FilesExistMethod · 0.50
IsDirectoryMethod · 0.50
GetRedisMetaFunction · 0.50
SetActiveStatusMethod · 0.50
GetModelVersionMethod · 0.50

Calls

no outgoing calls

Tested by 12

TESTFunction · 0.56
FileExistsMethod · 0.40
FilesExistMethod · 0.40
IsDirectoryMethod · 0.40
CheckAndMutateRowMethod · 0.40
ReadModifyWriteRowMethod · 0.40
CompileAndPrintLlvmIrFunction · 0.40
TESTFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
TESTFunction · 0.40
TESTFunction · 0.40