GME
13
|
00001 //############################################################################################################################################### 00002 // 00003 // Object Constraint Language Generic Manager 00004 // OCLTypeExGMEEC.cpp 00005 // 00006 //############################################################################################################################################### 00007 #include "Solve4786.h" 00008 #include "OCLTypeExGMEEC.h" 00009 #include "OCLObjectExBasic.h" 00010 00011 namespace OclGmeEC 00012 { 00013 typedef OclCommon::FormalParameterVector FPV; 00014 typedef OclCommon::FormalParameter FP; 00015 typedef TypeSeq TS; 00016 00017 //############################################################################################################################################## 00018 // 00019 // T Y P E O F ocl::String 00020 // 00021 //############################################################################################################################################## 00022 00023 void TStringEx_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00024 { 00025 ( ( OclBasic::TString_MethodFactory ) *this ).GetFeatures( signature, vecFeatures ); 00026 00027 std::string strName = signature.GetName(); 00028 int iCount = signature.GetParameterCount(); 00029 TS vecType; 00030 FPV vecParams; 00031 00032 if ( ( strName == "intValue" ) && iCount == 0 ) { 00033 vecType.push_back( "ocl::Integer" ); 00034 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00035 return; 00036 } 00037 00038 if ( ( strName == "doubleValue" ) && iCount == 0 ) { 00039 vecType.push_back( "ocl::Real" ); 00040 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00041 return; 00042 } 00043 00044 if ( ( strName == "size" ) && iCount == 0 ) { 00045 vecType.push_back( "ocl::Integer" ); 00046 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00047 return; 00048 } 00049 00050 if ( ( strName == "match" && iCount == 1 ) ) { 00051 vecParams.push_back( FP( "regExp", "ocl::String", true ) ); 00052 vecType.push_back( "ocl::Boolean" ); 00053 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00054 } 00055 }; 00056 00057 //############################################################################################################################################## 00058 // 00059 // T Y P E O F ocl::Collection 00060 // 00061 //############################################################################################################################################## 00062 00063 void TCollectionEx_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00064 { 00065 ( ( OclBasic::TCollection_MethodFactory ) *this ).GetFeatures( signature, vecFeatures ); 00066 00067 std::string strName = signature.GetName(); 00068 int iCount = signature.GetParameterCount(); 00069 TS vecType; 00070 FPV vecParams; 00071 00072 if ( ( strName == "size" ) && iCount == 0 ) { 00073 vecType.push_back( "ocl::Integer" ); 00074 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00075 return; 00076 } 00077 00078 if ( ( strName == "theOnly" ) && iCount == 0 ) { 00079 vecType.push_back( TYPE_AGGREGATED_OBJECT ); 00080 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00081 return; 00082 } 00083 }; 00084 00085 //############################################################################################################################################## 00086 // 00087 // T Y P E O F gme::Project 00088 // 00089 //############################################################################################################################################## 00090 00091 void TProject_AttributeFactory::GetFeatures( const OclSignature::Attribute& signature, OclMeta::AttributeVector& vecFeatures ) 00092 { 00093 std::string strName = signature.GetName(); 00094 TS vecType; 00095 00096 if ( strName == "name" ) { 00097 vecType.push_back( "ocl::String" ); 00098 vecFeatures.push_back( new OclMeta::Attribute( strName, vecType, NULL, false ) ); 00099 } 00100 } 00101 00102 void TProject_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00103 { 00104 std::string strName = signature.GetName(); 00105 int iCount = signature.GetParameterCount(); 00106 FPV vecParams; 00107 TS vecType; 00108 00109 if ( strName == "allInstancesOf" && iCount == 1 ) { 00110 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00111 vecType.push_back( "ocl::Set" ); 00112 vecType.push_back( "gme::Object" ); 00113 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00114 } 00115 00116 if ( strName == "rootFolder" && iCount == 0 ) { 00117 vecType.push_back( "meta::RootFolder" ); 00118 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00119 } 00120 } 00121 00122 //############################################################################################################################################## 00123 // 00124 // T Y P E O F gme::Object 00125 // 00126 //############################################################################################################################################## 00127 00128 void TObject_AttributeFactory::GetFeatures( const OclSignature::Attribute& signature, OclMeta::AttributeVector& vecFeatures ) 00129 { 00130 std::string strName = signature.GetName(); 00131 TS vecType; 00132 00133 if ( strName == "name" ) { 00134 vecType.push_back( "ocl::String" ); 00135 vecFeatures.push_back( new OclMeta::Attribute( strName, vecType, NULL, false ) ); 00136 return; 00137 } 00138 00139 if ( strName == "kindName" ) { 00140 vecType.push_back( "ocl::String" ); 00141 vecFeatures.push_back( new OclMeta::Attribute( strName, vecType, NULL, false ) ); 00142 return; 00143 } 00144 00145 if ( strName == "metaKindName" ) { 00146 vecType.push_back( "ocl::String" ); 00147 vecFeatures.push_back( new OclMeta::Attribute( strName, vecType, NULL, false ) ); 00148 return; 00149 } 00150 } 00151 00152 void TObject_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00153 { 00154 std::string strName = signature.GetName(); 00155 int iCount = signature.GetParameterCount(); 00156 FPV vecParams; TS vecType; 00157 00158 if ( ( strName == "name" ) && iCount == 0 ) { 00159 vecType.push_back( "ocl::String" ); 00160 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00161 return; 00162 } 00163 00164 if ( ( strName == "kindName" ) && iCount == 0 ) { 00165 vecType.push_back( "ocl::String" ); 00166 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00167 return; 00168 } 00169 00170 if ( ( strName == "isNull" ) && iCount == 0 ) { 00171 vecType.push_back( "ocl::Boolean" ); 00172 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00173 return; 00174 } 00175 00176 if ( ( strName == "parent" ) && iCount == 0 ) { 00177 vecType.push_back( "gme::Object" ); 00178 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00179 return; 00180 } 00181 00182 if ( ( strName == "isFCO" ) && iCount == 0 ) { 00183 vecType.push_back( "ocl::Boolean" ); 00184 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00185 return; 00186 } 00187 00188 if ( ( strName == "isFolder" ) && iCount == 0 ) { 00189 vecType.push_back( "ocl::Boolean" ); 00190 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00191 return; 00192 } 00193 } 00194 00195 //############################################################################################################################################## 00196 // 00197 // T Y P E O F gme::Folder 00198 // 00199 //############################################################################################################################################## 00200 00201 void TFolder_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00202 { 00203 std::string strName = signature.GetName(); 00204 int iCount = signature.GetParameterCount(); 00205 00206 if ( ( strName == "folders" ) && iCount == 0 ) { 00207 FPV vecParams; TS vecType; 00208 vecType.push_back( "ocl::Set" ); 00209 vecType.push_back( "gme::Folder" ); 00210 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00211 } 00212 00213 if ( ( strName == "childFolders" ) && iCount == 0 ) { 00214 FPV vecParams; TS vecType; 00215 vecType.push_back( "ocl::Set" ); 00216 vecType.push_back( "gme::Folder" ); 00217 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00218 } 00219 00220 if ( ( strName == "rootDescendants" ) && iCount == 0 ) { 00221 FPV vecParams; TS vecType; 00222 vecType.push_back( "ocl::Set" ); 00223 vecType.push_back( "gme::FCO" ); 00224 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00225 } 00226 00227 if ( ( strName == "allDescendants" ) && iCount == 0 ) { 00228 FPV vecParams; TS vecType; 00229 vecType.push_back( "ocl::Set" ); 00230 vecType.push_back( "gme::FCO" ); 00231 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00232 } 00233 00234 if ( ( strName == "rootChildren" ) && iCount == 0 ) { 00235 FPV vecParams; TS vecType; 00236 vecType.push_back( "ocl::Set" ); 00237 vecType.push_back( "gme::FCO" ); 00238 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00239 } 00240 00241 if ( ( strName == "models" ) && iCount == 1 ) { 00242 FPV vecParams; TS vecType; 00243 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00244 vecType.push_back( "ocl::Set" ); 00245 vecType.push_back( "gme::Model" ); 00246 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00247 } 00248 00249 if ( ( strName == "models" ) && iCount <= 1 ) { 00250 FPV vecParams; TS vecType; 00251 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00252 vecType.push_back( "ocl::Set" ); 00253 vecType.push_back( "gme::Model" ); 00254 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00255 } 00256 00257 if ( ( strName == "atoms" ) && iCount == 1 ) { 00258 FPV vecParams; TS vecType; 00259 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00260 vecType.push_back( "ocl::Set" ); 00261 vecType.push_back( "gme::Atom" ); 00262 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00263 } 00264 00265 if ( ( strName == "atoms" ) && iCount <= 1 ) { 00266 FPV vecParams; TS vecType; 00267 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00268 vecType.push_back( "ocl::Set" ); 00269 vecType.push_back( "gme::Atom" ); 00270 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00271 } 00272 } 00273 00274 //############################################################################################################################################## 00275 // 00276 // T Y P E O F gme::FCO 00277 // 00278 //############################################################################################################################################## 00279 00280 void TFCO_AttributeFactory::GetFeatures( const OclSignature::Attribute& signature, OclMeta::AttributeVector& vecFeatures ) 00281 { 00282 std::string strName = signature.GetName(); 00283 TS vecType; 00284 00285 if ( strName == "roleName" ) { 00286 vecType.push_back( "ocl::String" ); 00287 vecFeatures.push_back( new OclMeta::Attribute( strName, vecType, NULL, false ) ); 00288 return; 00289 } 00290 } 00291 00292 void TFCO_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00293 { 00294 std::string strName = signature.GetName(); 00295 int iCount = signature.GetParameterCount(); 00296 if ( ( strName == "roleName" ) && iCount == 0 ) { 00297 FPV vecParams; TS vecType; 00298 vecType.push_back( "ocl::String" ); 00299 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00300 } 00301 00302 if ( ( strName == "subTypes" ) && iCount == 0 ) { 00303 FPV vecParams; TS vecType; 00304 vecType.push_back( "ocl::Set" ); 00305 vecType.push_back( "gme::FCO" ); 00306 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00307 } 00308 00309 if ( ( strName == "instances" ) && iCount == 0 ) { 00310 FPV vecParams; TS vecType; 00311 vecType.push_back( "ocl::Set" ); 00312 vecType.push_back( "gme::FCO" ); 00313 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00314 } 00315 00316 if ( ( strName == "type" ) && iCount == 0 ) { 00317 FPV vecParams; TS vecType; 00318 vecType.push_back( "gme::FCO" ); 00319 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00320 } 00321 00322 if ( ( strName == "baseType" ) && iCount == 0 ) { 00323 FPV vecParams; TS vecType; 00324 vecType.push_back( "gme::FCO" ); 00325 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00326 } 00327 00328 if ( ( strName == "isInstance" ) && iCount == 0 ) { 00329 FPV vecParams; TS vecType; 00330 vecType.push_back( "ocl::Boolean" ); 00331 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00332 } 00333 00334 if ( ( strName == "isType" ) && iCount == 0 ) { 00335 FPV vecParams; TS vecType; 00336 vecType.push_back( "ocl::Boolean" ); 00337 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00338 } 00339 00340 if ( ( strName == "folder" ) && iCount == 0 ) { 00341 FPV vecParams; TS vecType; 00342 vecType.push_back( "gme::Folder" ); 00343 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00344 } 00345 00346 if ( ( strName == "referencedBy" ) && iCount == 1 ) { 00347 FPV vecParams; TS vecType; 00348 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00349 vecType.push_back( "ocl::Set" ); 00350 vecType.push_back( "gme::Reference" ); 00351 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00352 } 00353 00354 if ( ( strName == "referencedBy" ) && iCount <= 1 ) { 00355 FPV vecParams; TS vecType; 00356 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00357 vecType.push_back( "ocl::Set" ); 00358 vecType.push_back( "gme::Reference" ); 00359 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00360 } 00361 00362 if ( ( strName == "memberOfSets" ) && iCount == 1 ) { 00363 FPV vecParams; TS vecType; 00364 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00365 vecType.push_back( "ocl::Set" ); 00366 vecType.push_back( "gme::Set" ); 00367 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00368 } 00369 00370 if ( ( strName == "memberOfSets" ) && iCount <= 1 ) { 00371 FPV vecParams; TS vecType; 00372 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00373 vecType.push_back( "ocl::Set" ); 00374 vecType.push_back( "gme::Set" ); 00375 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00376 } 00377 00378 if ( ( strName == "connectedFCOs" ) && iCount == 2 ) { 00379 FPV vecParams; TS vecType; 00380 vecParams.push_back( FP( "role", "ocl::String", true ) ); 00381 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00382 vecType.push_back( "ocl::Set" ); 00383 vecType.push_back( "gme::FCO" ); 00384 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00385 } 00386 00387 if ( ( strName == "connectedFCOs" ) && iCount <= 2 ) { 00388 FPV vecParams; TS vecType; 00389 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00390 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00391 vecType.push_back( "ocl::Set" ); 00392 vecType.push_back( "gme::FCO" ); 00393 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00394 } 00395 00396 if ( ( strName == "connectedFCOs" ) && iCount == 1 ) { 00397 FPV vecParams; TS vecType; 00398 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00399 vecType.push_back( "ocl::Set" ); 00400 vecType.push_back( "gme::FCO" ); 00401 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00402 } 00403 00404 if ( ( strName == "connected" ) && iCount <= 2 ) { 00405 FPV vecParams; TS vecType; 00406 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00407 vecParams.push_back( FP( "kind", "ocl::String", false ) ); 00408 vecType.push_back( "ocl::Set" ); 00409 vecType.push_back( "gme::FCO" ); 00410 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00411 } 00412 00413 if ( ( strName == "bagConnectedFCOs" ) && iCount <= 2 ) { 00414 FPV vecParams; TS vecType; 00415 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00416 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00417 vecType.push_back( "ocl::Bag" ); 00418 vecType.push_back( "gme::FCO" ); 00419 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00420 } 00421 00422 if ( ( strName == "bagConnectedFCOs" ) && iCount == 1 ) { 00423 FPV vecParams; TS vecType; 00424 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00425 vecType.push_back( "ocl::Bag" ); 00426 vecType.push_back( "gme::FCO" ); 00427 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00428 } 00429 00430 if ( ( strName == "reverseConnectedFCOs" ) && iCount == 2 ) { 00431 FPV vecParams; TS vecType; 00432 vecParams.push_back( FP( "role", "ocl::String", true ) ); 00433 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00434 vecType.push_back( "ocl::Set" ); 00435 vecType.push_back( "gme::FCO" ); 00436 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00437 } 00438 00439 if ( ( strName == "reverseConnectedFCOs" ) && iCount <= 2 ) { 00440 FPV vecParams; TS vecType; 00441 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00442 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00443 vecType.push_back( "ocl::Set" ); 00444 vecType.push_back( "gme::FCO" ); 00445 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00446 } 00447 00448 if ( ( strName == "reverseConnectedFCOs" ) && iCount == 1 ) { 00449 FPV vecParams; TS vecType; 00450 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00451 vecType.push_back( "ocl::Set" ); 00452 vecType.push_back( "gme::FCO" ); 00453 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00454 } 00455 00456 if ( ( strName == "connectedAs" ) && iCount <= 2 ) { 00457 FPV vecParams; TS vecType; 00458 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00459 vecParams.push_back( FP( "kind", "ocl::String", false ) ); 00460 vecType.push_back( "ocl::Set" ); 00461 vecType.push_back( "gme::FCO" ); 00462 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00463 } 00464 00465 if ( ( strName == "bagReverseConnectedFCOs" ) && iCount <= 2 ) { 00466 FPV vecParams; TS vecType; 00467 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00468 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00469 vecType.push_back( "ocl::Bag" ); 00470 vecType.push_back( "gme::FCO" ); 00471 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00472 } 00473 00474 if ( ( strName == "bagReverseConnectedFCOs" ) && iCount == 1 ) { 00475 FPV vecParams; TS vecType; 00476 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00477 vecType.push_back( "ocl::Bag" ); 00478 vecType.push_back( "gme::FCO" ); 00479 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00480 } 00481 00482 if ( ( strName == "attachingConnPoints" ) && iCount == 2 ) { 00483 FPV vecParams; TS vecType; 00484 vecParams.push_back( FP( "role", "ocl::String", true ) ); 00485 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00486 vecType.push_back( "ocl::Set" ); 00487 vecType.push_back( "gme::ConnectionPoint" ); 00488 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00489 } 00490 00491 if ( ( strName == "attachingConnPoints" ) && iCount <= 2 ) { 00492 FPV vecParams; TS vecType; 00493 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00494 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00495 vecType.push_back( "ocl::Set" ); 00496 vecType.push_back( "gme::ConnectionPoint" ); 00497 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00498 } 00499 00500 if ( ( strName == "attachingConnPoints" ) && iCount == 1 ) { 00501 FPV vecParams; TS vecType; 00502 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00503 vecType.push_back( "ocl::Set" ); 00504 vecType.push_back( "gme::ConnectionPoint" ); 00505 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00506 } 00507 00508 if ( ( strName == "attachingConnections" ) && iCount == 2 ) { 00509 FPV vecParams; TS vecType; 00510 vecParams.push_back( FP( "role", "ocl::String", true ) ); 00511 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00512 vecType.push_back( "ocl::Set" ); 00513 vecType.push_back( "gme::Connection" ); 00514 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00515 } 00516 00517 if ( ( strName == "attachingConnections" ) && iCount <= 2 ) { 00518 FPV vecParams; TS vecType; 00519 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00520 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00521 vecType.push_back( "ocl::Set" ); 00522 vecType.push_back( "gme::Connection" ); 00523 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00524 } 00525 00526 if ( ( strName == "attachingConnections" ) && iCount == 1 ) { 00527 FPV vecParams; TS vecType; 00528 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00529 vecType.push_back( "ocl::Set" ); 00530 vecType.push_back( "gme::Connection" ); 00531 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00532 } 00533 00534 if ( ( strName == "isConnectedTo" ) && iCount == 3 ) { 00535 FPV vecParams; TS vecType; 00536 vecParams.push_back( FP( "fco", "gme::FCO", true ) ); 00537 vecParams.push_back( FP( "role", "ocl::String", true ) ); 00538 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00539 vecType.push_back( "ocl::Boolean" ); 00540 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00541 } 00542 00543 if ( ( strName == "isConnectedTo" ) && iCount <= 3 && iCount >= 1 ) { 00544 FPV vecParams; TS vecType; 00545 vecParams.push_back( FP( "fco", "gme::FCO", true ) ); 00546 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00547 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00548 vecType.push_back( "ocl::Boolean" ); 00549 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00550 } 00551 00552 if ( ( strName == "isConnectedTo" ) && iCount == 2 ) { 00553 FPV vecParams; TS vecType; 00554 vecParams.push_back( FP( "fco", "gme::FCO", true ) ); 00555 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00556 vecType.push_back( "ocl::Boolean" ); 00557 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00558 } 00559 00560 if ( ( strName == "attribute" ) && iCount == 1 ) { 00561 FPV vecParams; TS vecType; 00562 vecParams.push_back( FP( "name", "ocl::String", true ) ); 00563 vecType.push_back( "ocl::Any" ); 00564 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00565 } 00566 //---- 00567 if ( ( strName == "attrByDefault" ) && iCount == 1 ) { 00568 FPV vecParams; TS vecType; 00569 vecParams.push_back( FP( "name", "ocl::String", true ) ); 00570 vecType.push_back( "ocl::Boolean" ); 00571 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00572 } 00573 //---- 00574 } 00575 00576 //############################################################################################################################################## 00577 // 00578 // T Y P E O F gme::Connection 00579 // 00580 //############################################################################################################################################## 00581 00582 void TConnection_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00583 { 00584 std::string strName = signature.GetName(); 00585 int iCount = signature.GetParameterCount(); 00586 FPV vecParams; 00587 TS vecType; 00588 00589 if ( ( strName == "connectionPoints" ) && iCount <= 1 ) { 00590 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00591 vecType.push_back( "ocl::Set" ); 00592 vecType.push_back( "gme::ConnectionPoint" ); 00593 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00594 return; 00595 } 00596 00597 if ( ( strName == "connectionPoint" ) && iCount == 1 ) { 00598 vecParams.push_back( FP( "role", "ocl::String", true ) ); 00599 vecType.push_back( "gme::ConnectionPoint" ); 00600 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00601 return; 00602 } 00603 } 00604 00605 //############################################################################################################################################## 00606 // 00607 // T Y P E O F gme::Reference 00608 // 00609 //############################################################################################################################################## 00610 00611 void TReference_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00612 { 00613 std::string strName = signature.GetName(); 00614 int iCount = signature.GetParameterCount(); 00615 00616 if ( ( strName == "usedByConnPoints" ) && iCount == 1 ) { 00617 FPV vecParams; TS vecType; 00618 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00619 vecType.push_back( "ocl::Set" ); 00620 vecType.push_back( "gme::ConnectionPoint" ); 00621 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00622 } 00623 00624 if ( ( strName == "usedByConnPoints" ) && iCount <= 1 ) { 00625 FPV vecParams; TS vecType; 00626 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00627 vecType.push_back( "ocl::Set" ); 00628 vecType.push_back( "gme::ConnectionPoint" ); 00629 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00630 } 00631 00632 if ( ( strName == "refersTo" ) && iCount == 0 ) { 00633 FPV vecParams; TS vecType; 00634 vecType.push_back( "gme::FCO" ); 00635 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00636 } 00637 } 00638 00639 //############################################################################################################################################## 00640 // 00641 // T Y P E O F gme::Model 00642 // 00643 //############################################################################################################################################## 00644 00645 void TModel_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00646 { 00647 std::string strName = signature.GetName(); 00648 int iCount = signature.GetParameterCount(); 00649 00650 if ( ( strName == "models" ) && iCount == 1 ) { 00651 FPV vecParams; TS vecType; 00652 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00653 vecType.push_back( "ocl::Set" ); 00654 vecType.push_back( "gme::Model" ); 00655 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00656 } 00657 00658 if ( ( strName == "models" ) && iCount <= 1 ) { 00659 FPV vecParams; TS vecType; 00660 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00661 vecType.push_back( "ocl::Set" ); 00662 vecType.push_back( "gme::Model" ); 00663 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00664 } 00665 00666 if ( ( strName == "atoms" ) && iCount == 1 ) { 00667 FPV vecParams; TS vecType; 00668 vecParams.push_back( FP( "kind", "ocl::String", true ) ); 00669 vecType.push_back( "ocl::Set" ); 00670 vecType.push_back( "gme::Atom" ); 00671 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00672 } 00673 00674 if ( ( strName == "atoms" ) && iCount <= 1 ) { 00675 FPV vecParams; TS vecType; 00676 vecParams.push_back( FP( "kind", "ocl::Type", false ) ); 00677 vecType.push_back( "ocl::Set" ); 00678 vecType.push_back( "gme::Atom" ); 00679 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00680 } 00681 00682 if ( ( strName == "parts" ) && iCount <= 1 ) { 00683 FPV vecParams; TS vecType; 00684 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00685 vecType.push_back( "ocl::Set" ); 00686 vecType.push_back( "gme::FCO" ); 00687 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00688 } 00689 00690 if ( ( strName == "modelParts" ) && iCount <= 1 ) { 00691 FPV vecParams; TS vecType; 00692 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00693 vecType.push_back( "ocl::Set" ); 00694 vecType.push_back( "gme::Model" ); 00695 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00696 } 00697 00698 if ( ( strName == "atomParts" ) && iCount <= 1 ) { 00699 FPV vecParams; TS vecType; 00700 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00701 vecType.push_back( "ocl::Set" ); 00702 vecType.push_back( "gme::Atom" ); 00703 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00704 } 00705 00706 if ( ( strName == "connectionParts" ) && iCount <= 1 ) { 00707 FPV vecParams; TS vecType; 00708 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00709 vecType.push_back( "ocl::Set" ); 00710 vecType.push_back( "gme::Connection" ); 00711 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00712 } 00713 00714 if ( ( strName == "referenceParts" ) && iCount <= 1 ) { 00715 FPV vecParams; TS vecType; 00716 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00717 vecType.push_back( "ocl::Set" ); 00718 vecType.push_back( "gme::Reference" ); 00719 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00720 } 00721 00722 if ( ( strName == "setParts" ) && iCount <= 1 ) { 00723 FPV vecParams; TS vecType; 00724 vecParams.push_back( FP( "role", "ocl::String", false ) ); 00725 vecType.push_back( "ocl::Set" ); 00726 vecType.push_back( "gme::Set" ); 00727 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00728 } 00729 00730 if ( ( strName == "parts" ) && iCount == 1 ) { 00731 FPV vecParams; TS vecType; 00732 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00733 vecType.push_back( "ocl::Set" ); 00734 vecType.push_back( "gme::FCO" ); 00735 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00736 } 00737 00738 if ( ( strName == "modelParts" ) && iCount == 1 ) { 00739 FPV vecParams; TS vecType; 00740 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00741 vecType.push_back( "ocl::Set" ); 00742 vecType.push_back( "gme::Model" ); 00743 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00744 } 00745 00746 if ( ( strName == "atomParts" ) && iCount == 1 ) { 00747 FPV vecParams; TS vecType; 00748 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00749 vecType.push_back( "ocl::Set" ); 00750 vecType.push_back( "gme::Atom" ); 00751 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00752 } 00753 00754 if ( ( strName == "connectionParts" ) && iCount == 1 ) { 00755 FPV vecParams; TS vecType; 00756 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00757 vecType.push_back( "ocl::Set" ); 00758 vecType.push_back( "gme::Connection" ); 00759 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00760 } 00761 00762 if ( ( strName == "referenceParts" ) && iCount == 1 ) { 00763 FPV vecParams; TS vecType; 00764 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00765 vecType.push_back( "ocl::Set" ); 00766 vecType.push_back( "gme::Reference" ); 00767 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00768 } 00769 00770 if ( ( strName == "setParts" ) && iCount == 1 ) { 00771 FPV vecParams; TS vecType; 00772 vecParams.push_back( FP( "kind", "ocl::Type", true ) ); 00773 vecType.push_back( "ocl::Set" ); 00774 vecType.push_back( "gme::Set" ); 00775 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00776 } 00777 } 00778 00779 //############################################################################################################################################## 00780 // 00781 // T Y P E O F gme::Atom 00782 // 00783 //############################################################################################################################################## 00784 00785 //############################################################################################################################################## 00786 // 00787 // T Y P E O F gme::Set 00788 // 00789 //############################################################################################################################################## 00790 00791 void TSet_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00792 { 00793 std::string strName = signature.GetName(); 00794 int iCount = signature.GetParameterCount(); 00795 FPV vecParams; 00796 TS vecType; 00797 00798 if ( ( strName == "members" ) && iCount == 0 ) { 00799 vecType.push_back( "ocl::Set" ); 00800 vecType.push_back( "gme::FCO" ); 00801 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00802 return; 00803 } 00804 } 00805 00806 //############################################################################################################################################## 00807 // 00808 // T Y P E O F gme::ConnectionPoint 00809 // 00810 //############################################################################################################################################## 00811 00812 void TConnectionPoint_AttributeFactory::GetFeatures( const OclSignature::Attribute& signature, OclMeta::AttributeVector& vecFeatures ) 00813 { 00814 std::string strName = signature.GetName(); 00815 TS vecType; 00816 00817 if ( strName == "cpRoleName" ) { 00818 vecType.push_back( "ocl::String" ); 00819 vecFeatures.push_back( new OclMeta::Attribute( strName, vecType, NULL, false ) ); 00820 return; 00821 } 00822 } 00823 00824 void TConnectionPoint_MethodFactory::GetFeatures( const OclSignature::Method& signature, OclMeta::MethodVector& vecFeatures ) 00825 { 00826 std::string strName = signature.GetName(); 00827 int iCount = signature.GetParameterCount(); 00828 FPV vecParams; 00829 TS vecType; 00830 00831 if ( ( strName == "cpRoleName" ) && iCount == 0 ) { 00832 vecType.push_back( "ocl::String" ); 00833 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00834 return; 00835 } 00836 00837 if ( ( strName == "owner" ) && iCount == 0 ) { 00838 vecType.push_back( "gme::Connection" ); 00839 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00840 return; 00841 } 00842 00843 if ( ( strName == "target" ) && iCount == 0 ) { 00844 vecType.push_back( "gme::FCO" ); 00845 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00846 return; 00847 } 00848 00849 if ( ( strName == "peer" ) && iCount == 0 ) { 00850 vecType.push_back( "gme::ConnectionPoint" ); 00851 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00852 return; 00853 } 00854 00855 if ( ( strName == "usedReferences" ) && iCount == 0 ) { 00856 vecType.push_back( "ocl::Sequence" ); 00857 vecType.push_back( "gme::FCO" ); 00858 vecFeatures.push_back( new OclMeta::Method( strName, vecParams, vecType, NULL, false ) ); 00859 return; 00860 } 00861 } 00862 00863 //############################################################################################################################################## 00864 // 00865 // T Y P E O F D E R I V E D O F gme::FCO 00866 // 00867 //############################################################################################################################################## 00868 00869 TFCODerived_AttributeFactory::TFCODerived_AttributeFactory( CComPtr<IMgaFCO> spFCO ) 00870 : m_spFCO( spFCO ) 00871 { 00872 } 00873 00874 void TFCODerived_AttributeFactory::GetFeatures( const OclSignature::Attribute& signature, OclMeta::AttributeVector& vecFeatures ) 00875 { 00876 OclCommonEx::FCOVector vecExamined; 00877 GetAttributeObjects( signature.GetName(), m_spFCO, vecFeatures, vecExamined ); 00878 } 00879 00880 void TFCODerived_AttributeFactory::GetAttributeObjects( const std::string& strName, CComPtr<IMgaFCO> spFCO, OclMeta::AttributeVector& vecFeatures, OclCommonEx::FCOVector& vecExamined ) 00881 { 00882 if ( OclCommonEx::ContainsObject( spFCO, vecExamined ) ) 00883 return; 00884 vecExamined.push_back( spFCO.p ); 00885 00886 OclCommonEx::FCOVector vecAttributes; 00887 OclCommonEx::GetAssociationEnds( spFCO, "dst", "HasAttribute", vecAttributes ); 00888 for ( unsigned int i = 0 ; i < vecAttributes.size() ; i++ ) { 00889 if ( strName == OclCommonEx::GetObjectName( vecAttributes[ i ].p ) ) { 00890 std::string strKind = OclCommonEx::GetObjectKind( vecAttributes[ i ].p ); 00891 std::string strReturnType; 00892 if ( strKind == "EnumAttribute" ) 00893 strReturnType = "ocl::Enumeration"; 00894 else 00895 if ( strKind == "BooleanAttribute" ) 00896 strReturnType = "ocl::Boolean"; 00897 else { 00898 CComVariant objAType; 00899 COMTHROW( vecAttributes[ i ]->get_AttributeByName( CComBSTR( "DataType" ), PutOut( objAType ) ) ); 00900 CString strFieldType = objAType.bstrVal; 00901 if ( strFieldType == "integer" ) 00902 strReturnType = "ocl::Integer"; 00903 else 00904 if ( strFieldType == "double" ) 00905 strReturnType = "ocl::Real"; 00906 else 00907 strReturnType = "ocl::String"; 00908 } 00909 vecFeatures.push_back( new OclMeta::Attribute( strName, TS( 1, strReturnType ), NULL, true ) ); 00910 } 00911 } 00912 00913 OclCommonEx::FCOVector vecParents; 00914 OclCommonEx::GetInheritances( spFCO, "Normal", true, vecParents ); 00915 OclCommonEx::GetInheritances( spFCO, "Implementation", true, vecParents ); 00916 for ( unsigned int i = 0 ; i < vecParents.size() ; i++ ) 00917 GetAttributeObjects( strName, vecParents[ i ].p, vecFeatures, vecExamined ); 00918 00919 CComPtr<IMgaFCOs> spRefs; 00920 if ( OclCommonEx::GetAllObjects( spFCO, spRefs ) && spRefs.p ) { 00921 MGACOLL_ITERATE( IMgaFCO, spRefs ) { 00922 GetAttributeObjects( strName, MGACOLL_ITER, vecFeatures, vecExamined ); 00923 } MGACOLL_ITERATE_END; 00924 } 00925 GetAttributeObjects( strName, spFCO, vecFeatures, vecExamined ); 00926 } 00927 00928 //############################################################################################################################################## 00929 // 00930 // T Y P E F A C T O R Y 00931 // 00932 //############################################################################################################################################## 00933 00934 TypeFactory::TypeFactory( CComPtr<IMgaProject> spProject ) 00935 : m_spProject( spProject ) 00936 { 00937 } 00938 00939 void TypeFactory::GetTypes( const std::string& strName, const std::string& strNSpace, std::vector<std::unique_ptr<OclMeta::Type>>& vecTypes, std::string& strNameResult ) 00940 { 00941 strNameResult = strName; 00942 bool bHasNamespace = strName.find( "::" ) != std::string::npos; 00943 00944 GetDynamicTypes( strName, vecTypes, strNameResult); 00945 if ( ! bHasNamespace && ! vecTypes.empty() ) 00946 return; 00947 00948 GetStereotypes( strName, vecTypes ); 00949 if ( ! bHasNamespace && ! vecTypes.empty() ) 00950 return; 00951 00952 if ( strName == "ocl::Any" || strName == "Any" ) { 00953 StringVector vecSupers; 00954 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "ocl::Any", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TAny_MethodFactory(), false ) )); 00955 return; 00956 } 00957 00958 if ( strName == "ocl::Boolean" || strName == "bool" ) { 00959 StringVector vecSupers; 00960 vecSupers.push_back( "ocl::Any" ); 00961 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "ocl::Boolean", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclImplementation::MethodFactory(), false ) )); 00962 return; 00963 } 00964 00965 if ( strName == "ocl::Enumeration" || strName == "enum" ) { 00966 StringVector vecSupers; 00967 vecSupers.push_back( "ocl::Any" ); 00968 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "ocl::Enumeration", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TEnumeration_MethodFactory(), false ) )); 00969 return; 00970 } 00971 00972 if ( strName == "ocl::String" || strName == "string" ) { 00973 StringVector vecSupers; 00974 vecSupers.push_back( "ocl::Any" ); 00975 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "ocl::String", vecSupers, new OclBasic::TString_AttributeFactory(), new OclImplementation::AssociationFactory(), new TStringEx_MethodFactory(), false ) )); 00976 return; 00977 } 00978 00979 if ( strName == "ocl::Real" || strName == "real" || strName == "double" ) { 00980 StringVector vecSupers; 00981 vecSupers.push_back( "ocl::Any" ); 00982 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "ocl::Real", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TReal_MethodFactory(), false ) )); 00983 return; 00984 } 00985 00986 if ( strName == "ocl::Integer" || strName == "int" || strName == "long" ) { 00987 StringVector vecSupers; 00988 vecSupers.push_back( "ocl::Real" ); 00989 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "ocl::Integer", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TInteger_MethodFactory(), false ) )); 00990 return; 00991 } 00992 00993 if ( strName == "ocl::Type" || strName == "Type" ) { 00994 StringVector vecSupers; 00995 vecSupers.push_back( "ocl::Any" ); 00996 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "ocl::Type", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclImplementation::MethodFactory(), false ) )); 00997 return; 00998 } 00999 01000 if ( strName == "ocl::Collection" || strName == "Collection" ) { 01001 StringVector vecSupers; 01002 vecSupers.push_back( "ocl::Any" ); 01003 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::CompoundType( "ocl::Collection", vecSupers, new OclBasic::TCollection_AttributeFactory(), new OclImplementation::AssociationFactory(), new TCollectionEx_MethodFactory(),new OclBasic::TCollection_IteratorFactory(), false ) )); 01004 return; 01005 } 01006 01007 if ( strName == "ocl::Set" || strName == "Set" ) { 01008 StringVector vecSupers; 01009 vecSupers.push_back( "ocl::Collection" ); 01010 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::CompoundType( "ocl::Set", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TSet_MethodFactory,new OclBasic::TSet_IteratorFactory(), false ) )); 01011 return; 01012 } 01013 01014 if ( strName == "ocl::Sequence" || strName == "Sequence" ) { 01015 StringVector vecSupers; 01016 vecSupers.push_back( "ocl::Collection" ); 01017 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::CompoundType( "ocl::Sequence", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TSequence_MethodFactory(),new OclBasic::TSequence_IteratorFactory(), false ) )); 01018 return; 01019 } 01020 01021 if ( strName == "ocl::Bag" || strName == "Bag" ) { 01022 StringVector vecSupers; 01023 vecSupers.push_back( "ocl::Collection" ); 01024 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::CompoundType( "ocl::Bag", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TBag_MethodFactory(),new OclBasic::TBag_IteratorFactory(), false ) )); 01025 return; 01026 } 01027 01028 // -- ?? 01029 if ( strName == "ocl::OrderedSet" || strName == "OrderedSet" ) { 01030 StringVector vecSupers; 01031 vecSupers.push_back( "ocl::Set" ); 01032 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::CompoundType( "ocl::OrderedSet", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclBasic::TOrderedSet_MethodFactory(),new OclBasic::TOrderedSet_IteratorFactory(), false ) )); 01033 return; 01034 } 01035 // -- 01036 } 01037 01038 void TypeFactory::GetStereotypes( const std::string& strName, std::vector<std::unique_ptr<OclMeta::Type>>& vecTypes ) 01039 { 01040 if ( strName == "gme::Object" || strName == "Object" ) { 01041 StringVector vecSupers; 01042 vecSupers.push_back( "ocl::Any" ); 01043 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Object", vecSupers, new TObject_AttributeFactory(), new OclImplementation::AssociationFactory(), new TObject_MethodFactory(), true ) )); 01044 return; 01045 } 01046 01047 if ( strName == "gme::Folder" || strName == "Folder" ) { 01048 StringVector vecSupers; 01049 vecSupers.push_back( "gme::Object" ); 01050 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Folder", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new TFolder_MethodFactory(), true ) )); 01051 return; 01052 } 01053 01054 if ( strName == "gme::FCO" || strName == "FCO" ) { 01055 StringVector vecSupers; 01056 vecSupers.push_back( "gme::Object" ); 01057 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::FCO", vecSupers, new TFCO_AttributeFactory(), new OclImplementation::AssociationFactory(), new TFCO_MethodFactory(), true ) )); 01058 return; 01059 } 01060 01061 if ( strName == "gme::Model" || strName == "Model" ) { 01062 StringVector vecSupers; 01063 vecSupers.push_back( "gme::FCO" ); 01064 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Model", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new TModel_MethodFactory(), true ) )); 01065 return; 01066 } 01067 01068 if ( strName == "gme::Atom" || strName == "Atom" ) { 01069 StringVector vecSupers; 01070 vecSupers.push_back( "gme::FCO" ); 01071 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Atom", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclImplementation::MethodFactory(), true ) )); 01072 return; 01073 } 01074 01075 if ( strName == "gme::Set" || strName == "Set" ) { 01076 StringVector vecSupers; 01077 vecSupers.push_back( "gme::FCO" ); 01078 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Set", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new TSet_MethodFactory(), true ) )); 01079 return; 01080 } 01081 01082 if ( strName == "gme::Reference" || strName == "Reference" ) { 01083 StringVector vecSupers; 01084 vecSupers.push_back( "gme::FCO" ); 01085 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Reference", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new TReference_MethodFactory(), true ) )); 01086 return; 01087 } 01088 01089 if ( strName == "gme::Connection" || strName == "Connection" ) { 01090 StringVector vecSupers; 01091 vecSupers.push_back( "gme::FCO" ); 01092 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Connection", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new TConnection_MethodFactory(), true ) )); 01093 return; 01094 } 01095 01096 if ( strName == "gme::Project" || strName == "Project" ) { 01097 StringVector vecSupers; 01098 vecSupers.push_back( "ocl::Any" ); 01099 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::Project", vecSupers, new TProject_AttributeFactory(), new OclImplementation::AssociationFactory(), new TProject_MethodFactory(), true ) )); 01100 return; 01101 } 01102 01103 if ( strName == "gme::ConnectionPoint" || strName == "ConnPoint" || strName == "ConnectionPoint" ) { 01104 StringVector vecSupers; 01105 vecSupers.push_back( "ocl::Any" ); 01106 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "gme::ConnectionPoint", vecSupers, new TConnectionPoint_AttributeFactory(), new OclImplementation::AssociationFactory(), new TConnectionPoint_MethodFactory(), true ) )); 01107 return; 01108 } 01109 01110 if ( strName == "meta::RootFolder" || strName == "RootFolder" ) { 01111 StringVector vecSupers; 01112 vecSupers.push_back( "gme::Folder" ); 01113 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "meta::RootFolder", vecSupers, new OclImplementation::AttributeFactory(), new OclImplementation::AssociationFactory(), new OclImplementation::MethodFactory(), true ) )); 01114 return; 01115 } 01116 } 01117 01118 void TypeFactory::GetDynamicTypes( const std::string& strName, std::vector<std::unique_ptr<OclMeta::Type>>& vecTypes, std::string& ) 01119 { 01120 std::string strRealName = strName; 01121 if ( strName.size() > 6 && strName.substr( 0, 6 ) == "meta::" ) 01122 strRealName = strName.substr( 6 ); 01123 01124 01125 01126 CComPtr<IMgaFilter> spFilter; 01127 COMTHROW( m_spProject->CreateFilter( &spFilter ) ); 01128 COMTHROW( spFilter->put_Name( CComBSTR( OclCommonEx::Convert( strRealName ) ) ) ); 01129 COMTHROW( spFilter->put_ObjType( CComBSTR( "OBJTYPE_ATOM" ) ) ); 01130 01131 CComPtr<IMgaFCOs> spFCOs; 01132 COMTHROW( m_spProject->AllFCOs( spFilter, &spFCOs ) ); 01133 MGACOLL_ITERATE( IMgaFCO, spFCOs ) { 01134 std::string strStereotype = OclCommonEx::GetObjectKind( MGACOLL_ITER.p ); 01135 if ( strStereotype == "Atom" || strStereotype == "Model" || strStereotype == "Connection" || strStereotype == "Reference" || strStereotype == "Set" || strStereotype == "Folder" || strStereotype == "FCO" ) { 01136 01137 if ( strRealName == OclCommonEx::GetObjectName( MGACOLL_ITER.p ) ) { 01138 if ( OclCommonEx::IsAbstract( MGACOLL_ITER ) ) 01139 throw OclCommon::Exception( OclCommon::Exception::ET_SEMANTIC, "Type [ ? ] is not available in Constraints or ConstraintFunctions because it is abstract.", strName ); 01140 01141 OclImplementation::AttributeFactory* pAttFactory = NULL; 01142 OclImplementation::AssociationFactory* pAssFactory = new OclImplementation::AssociationFactory(); 01143 std::string strSupertype; 01144 01145 if ( strStereotype == "Atom" ) { 01146 strSupertype = "gme::Atom"; 01147 pAttFactory = new TFCODerived_AttributeFactory( MGACOLL_ITER ); 01148 } 01149 else if ( strStereotype == "Model" ) { 01150 strSupertype = "gme::Model"; 01151 pAttFactory = new TFCODerived_AttributeFactory( MGACOLL_ITER ); 01152 } 01153 else if ( strStereotype == "Connection" ) { 01154 strSupertype = "gme::Connection"; 01155 pAttFactory = new TFCODerived_AttributeFactory( MGACOLL_ITER ); 01156 } 01157 else if ( strStereotype == "Set" ) { 01158 strSupertype = "gme::Set"; 01159 pAttFactory = new TFCODerived_AttributeFactory( MGACOLL_ITER ); 01160 } 01161 else if ( strStereotype == "Reference" ) { 01162 strSupertype = "gme::Reference"; 01163 pAttFactory = new TFCODerived_AttributeFactory( MGACOLL_ITER ); 01164 } 01165 else if ( strStereotype == "Folder" ) { 01166 strSupertype = "gme::Folder"; 01167 pAttFactory = new OclImplementation::AttributeFactory(); 01168 } 01169 01170 vecTypes.push_back(std::unique_ptr<OclMeta::Type>( new OclMeta::Type( "meta::" + strRealName, StringVector( 1, strSupertype ), pAttFactory, pAssFactory, new OclImplementation::MethodFactory(), true ) )); 01171 } 01172 } 01173 } MGACOLL_ITERATE_END; 01174 } 01175 01176 }; // namespace OclGmeCM