#ifndef OUTCOME_CLASS #define OUTCOME_CLASS /*****************************************************************************\ * * * Name : outcome * * Author : Chris Koeritz * * * ******************************************************************************* * Copyright (c) 1990-$now By Author. This program is free software; you can * * redistribute it and/or modify it under the terms of the GNU General Public * * License as published by the Free Software Foundation; either version 2 of * * the License or (at your option) any later version. This is online at: * * http://www.fsf.org/copyleft/gpl.html * * Please send any updates to: fred@gruntose.com * \*****************************************************************************/ #include "definitions.h" namespace basis { //! Outcomes describe the state of completion for an operation. /*! These are an extremely simple representation of a non-exceptional exit value as an integer. The range of expression is from 0 to MAXINT. Outcomes are meant to represent the category of 'how' the operation completed; they do not carry along any results of 'what' was produced. */ class outcome { public: outcome(int value = 0) : c_outcome_value(value) {} //!< Represents the completion of an operation as a particular "value". /*!< The outcomes partition the input space of the operation and represent the different conclusions possible during processing. Values for outcomes must be maintained on a system-wide basis as unique identifiers for them to be meaningful. Note that zero is reserved as a default outcome value. This usually translates to an outcome of OKAY. */ ~outcome() { c_outcome_value = 0; } //!< destructor resets outcome value. bool equal_to(const outcome &to_compare) const { return c_outcome_value == to_compare.c_outcome_value; } //!< Returns true if this outcome is equal to "to_compare". /*!< comparisons between outcomes will operate properly provided that all system-wide outcome values are unique. */ bool operator == (int to_compare) const { return c_outcome_value == to_compare; } //!< Returns true if this outcome is equal to the integer "to_compare". int value() const { return c_outcome_value; } //