00001 #ifndef REFERENCEREP_H 00002 #define REFERENCEREP_H 00003 00004 #include "Any.h" 00005 #include "FCO.h" 00006 #include "vector" 00007 #include "AspectRep.h" 00008 00009 class ReferenceRep : public FCO 00010 { 00011 public: // types 00012 typedef std::vector<FCO *> RefereeList; 00013 typedef std::vector<FCO *>::iterator RefereeList_Iterator; 00014 typedef std::vector<FCO *>::const_iterator RefereeList_ConstIterator; 00015 00016 public: 00017 ReferenceRep( BON::FCO& ptr, BON::FCO& resp_ptr); 00018 ~ReferenceRep(); 00019 00020 /*virtual*/ std::string doDump(); 00021 std::string dumpShowPorts() const; 00022 00023 inline Any::KIND_TYPE getMyKind() const { return Any::REF; } 00024 00025 void addInitialReferee( FCO * refd ); 00026 FCO * getInitialReferee() const; 00027 const RefereeList& getInitialReferees() const; 00028 00029 void addFinalReferees( FCO * referee); 00030 void addFinalReferees( RefereeList & referees); 00031 const RefereeList& getFinalReferees() const; 00032 00033 void setShowPorts(bool set) { m_showPorts = set; } 00034 00035 bool finalize(); 00036 void inherit(); 00037 00038 bool pointsToModels() const; // true if points to models as well 00039 std::vector<const ModelRep *> getModelRefVector() const; 00040 00041 bool checkNotEmpty() const; 00042 00043 // aspect related 00044 int howManyAspectsAmongModelRefs() const; 00045 std::vector<AspectRep *> getAspectsIntersection() const; 00046 AspectRep * getFirstAspectFromIntersection() const; 00047 00048 protected: 00049 // initialy "this" refers to 00050 RefereeList m_initialReferees; 00051 // finally "this" refers to 00052 RefereeList m_finalReferees; 00053 // member that contains all the referees (including multiple steps by referring to a reference) 00054 // this reference may look like all of m_allReferees 00055 // i.e. ( ref1 -> ref2 -> model) ref1 looks like model 00056 // plays role at connection dump 00057 // it should be named m_transitiveReferences 00058 RefereeList m_allReferees; 00059 bool m_showPorts; 00060 00061 private: // forbiding copy 00062 ReferenceRep( const ReferenceRep&); 00063 const ReferenceRep& operator=( const ReferenceRep&); 00064 00065 }; 00066 00067 #endif //REFERENCEREP_H