Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

relation_type.h

Go to the documentation of this file.
00001 /*  This file is part of OMCSNetCPP
00002 
00003     OMCSNetCPP is free software; you can redistribute it and/or modify
00004     it under the terms of the GNU Lesser General Public License as published by
00005     the Free Software Foundation; either version 2.1 of the License, or
00006     (at your option) any later version.
00007 
00008     OMCSNetCPP is distributed in the hope that it will be useful,
00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011     GNU Lesser General Public License for more details.
00012 
00013     You should have received a copy of the GNU Lesser General Public License
00014     along with OMCSNetCPP; if not, write to the Free Software
00015     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016  */
00017 
00020 #ifndef _RELATION_TYPE
00021 
00022 #define _RELATION_TYPE
00023 
00025 typedef int RelationType;
00026 
00028 static const RelationType RELATION_NONE = (-1);
00029 
00031 typedef enum
00032 {
00033         RELATION_CAPABLE_OF,
00034         RELATION_CAPABLE_OF_STATE,
00035         RELATION_DESIRES_EVENT,
00036         RELATION_DESIRES_NOT_EVENT,
00037         RELATION_DO,
00038         RELATION_EFFECT_OF,
00039         RELATION_EFFECT_OF_IS_STATE,
00040         RELATION_EVENT_FOR_GOAL_EVENT,
00041         RELATION_EVENT_FOR_GOAL_STATE,
00042         RELATION_EVENT_REQUIRES_OBJECT,
00043         RELATION_FIRST_SUB_EVENT_OF,
00044         RELATION_IS_A,
00045         RELATION_LAST_SUB_EVENT_OF,
00046         RELATION_LOCATION_OF,
00047         RELATION_MADE_OF,
00048         RELATION_OFTEN_NEAR,
00049         RELATION_PART_OF,
00050         RELATION_POST_EVENT_OF,
00051         RELATION_PROPERTY_OF,
00052         RELATION_SUB_EVENT_OF,
00053         RELATION_USED_FOR,
00054         MAX_RELATIONS,
00055 } RelationTypeValue;
00056 
00058 typedef struct RelationMapping
00059 {
00060         char              m_text[128];
00061 
00062         RelationTypeValue m_type;
00063 };
00064 
00066 static const RelationMapping g_RelationTypeNames[MAX_RELATIONS] =
00067 {
00068         {"CapableOf",           RELATION_CAPABLE_OF},
00069         {"CapableOfState",      RELATION_CAPABLE_OF_STATE},
00070         {"DesiresEvent",        RELATION_DESIRES_EVENT},
00071         {"DesiresNotEvent",     RELATION_DESIRES_NOT_EVENT},
00072         {"Do",                  RELATION_DO},
00073         {"EffectOf",            RELATION_EFFECT_OF},
00074         {"EffectOfIsState",     RELATION_EFFECT_OF_IS_STATE},
00075         {"EventForGoalEvent",   RELATION_EVENT_FOR_GOAL_EVENT},
00076         {"EventForGoalState",   RELATION_EVENT_FOR_GOAL_STATE},
00077         {"EventRequiresObject", RELATION_EVENT_REQUIRES_OBJECT},
00078         {"FirstSubeventOf",     RELATION_FIRST_SUB_EVENT_OF},
00079         {"IsA",                 RELATION_IS_A},
00080         {"LastSubeventOf",      RELATION_LAST_SUB_EVENT_OF},
00081         {"LocationOf",          RELATION_LOCATION_OF},
00082         {"MadeOf",              RELATION_MADE_OF},
00083         {"OftenNear",           RELATION_OFTEN_NEAR},
00084         {"PartOf",              RELATION_PART_OF},
00085         {"PostEventOf",         RELATION_POST_EVENT_OF},
00086         {"PropertyOf",          RELATION_PROPERTY_OF},
00087         {"SubeventOf",          RELATION_SUB_EVENT_OF},
00088         {"UsedFor",             RELATION_USED_FOR}
00089 };
00090 
00091 
00093 class CRelationTypeLookup
00094 {
00095         public:
00097                 std::string Lookup(const RelationType a_type)
00098                 {
00099                         if (a_type < MAX_RELATIONS)
00100                         {
00101                                 return g_RelationTypeNames[a_type].m_text;
00102                         }
00103 
00104                         return "";
00105                 }
00106 
00108                 RelationType Lookup(const std::string &a_name)
00109                 {
00110                         for (u_int i = 0;i < MAX_RELATIONS;++i)
00111                         {
00112                                 if (g_RelationTypeNames[i].m_text ==
00113                                     a_name)
00114                                 {
00115                                         return g_RelationTypeNames[i].m_type;
00116                                 }
00117                         }
00118                 
00119                         return RELATION_NONE;
00120                 }
00121 
00122         private:
00123 };
00124 
00125 #endif
00126 

Generated on Tue Sep 16 09:43:50 2003 for OMCSNetCPP by doxygen 1.3.3