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 #include <fstream>
00012 class Method;
00014 class Any;
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 NamespaceDispSeparatorBeg_str;
00026 static const std::string NamespaceDispSeparatorEnd_str;
00027 static const std::string NamespaceDelimiter_str;
00028 static const std::string InRootFolder_str;
00029 static const std::string NameSelectorNode_str;
00030
00031 static const std::string m_startUPToken;
00032 static const std::string m_endUPToken;
00033
00034 static const std::string MOFException_str;
00035 static const std::string MOFOperation_str;
00036 static const std::string MOFEnumeration_str;
00037 static const std::string MOFStructure_str;
00038 static const std::string MOFAlias_str;
00039
00040 static const std::string MOFStart_str;
00041 static const std::string MOFEnd_str;
00042
00043 public:
00044 typedef enum
00045 {
00046 ATOM,
00047 MODEL,
00048 CONN,
00049 SET,
00050 REF,
00051 FCO_REP,
00052 ASPECT,
00053 FOLDER,
00054 CONSTRAINT,
00055 CONSTRAINTFUNC,
00056 ATTRIBUTE
00057 } KIND_TYPE;
00058
00059 const static std::string KIND_TYPE_STR[];
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 public:
00075 Any( BON::FCO& ptr);
00076 virtual ~Any();
00077
00078 public:
00079 virtual void initAttributes();
00080 void initNamespace();
00081 void resetNamespace();
00082
00083 virtual KIND_TYPE getMyKind() const = 0;
00084 std::string getMyKindStr() const;
00085 virtual std::string doDump() = 0;
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 virtual std::string getName() const;
00099 std::string getValidName() const;
00100 std::string getValidNameImpl() const;
00101
00102
00103 std::string getStrictNmspc() const;
00104 std::string getNmspc() const;
00105 std::string getValidNmspc() const;
00106
00107
00108 std::string getLStrictName() const;
00109 std::string getLName() const;
00110 std::string getLValidName() const;
00111 std::string getLValidNameImpl() const;
00112
00113
00114 std::string getLStrictNmspc() const;
00115 std::string getLNmspc() const;
00116 std::string getLValidNmspc() const;
00117 BON::FCO getPtr() const { return m_ptr; }
00118 bool isInRootFolder();
00119
00120 BON::Folder getParentFolder() const { return m_parentFolder; }
00121 void setParentFolder( const BON::Folder& writableRegFolder, const BON::Folder& nmspHolderFolder) { m_parentFolder = writableRegFolder; m_nmspRootFolder = nmspHolderFolder;}
00122 void setEquivPeers( const std::set< BON::FCO >& ps) { m_equivs = ps; }
00123
00124 std::string getMyPrefix( int which = 0) const;
00125 BON::RegistryNode getMyRegistry() const;
00126 BON::RegistryNode getMIRegistry() const;
00127 bool isFCO() const;
00128
00129 static void convertToValidName( std::string & p);
00130 static bool checkIfValidName( const std::string & p);
00131
00132 virtual void prepare();
00133 virtual void prepareMacros();
00134 virtual void prepareIniFin();
00135 void prepareMOF();
00136 void createAcceptMethod( bool pWithTraversalOfKids, bool pSpecialized, bool pRetValBool);
00137
00138 void dumpGlobals();
00139 std::string dumpOrnament( bool is_abstract = false);
00140
00141 virtual void dumpPre( std::string & h_file, std::string & c_file);
00142 virtual void dumpPost( std::string & h_file, std::string & c_file);
00143 virtual std::string dumpClassHeader();
00144
00145
00146 std::string getUserPart();
00147
00148 bool isToBeEx() const;
00149 void toBeEx( bool t);
00150
00151 static std::string processMOFNode( const BON::RegistryNode& n, int ind = 2);
00152 static std::string parseMOFException( const std::string& exc_str);
00153 static std::string parseMOFOperation( const std::string& exc_str);
00154
00155 protected:
00156 public:
00157 void makeBackup();
00158 void initOutS();
00159 void initOutH( std::string& resu);
00160 void finiOutS();
00161 void finiOutH();
00162 protected:
00163 void sendOutS( const std::string& content );
00164 void sendOutH( const std::string& content );
00165 std::ofstream m_sStream;
00166 std::ofstream m_hStream;
00167
00168 protected:
00169
00170 BON::FCO m_ptr;
00171
00172
00173 BON::Folder m_parentFolder;
00174
00175
00176
00177 BON::Folder m_nmspRootFolder;
00178
00179
00180 std::set< BON::FCO > m_equivs;
00181 bool m_isInRootFolder;
00182
00183
00184 bool m_toEx;
00185
00186 std::vector< Method > m_inifinMethods;
00187 std::string m_sectionMOF;
00188 std::string m_globalHeader;
00189 std::string m_globalSource;
00190
00191
00192 std::string m_namespace;
00193
00194 private:
00195 Any( const Any&);
00196 const Any& operator=( const Any&);
00197 };
00198
00199 #endif //ANY_H