SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Status.h
1 //=========================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //=========================================================================
10 #ifndef smtk_common_Status_h
11 #define smtk_common_Status_h
12 
13 #include "smtk/CoreExports.h"
14 
15 namespace smtk
16 {
17 namespace common
18 {
19 
30 class SMTKCORE_EXPORT Status
31 {
32 public:
33  Status() = default;
34  Status(const Status&) = default;
35  Status(Status&&) = default;
36  Status& operator=(const Status&) = default;
37 
39  bool success() const { return m_success; }
41  bool modified() const { return m_modified; }
43  bool markModified();
45  bool markFailed();
50  Status& operator&=(const Status& other);
51  operator bool() const;
52 
53 protected:
54  bool m_success{ true };
55  bool m_modified{ false };
56 };
57 
58 } // namespace common
59 } // namespace smtk
60 
61 #endif // smtk_common_Status_h
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::common::Status::modified
bool modified() const
Return whether a method modified its object (true) or not (false).
Definition: Status.h:41
smtk::common::Status::success
bool success() const
Return whether or not a method succeeded (true) or not (false).
Definition: Status.h:39
smtk::common::Status
A return value for methods that need to indicate both success/failure and modification/stasis.
Definition: Status.h:30