outcome.h

Go to the documentation of this file.
00001 #ifndef OUTCOME_CLASS
00002 #define OUTCOME_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : outcome                                                           *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 1990-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "definitions.h"
00019 
00020 namespace basis {
00021 
00023 
00030 class outcome
00031 {
00032 public:
00033   outcome(int value = 0) : c_outcome_value(value) {}
00035 
00041   ~outcome() { c_outcome_value = 0; }  
00042 
00043   bool equal_to(const outcome &to_compare) const
00044       { return c_outcome_value == to_compare.c_outcome_value; }
00046 
00049   bool operator == (int to_compare) const
00050       { return c_outcome_value == to_compare; }
00052 
00053   int value() const { return c_outcome_value; }
00054     //<! returns the numerical value for the outcome.
00055 
00056   int packed_size() const { return 4; }
00058 
00061 private:
00062   int c_outcome_value;  //<! the numerical id for the outcome.
00063 };
00064 
00066 
00068 #define PROMOTE_OUTCOME(outc) \
00069   if (outc != common::OKAY) return outc
00070 
00072 
00074 
00080 #define DEFINE_OUTCOME(NAME, CURRENT_VALUE, INFO_STRING) \
00081   NAME = CURRENT_VALUE
00082 
00084 
00090 #define DEFINE_API_OUTCOME(NAME, CURRENT_VALUE, INFO_STRING) \
00091   NAME = CURRENT_VALUE
00092 
00094 
00095 } //namespace.
00096 
00097 #endif
00098 
Generated on Sat Jan 28 04:22:17 2012 for hoople2 project by  doxygen 1.6.3