00001 /* Generated by Together */ 00002 00003 #ifndef MODELREP_H 00004 #define MODELREP_H 00005 #include "Any.h" 00006 #include "AspectRep.h" 00007 #include "RoleRep.h" 00008 #include "FCO.h" 00009 00010 class Sheet; 00015 #include "list" 00016 #include "map" 00017 #include "vector" 00018 00019 class ModelRep : public FCO 00020 { 00021 public: // constant strings 00022 static const std::string IsTypeInfoShown_str;//"IsTypeInfoShown" 00023 // types 00024 // roles 00025 typedef RoleRep RoleSeriesValue; 00026 typedef std::vector<RoleSeriesValue> RoleSeries; 00027 typedef RoleSeries::iterator RoleSeries_Iterator; 00028 typedef RoleSeries::const_iterator RoleSeries_ConstIterator; 00029 typedef FCO * RoleMapKey; 00030 typedef RoleSeries RoleMapValue; 00031 typedef std::map< RoleMapKey, RoleMapValue> RoleMap; 00032 typedef RoleMap::iterator RoleMap_Iterator; 00033 typedef RoleMap::const_iterator RoleMap_ConstIterator; 00034 // aspects 00035 typedef std::vector<AspectRep*> AspectRepPtrList; 00036 00037 public: 00038 ModelRep( BON::FCO& ptr, BON::FCO& resp_ptr); 00039 ~ModelRep(); 00040 00041 /*virtual*/ std::string doDump(); 00042 00043 inline Any::KIND_TYPE getMyKind() const { return Any::MODEL; } 00044 00045 /*virtual*/ void initAttributes(); 00046 00047 // Roles 00048 void addRole( RoleMapKey whose, RoleRep& role); 00049 void initRoles(); 00050 bool getRoles( FCO * ptr, RoleMapValue& ) const; 00051 00052 // Final roles 00053 void addFinalRole( RoleMapKey whose, RoleRep& role); 00054 bool getFinalRoles( const FCO * ptr, RoleMapValue& ) const; 00055 00056 // inner models 00057 std::vector< ModelRep *> getInnerModels() const; 00058 std::vector< ModelRep *> getInnerModelsFinal() const; 00059 std::vector< ReferenceRep *> getInnerModelReferencesFinal() const; 00060 00061 // aspects 00062 void addAspect( AspectRep * asp); 00063 const AspectRepPtrList& getAspectRepPtrList() const; 00064 // final 00065 const AspectRepPtrList& getFinalAspectRepPtrList() const; 00066 void addFinalAspect( AspectRep *); 00067 void addFinalAspectList(const AspectRepPtrList& l); 00068 00069 void getAspectNames( CStringList &list) const; 00070 00071 AspectRep * getFirstAspect() const; 00072 AspectRep * getMyFirstAspectFromSet( const std::vector<AspectRep *> & aspect_set) const; 00073 bool findAspect( const AspectRep * one_asp) const; 00074 00075 std::string dumpTypeInfoShown(); 00076 00077 // search 00078 public: 00079 int searchMyAspectsForPart( PartRep& part) const; // how many of my aspects contain part as an aspect member 00080 int howManyAspects() const; // how many aspects has this model 00081 00082 void createConstraints( Sheet *); 00083 bool checkMyAspects( Sheet *); 00084 void inherit(); 00085 00086 void sortMyAspects(); 00087 void createPartsInModelAspects(); 00088 00089 protected: 00090 RoleMap m_initialRoleMap; 00091 RoleMap m_finalRoleMap; 00092 00093 AspectRepPtrList m_initialAspectList; 00094 AspectRepPtrList m_finalAspectList; 00095 00096 bool m_bAttrIsTypeInfoShown; 00097 00098 private: // forbid copying 00099 ModelRep( const ModelRep&); 00100 const ModelRep& operator=( const ModelRep&); 00101 00102 }; 00103 #endif //MODELREP_H