GME
13
|
00001 00002 #include "stdafx.h" 00003 00004 void CreateCoreMetaProject(CComPtr<ICoreMetaProject> &project) 00005 { 00006 ASSERT( project == NULL ); 00007 00008 COMTHROW( project.CoCreateInstance(OLESTR("MGA.CoreMetaProject")) ); 00009 00010 COMTHROW( project->put_Token(PutInBstr("MgaMetaProject")) ); 00011 COMTHROW( project->put_Name(PutInBstr("MgaMetaProject")) ); 00012 00013 ::GUID guid = {0x028F7AA4,0x2E51,0x11D3,{0xB3,0x17,0x00,0x62,0x08,0x2D,0xF8,0x85}}; 00014 COMTHROW( project->put_GUID(PutInVariant(guid)) ); 00015 00016 // ------- Macros 00017 00018 CComObjPtr<ICoreMetaObject> object; 00019 00020 #define CREATE_OBJECT(metaid, token, name) \ 00021 object.Release(); \ 00022 COMTHROW( project->AddObject(metaid, \ 00023 PutInBstr(token), PutInBstr(name), PutOut(object)) ); 00024 00025 #define CREATE_POINTER(metaid, token, name) \ 00026 COMTHROW( object->AddAttribute((metaid), \ 00027 PutInBstr(token), PutInBstr(name), VALTYPE_POINTER, NULL) ); 00028 00029 #define CREATE_COLLECTION(metaid, token, name) \ 00030 COMTHROW( object->AddAttribute((metaid) + ATTRID_COLLECTION, \ 00031 PutInBstr(token), PutInBstr(name), VALTYPE_COLLECTION, NULL) ); 00032 00033 #define CREATE_ATTRIBUTE(metaid, token, name, valtype) \ 00034 COMTHROW( object->AddAttribute((metaid), \ 00035 PutInBstr(token), PutInBstr(name), valtype, NULL) ); 00036 00037 #define CLSID_PUSH(clsid) \ 00038 { CComVariant id; CopyTo(clsid, id); COMTHROW( object->AddClassID(id) ); } 00039 00040 // ------- Common 00041 00042 #define DECLARE_COMMON() \ 00043 CREATE_ATTRIBUTE(ATTRID_LOCK, "ObjLock", "Object Lock", VALTYPE_LOCK); 00044 00045 // ------- Base 00046 00047 #define DECLARE_BASE() \ 00048 DECLARE_COMMON(); \ 00049 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Name", VALTYPE_STRING); \ 00050 CREATE_ATTRIBUTE(ATTRID_METAREF, "MetaRef", "Meta ID",VALTYPE_METAREF); \ 00051 CREATE_ATTRIBUTE(ATTRID_DISPNAME, "DispName", "Displayed Name", VALTYPE_STRING); \ 00052 CREATE_COLLECTION(ATTRID_REGNODES_COLL, "RegNodes", "Registry Nodes"); \ 00053 CREATE_COLLECTION(ATTRID_CONSTRAINT_PTR, "Constraints", "Constraints"); 00054 00055 // ------- Folder 00056 00057 #define DECLARE_FOLDER() \ 00058 DECLARE_BASE(); \ 00059 CREATE_POINTER(ATTRID_DEFFOLDER_PTR, "FolderParent", "Defined In"); \ 00060 CREATE_COLLECTION(ATTRID_DEFFOLDER_PTR, "DefinedFolders", "Defined Folders"); \ 00061 CREATE_COLLECTION(ATTRID_DEFFCO_PTR, "DefinedFCOs", "Defined FCOs"); \ 00062 CREATE_COLLECTION(ATTRID_DEFATTR_PTR, "DefinedAttributes", "Defined Attributes"); \ 00063 CREATE_COLLECTION(ATTRID_FOLDERLINK_PARENT_PTR, "LegalFolders", "Legal Child Folders"); \ 00064 CREATE_COLLECTION(ATTRID_FOLDERLINK_CHILD_PTR, "LegalParents", "Used In Folders"); \ 00065 CREATE_COLLECTION(ATTRID_ROOTOBJLINK_FOLDER_PTR, "ObjectLinks", "Legal Root Objects"); 00066 00067 CREATE_OBJECT(METAID_METAFOLDER, "MetaFolder", "Meta Folder"); 00068 DECLARE_FOLDER(); 00069 CLSID_PUSH(__uuidof(MgaMetaFolder)); 00070 00071 CREATE_OBJECT(METAID_METAFOLDERLINK, "MetaFolderLink", "Meta Folder Link"); 00072 DECLARE_COMMON(); 00073 CREATE_POINTER(ATTRID_FOLDERLINK_PARENT_PTR, "Parent", "Parent"); 00074 CREATE_POINTER(ATTRID_FOLDERLINK_CHILD_PTR, "Child", "Child"); 00075 00076 CREATE_OBJECT(METAID_METAROOTOBJLINK, "MetaRootObjLink", "Meta Root Object Link"); 00077 DECLARE_COMMON(); 00078 CREATE_POINTER(ATTRID_ROOTOBJLINK_FOLDER_PTR, "Folder", "Folder"); 00079 CREATE_POINTER(ATTRID_ROOTOBJLINK_OBJECT_PTR, "Object", "Object"); 00080 00081 // ------- Project 00082 00083 CREATE_OBJECT(METAID_METAPROJECT, "MetaProject", "Meta Project"); 00084 DECLARE_FOLDER(); 00085 CREATE_ATTRIBUTE(ATTRID_PARNAME, "ParName", "Paradigm Name", VALTYPE_STRING); 00086 CREATE_ATTRIBUTE(ATTRID_PARDISPNAME, "ParDispName", "Displayed Name", VALTYPE_STRING); \ 00087 CREATE_ATTRIBUTE(ATTRID_GUID, "ParGUID", "Paradigm GUID", VALTYPE_BINARY); 00088 CREATE_ATTRIBUTE(ATTRID_VERSION, "Version", "Paradigm Version", VALTYPE_STRING); 00089 CREATE_ATTRIBUTE(ATTRID_AUTHOR, "Author", "Paradigm Author", VALTYPE_STRING); 00090 CREATE_ATTRIBUTE(ATTRID_COMMENT, "Comment", "Comment", VALTYPE_STRING); 00091 CREATE_ATTRIBUTE(ATTRID_CDATE, "CDate", "Create Date", VALTYPE_DATE); 00092 CREATE_ATTRIBUTE(ATTRID_MDATE, "MDate", "Modification Date", VALTYPE_DATE); 00093 CLSID_PUSH(__uuidof(MgaMetaFolder)); 00094 00095 // ------- FCO 00096 00097 #define DECLARE_FCO() \ 00098 DECLARE_BASE() \ 00099 CREATE_POINTER(ATTRID_DEFFCO_PTR, "ObjectParent", "Defined In"); \ 00100 CREATE_COLLECTION(ATTRID_DEFATTR_PTR, "DefinedAttributes", "Defined Attributes"); \ 00101 CREATE_COLLECTION(ATTRID_KIND_PTR, "UsedInRoles", "Used In Roles"); \ 00102 CREATE_COLLECTION(ATTRID_ROOTOBJLINK_OBJECT_PTR, "FolderLinks", "Used In Folders"); \ 00103 CREATE_COLLECTION(ATTRID_ATTRLINK_USEDIN_PTR, "Attributes", "Attributes");\ 00104 /* CREATE_ATTRIBUTE(ATTRID_ALIASENABLED, "AliasEnab", "Aliases Enabled", VALTYPE_LONG) */ ; 00105 00106 // ------- Model 00107 00108 CREATE_OBJECT(METAID_METAMODEL, "MetaModel", "Meta Model"); 00109 DECLARE_FCO(); 00110 CREATE_COLLECTION(ATTRID_DEFFCO_PTR, "DefinedFCOs", "Defined FCOs"); 00111 CREATE_COLLECTION(ATTRID_ROLES_COLL, "Roles", "Roles"); 00112 CREATE_COLLECTION(ATTRID_ASPECTS_COLL, "Aspects", "Aspects"); 00113 CLSID_PUSH(__uuidof(MgaMetaModel)); 00114 00115 // ------- Aspect 00116 00117 CREATE_OBJECT(METAID_METAASPECT, "MetaAspect", "Meta Aspect"); 00118 DECLARE_BASE(); 00119 CREATE_POINTER(ATTRID_ASPECTS_COLL, "Model", "Model"); 00120 CREATE_COLLECTION(ATTRID_PARTASPECT_PTR, "AspectParts", "Parts"); 00121 CREATE_COLLECTION(ATTRID_ATTRLINK_USEDIN_PTR, "Attributes", "Attributes"); 00122 CLSID_PUSH(__uuidof(MgaMetaAspect)); 00123 00124 // ------- Role 00125 00126 CREATE_OBJECT(METAID_METAROLE, "MetaRole", "Meta Role"); 00127 DECLARE_BASE(); 00128 CREATE_POINTER(ATTRID_ROLES_COLL, "ParentModel", "Parent Model"); 00129 CREATE_COLLECTION(ATTRID_PARTROLE_PTR, "RoleParts", "Parts"); 00130 CREATE_POINTER(ATTRID_KIND_PTR, "Kind", "Kind"); 00131 CLSID_PUSH(__uuidof(MgaMetaRole)); 00132 00133 // ------- Part 00134 00135 CREATE_OBJECT(METAID_METAPART, "MetaPart", "Meta Part"); 00136 DECLARE_BASE(); 00137 CREATE_POINTER(ATTRID_PARTROLE_PTR, "Role", "Role"); 00138 CREATE_POINTER(ATTRID_PARTASPECT_PTR, "Aspect", "Aspect"); 00139 CREATE_ATTRIBUTE(ATTRID_PARTDATA, "Data", "Part Data", VALTYPE_LONG); 00140 CREATE_ATTRIBUTE(ATTRID_KINDASPECT, "KindAspect", "Kind Aspect", VALTYPE_STRING); 00141 CLSID_PUSH(__uuidof(MgaMetaPart)); 00142 00143 // ------- Atom 00144 00145 CREATE_OBJECT(METAID_METAATOM, "MetaAtom", "Meta Atom"); 00146 DECLARE_FCO(); 00147 CLSID_PUSH(__uuidof(MgaMetaAtom)); 00148 00149 // ------- Attribute 00150 00151 CREATE_OBJECT(METAID_METAATTRIBUTE, "MetaAttribute", "Meta Attribute"); 00152 DECLARE_BASE(); 00153 CREATE_POINTER(ATTRID_DEFATTR_PTR, "AttrParent", "Defined In"); 00154 CREATE_COLLECTION(ATTRID_ATTRLINK_ATTR_PTR, "AttrLinks", "Used In"); 00155 CREATE_ATTRIBUTE(ATTRID_VALUE, "Value", "Default Value", VALTYPE_STRING); 00156 CREATE_ATTRIBUTE(ATTRID_ATTVALTYPE, "ValType", "Value Type", VALTYPE_LONG); 00157 CREATE_ATTRIBUTE(ATTRID_VIEWABLE, "Viewable", "Viewable", VALTYPE_LONG); 00158 CREATE_COLLECTION(ATTRID_ENUMITEMS_COLL, "EnumItems", "Enum Items"); 00159 CLSID_PUSH(__uuidof(MgaMetaAttribute)); 00160 00161 CREATE_OBJECT(METAID_METAATTRLINK, "MetaAttrLink", "Meta Attribute Link"); 00162 DECLARE_COMMON(); 00163 CREATE_POINTER(ATTRID_ATTRLINK_USEDIN_PTR, "AttrUsedIn", "Used In"); 00164 CREATE_POINTER(ATTRID_ATTRLINK_ATTR_PTR, "Attribute", "Attribute"); 00165 00166 // ------- PointerSpec 00167 00168 #define DECLARE_POINTERSPEC() \ 00169 CREATE_ATTRIBUTE(ATTRID_PTRSPECNAME, "SpecName", "Pointer Spec Name", VALTYPE_STRING); \ 00170 CREATE_COLLECTION(ATTRID_PTRITEMS_COLL, "Items", "Pointer Items"); 00171 00172 CREATE_OBJECT(METAID_METAPOINTERSPEC, "MetaPointerSpec", "Meta Pointer Specification"); 00173 DECLARE_COMMON(); 00174 DECLARE_POINTERSPEC(); 00175 CREATE_POINTER(ATTRID_PTRSPECS_COLL, "SpecParent", "Parent"); 00176 CLSID_PUSH(__uuidof(MgaMetaPointerSpec)); 00177 00178 // ------- PointerItem 00179 00180 CREATE_OBJECT(METAID_METAPOINTERITEM, "MetaPointerItem", "Meta Pointer Item"); 00181 DECLARE_COMMON(); 00182 CREATE_POINTER(ATTRID_PTRITEMS_COLL, "ItemParent", "Parent"); 00183 CREATE_ATTRIBUTE(ATTRID_PTRITEMDESC, "Desc", "Description", VALTYPE_STRING); 00184 CLSID_PUSH(__uuidof(MgaMetaPointerItem)); 00185 00186 // ------- Reference 00187 00188 CREATE_OBJECT(METAID_METAREFERENCE, "MetaReference", "Meta Reference"); 00189 DECLARE_FCO(); 00190 DECLARE_POINTERSPEC(); 00191 CLSID_PUSH(__uuidof(MgaMetaReference)); 00192 CLSID_PUSH(__uuidof(MgaMetaPointerSpec)); 00193 00194 // ------- Set 00195 00196 CREATE_OBJECT(METAID_METASET, "MetaSet", "Meta Set"); 00197 DECLARE_FCO(); 00198 DECLARE_POINTERSPEC(); 00199 CLSID_PUSH(__uuidof(MgaMetaSet)); 00200 CLSID_PUSH(__uuidof(MgaMetaPointerSpec)); 00201 00202 // ------- Connection 00203 00204 CREATE_OBJECT(METAID_METACONNECTION, "MetaConnection", "Meta Connection"); 00205 DECLARE_FCO(); 00206 CREATE_COLLECTION(ATTRID_CONNJOINTS_COLL, "Joints", "Connection Joints"); 00207 CLSID_PUSH(__uuidof(MgaMetaConnection)); 00208 00209 // ------- ConnJoint 00210 00211 CREATE_OBJECT(METAID_METACONNJOINT, "MetaConnJoint", "Meta Connection Joint"); 00212 DECLARE_COMMON(); 00213 CREATE_POINTER(ATTRID_CONNJOINTS_COLL, "JointParent", "Parent"); 00214 CREATE_COLLECTION(ATTRID_PTRSPECS_COLL, "Specs", "Pointer Specifications"); 00215 CLSID_PUSH(__uuidof(MgaMetaConnJoint)); 00216 00217 // ------- RegNode 00218 00219 CREATE_OBJECT(METAID_METAREGNODE, "MetaRegNode", "Meta Registry Node"); 00220 DECLARE_COMMON(); 00221 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Name", VALTYPE_STRING); 00222 CREATE_ATTRIBUTE(ATTRID_VALUE, "Value", "Value", VALTYPE_STRING); 00223 CREATE_POINTER(ATTRID_REGNODES_COLL, "RegNodeParent", "Parent"); 00224 CREATE_COLLECTION(ATTRID_REGNODES_COLL, "RegNodes", "Registry Nodes"); 00225 CLSID_PUSH(__uuidof(MgaMetaRegNode)); 00226 00227 // ------- EnumItem 00228 00229 CREATE_OBJECT(METAID_METAENUMITEM, "MetaEnumItem", "Meta Registry Node"); 00230 DECLARE_COMMON(); 00231 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Displayed Name", VALTYPE_STRING); 00232 CREATE_ATTRIBUTE(ATTRID_VALUE, "Value", "Value", VALTYPE_STRING); 00233 CREATE_POINTER(ATTRID_ENUMITEMS_COLL, "EnumItemParent", "Parent"); 00234 CLSID_PUSH(__uuidof(MgaMetaEnumItem)); 00235 00236 // ------- Constraint 00237 00238 CREATE_OBJECT(METAID_METACONSTRAINT, "MetaConstraint", "Meta Constraint"); 00239 DECLARE_COMMON(); 00240 CREATE_POINTER(ATTRID_CONSTRAINT_PTR, "ConstraintParent", "Constraint Parent"); 00241 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Name", VALTYPE_STRING); 00242 CREATE_ATTRIBUTE(ATTRID_DISPNAME, "DispName", "Displayed Name", VALTYPE_STRING); 00243 CREATE_ATTRIBUTE(ATTRID_CONSEXPR, "Expression", "Constraint Expression", VALTYPE_STRING); 00244 CREATE_ATTRIBUTE(ATTRID_CONSMASK, "EventMask", "Constraint Event Mask", VALTYPE_LONG); 00245 CREATE_ATTRIBUTE(ATTRID_CONSDEPTH, "Depth", "Constraint Depth", VALTYPE_LONG); 00246 CREATE_ATTRIBUTE(ATTRID_CONSPRIORITY, "Priority", "Constraint Priority", VALTYPE_LONG); 00247 CREATE_ATTRIBUTE(ATTRID_CONSTYPE, "Type", "Constraint Type", VALTYPE_LONG); 00248 CREATE_ATTRIBUTE(ATTRID_CONSNAMESPC, "DesiredNamespace", "DesiredNamespace", VALTYPE_STRING); 00249 CLSID_PUSH(__uuidof(MgaMetaConstraint)); 00250 00251 }