first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / library / basis / common_outcomes.h
1 #ifndef COMMON_OUTCOMES_CLASS
2 #define COMMON_OUTCOMES_CLASS
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : common_outcomes                                                   *
7 *  Author : Chris Koeritz                                                     *
8 *                                                                             *
9 *******************************************************************************
10 * Copyright (c) 1991-$now By Author.  This program is free software; you can  *
11 * redistribute it and/or modify it under the terms of the GNU General Public  *
12 * License as published by the Free Software Foundation; either version 2 of   *
13 * the License or (at your option) any later version.  This is online at:      *
14 *     http://www.fsf.org/copyleft/gpl.html                                    *
15 * Please send any updates to: fred@gruntose.com                               *
16 \*****************************************************************************/
17
18 #include "outcome.h"
19
20 namespace basis {
21
22 //! the "common" class defines our common_outcomes.
23 class common
24 {
25 public:
26   //! these outcomes are returned by classes that use the basic HOOPLE support.
27   /*! More complicated classes will need to define their own outcome values to
28   describe what occurred during the processing of requests. */
29   enum outcomes {
30     DEFINE_API_OUTCOME(OKAY, 0, "Everything is just fine"),
31     DEFINE_API_OUTCOME(NOT_IMPLEMENTED, -1,
32         "The invoked method is unimplemented"),
33     DEFINE_API_OUTCOME(OUT_OF_RANGE, -2, "The value specified was out "
34         "of bounds"),
35     DEFINE_API_OUTCOME(NOT_FOUND, -3, "The item sought is not present"),
36     DEFINE_API_OUTCOME(BAD_INPUT, -4, "Precondition failure--the parameters "
37         "were inappropriate"),
38     DEFINE_API_OUTCOME(BAD_TYPE, -5, "The objects are of incompatible types"),
39     DEFINE_API_OUTCOME(IS_FULL, -6, "There is no room in the storage facility"),
40     DEFINE_API_OUTCOME(IS_EMPTY, -7, "The container is empty currently"),
41     DEFINE_API_OUTCOME(IS_NEW, -8, "The item is new"),
42     DEFINE_API_OUTCOME(EXISTING, -9, "The item was already present"),
43     DEFINE_API_OUTCOME(FAILURE, -10, "A failure has occurred"),
44     DEFINE_API_OUTCOME(OUT_OF_MEMORY, -11, "There is not enough memory for the "
45         "request according to the operating system"),
46     DEFINE_API_OUTCOME(ACCESS_DENIED, -12, "The request was denied, possibly "
47         "by the operating system"),
48     DEFINE_API_OUTCOME(IN_USE, -13, "The object is already in exclusive use"),
49     DEFINE_API_OUTCOME(UNINITIALIZED, -14, "The object has not been "
50         "constructed properly"),
51     DEFINE_API_OUTCOME(TIMED_OUT, -15, "The allowed time has now elapsed"),
52     DEFINE_API_OUTCOME(GARBAGE, -16, "The request or response has been "
53         "corrupted"),
54     DEFINE_API_OUTCOME(NO_SPACE, -17, "A programmatic limit on storage space "
55         "has been reached"),
56     DEFINE_API_OUTCOME(DISALLOWED, -18, "The method denied the request"),
57     DEFINE_API_OUTCOME(INCOMPLETE, -19, "The operation did not finish or the "
58         "object is not completed"),
59     DEFINE_API_OUTCOME(NO_HANDLER, -20, "The object type passed in was not "
60         "understood by the invoked method"),
61     DEFINE_API_OUTCOME(NONE_READY, -21, "There were no objects available"),
62     DEFINE_API_OUTCOME(INVALID, -22, "That request or object was invalid"),
63     DEFINE_API_OUTCOME(PARTIAL, -23, "The request was only partially finished"),
64     DEFINE_API_OUTCOME(NO_LICENSE, -24, "The software license does not permit"
65         "this request"),
66     DEFINE_API_OUTCOME(UNEXPECTED, -25, "This item was unexpected, although "
67         "not necessarily erroneous"),
68     DEFINE_API_OUTCOME(ENCRYPTION_MISMATCH, -26, "The request failed due to a "
69         "mismatch between encryption expected and encryption provided")
70   };
71
72   static const char *outcome_name(const outcome &to_name);
73     //!< Returns a string representation of the outcome "to_name".
74     /*!< If "to_name" is unknown, because it's not a member of the
75     common::outcomes enum, then a string reporting that is returned. */
76
77 }; //class.
78
79 } //namespace.
80
81 #endif // outer guard.
82