1 /* 2 * Copyright 2006 Sony Computer Entertainment Inc. 3 * 4 * Licensed under the MIT Open Source License, for details please see license.txt or the website 5 * http://www.opensource.org/licenses/mit-license.php 6 * 7 */ 8 9 #include <dae.h> 10 #include <dae/daeDom.h> 11 #include <dom/domCg_setuser_type.h> 12 #include <dae/daeMetaCMPolicy.h> 13 #include <dae/daeMetaSequence.h> 14 #include <dae/daeMetaChoice.h> 15 #include <dae/daeMetaGroup.h> 16 #include <dae/daeMetaAny.h> 17 #include <dae/daeMetaElementAttribute.h> 18 19 daeElementRef 20 domCg_setuser_type::create(DAE& dae) 21 { 22 domCg_setuser_typeRef ref = new domCg_setuser_type(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domCg_setuser_type::registerElement(DAE& dae) 29 { 30 daeMetaElement* meta = dae.getMeta(ID()); 31 if ( meta != NULL ) return meta; 32 33 meta = new daeMetaElement(dae); 34 dae.setMeta(ID(), *meta); 35 meta->setName( "cg_setuser_type" ); 36 meta->registerClass(domCg_setuser_type::create); 37 38 daeMetaCMPolicy *cm = NULL; 39 daeMetaElementAttribute *mea = NULL; 40 cm = new daeMetaChoice( meta, cm, 0, 0, 0, 1 ); 41 42 cm = new daeMetaChoice( meta, cm, 1, 0, 1, -1 ); 43 44 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 45 mea->setName( "cg_param_type" ); 46 mea->setOffset( daeOffsetOf(domCg_setuser_type,elemCg_param_type_array) ); 47 mea->setElementType( domCg_param_type::registerElement(dae) ); 48 cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) ); 49 50 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 51 mea->setName( "array" ); 52 mea->setOffset( daeOffsetOf(domCg_setuser_type,elemArray_array) ); 53 mea->setElementType( domCg_setarray_type::registerElement(dae) ); 54 cm->appendChild( mea ); 55 56 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 57 mea->setName( "usertype" ); 58 mea->setOffset( daeOffsetOf(domCg_setuser_type,elemUsertype_array) ); 59 mea->setElementType( domCg_setuser_type::registerElement(dae) ); 60 cm->appendChild( mea ); 61 62 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 63 mea->setName( "connect_param" ); 64 mea->setOffset( daeOffsetOf(domCg_setuser_type,elemConnect_param_array) ); 65 mea->setElementType( domCg_connect_param::registerElement(dae) ); 66 cm->appendChild( mea ); 67 68 cm->setMaxOrdinal( 0 ); 69 cm->getParent()->appendChild( cm ); 70 cm = cm->getParent(); 71 72 mea = new daeMetaElementArrayAttribute( meta, cm, 3001, 1, -1 ); 73 mea->setName( "setparam" ); 74 mea->setOffset( daeOffsetOf(domCg_setuser_type,elemSetparam_array) ); 75 mea->setElementType( domCg_setparam::registerElement(dae) ); 76 cm->appendChild( mea ); 77 78 cm->setMaxOrdinal( 0 ); 79 meta->setCMRoot( cm ); 80 // Ordered list of sub-elements 81 meta->addContents(daeOffsetOf(domCg_setuser_type,_contents)); 82 meta->addContentsOrder(daeOffsetOf(domCg_setuser_type,_contentsOrder)); 83 84 meta->addCMDataArray(daeOffsetOf(domCg_setuser_type,_CMData), 2); 85 // Add attribute: name 86 { 87 daeMetaAttribute *ma = new daeMetaAttribute; 88 ma->setName( "name" ); 89 ma->setType( dae.getAtomicTypes().get("Cg_identifier")); 90 ma->setOffset( daeOffsetOf( domCg_setuser_type , attrName )); 91 ma->setContainer( meta ); 92 ma->setIsRequired( true ); 93 94 meta->appendAttribute(ma); 95 } 96 97 // Add attribute: source 98 { 99 daeMetaAttribute *ma = new daeMetaAttribute; 100 ma->setName( "source" ); 101 ma->setType( dae.getAtomicTypes().get("xsNCName")); 102 ma->setOffset( daeOffsetOf( domCg_setuser_type , attrSource )); 103 ma->setContainer( meta ); 104 ma->setIsRequired( true ); 105 106 meta->appendAttribute(ma); 107 } 108 109 meta->setElementSize(sizeof(domCg_setuser_type)); 110 meta->validate(); 111 112 return meta; 113 } 114 115