00001 #ifndef ANY_H
00002 #define ANY_H
00003
00004 #include "BON.h"
00005 #include "BONImpl.h"
00006
00007 #include "Any.h"
00008 #include "string"
00009 #include "vector"
00010 #include "logger.h"
00011
00013 class Any;
00014 class ConstraintRep;
00015
00016 class AnyLexicographicSort
00017 {
00018 public:
00019 bool operator()( Any * op1, Any * op2) const;
00020 };
00021
00022 class Any
00023 {
00024 public:
00025 static const std::string NamespaceDelimiter_str;
00026 static const std::string InRootFolder_str;
00027 static const std::string DisplayedName_str;
00028 static const std::string GeneralPreferences_str;
00029
00030 static const std::string NameSelectorNode_str;
00031 static const std::string DisplayedNameSelectorNode_str;
00032 public:
00033 typedef enum
00034 {
00035 ATOM,
00036 MODEL,
00037 CONN,
00038 SET,
00039 REF,
00040 FCO_REP,
00041 ASPECT,
00042 FOLDER,
00043 CONSTRAINT,
00044 CONSTRAINTFUNC,
00045 ATTRIBUTE
00046 } KIND_TYPE;
00047
00048 const static std::string KIND_TYPE_STR[];
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 typedef std::vector< ConstraintRep* > ConstraintRepPtrList;
00064 typedef std::vector< ConstraintRep* >::const_iterator ConstraintRepPtrList_ConstIterator;
00065
00066 public:
00067 Any( BON::FCO& ptr);
00068 virtual ~Any();
00069
00070 public:
00071 virtual void initAttributes() {}
00072 void initNamespace();
00073 void resetNamespace();
00074 std::string getNamespace() const;
00075
00076 virtual KIND_TYPE getMyKind() const = 0;
00077 std::string getMyKindStr() const;
00078 virtual std::string doDump() = 0;
00079 virtual std::string getName() const;
00080 virtual std::string getDispName() const;
00081 virtual std::string dumpDispName() const;
00082 std::string dumpGeneralPref();
00083 virtual std::vector<Any*> getGeneralPrefAncestors() { return std::vector<Any*>(); }
00084
00085 std::string dumpConstraints();
00086
00087 BON::FCO getPtr() const { return m_ptr; }
00088
00089 bool isInRootFolder();
00090
00091 BON::Folder getParentFolder() const { return m_parentFolder; }
00092 void setParentFolder( const BON::Folder& writableRegFolder, const BON::Folder& nmspHolderFolder) { m_parentFolder = writableRegFolder; m_nmspRootFolder = nmspHolderFolder;}
00093 void setEquivPeers( const std::set< BON::FCO >& ps) { m_equivs = ps; }
00094 void setDisplayedName( const std::string& dispnm) { m_userSelectedDisplayName = dispnm; }
00095
00096 virtual std::string getMyPrefix() const;
00097 virtual BON::RegistryNode getMyRegistry() const;
00098 BON::RegistryNode getMyRegistryOld() const;
00099
00100 static std::string getMyPrefix( BON::FCO& fco, BON::Folder& f);
00101 static BON::RegistryNode getMyRegistry( BON::FCO& fco, BON::Folder& f);
00102
00103 bool isFCO() const;
00104 std::string askMetaRef(const std::string & tok = "") const;
00105
00106
00107 void addInitialConstraintRep( ConstraintRep * );
00108 const ConstraintRepPtrList& getInitialConstraintRepPtrList() const;
00109 void addFinalConstraint( ConstraintRep * constraint);
00110 void addFinalConstraintList( const ConstraintRepPtrList & list);
00111
00112 protected:
00113
00114 BON::FCO m_ptr;
00115
00116
00117
00118
00119
00120 BON::Folder m_parentFolder;
00121
00122
00123
00124 BON::Folder m_nmspRootFolder;
00125
00126
00127 std::set< BON::FCO > m_equivs;
00128 bool m_isInRootFolder;
00129 std::string m_sAttrGenPref;
00130
00131
00132 std::string m_userSelectedDisplayName;
00133
00134
00135 ConstraintRepPtrList m_initialConstraintList;
00136 ConstraintRepPtrList m_finalConstraintList;
00137
00138
00139 std::string m_namespace;
00140
00141 private:
00142 Any( const Any&);
00143 const Any& operator=( const Any&);
00144 };
00145
00146 #endif //ANY_H