00001 #ifndef ROLEREP_H 00002 #define ROLEREP_H 00003 00004 class ConnectionRep; 00005 class ConnJoint; 00006 class ModelRep; 00007 class SetRep; 00008 class AtomRep; 00009 class ReferenceRep; 00010 class FCO; 00011 00012 #include "string" 00013 #include "list" 00014 #include "vector" 00015 00016 class StringLex 00017 { 00018 public: 00019 bool operator()( const std::string& peer1, const std::string& peer2) const; 00020 }; 00021 00022 00023 class RoleRep { 00024 00025 public: 00026 00027 typedef std::vector<RoleRep> RoleRepSeries; 00028 typedef RoleRepSeries::iterator RoleRepSeries_Iterator; 00029 typedef RoleRepSeries::const_iterator RoleRepSeries_ConstIterator; 00030 00031 RoleRep( 00032 const std::string &role_name, 00033 FCO* ptr, 00034 ModelRep* model_ptr, 00035 bool is_port, 00036 const std::string &cardinality, 00037 bool inh_role, 00038 bool long_form); 00039 00040 RoleRep( const RoleRep & peer) ; 00041 const RoleRep& operator=( const RoleRep & peer); 00042 bool operator==( const RoleRep& peer) const; 00043 bool operator!=( const RoleRep& peer) const; 00044 00045 friend bool operator<(const RoleRep&, const RoleRep&); 00046 //bool operator<(const RoleRep& peer) const; 00047 00048 const std::string& getOnlyRoleName() const; 00049 std::string getSmartRoleName() const; 00050 00051 FCO * getFCOPtr() const; 00052 ModelRep * getModelRepPtr() const; 00053 bool isPort() const; 00054 const std::string& getCardinality() const; 00055 00056 void setInheritedRole( bool val); 00057 bool isInheritedRole() const; 00058 00059 void setLongForm( bool val); 00060 bool isLongForm() const; 00061 00062 private: 00063 std::string m_roleName; 00064 FCO* m_ptr; 00065 ModelRep * m_model; 00066 bool m_isPort; 00067 std::string m_cardinality; 00068 00069 // shows if a role is inherited from an ancestor 00070 // M<>----r-B 00071 // | 00072 // D 00073 bool m_inheritedRole; 00074 00075 // in the case above for B the short role name form of "r" cannot be used 00076 // because it can be confusing. It refers to a B or a D? 00077 // so in such cases the long form is to be used: Br, Dr 00078 bool m_longForm; 00079 00080 }; 00081 #endif //ROLEREP_H