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_setarray_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_setarray_type::create(DAE& dae) 21 { 22 domCg_setarray_typeRef ref = new domCg_setarray_type(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domCg_setarray_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_setarray_type" ); 36 meta->registerClass(domCg_setarray_type::create); 37 38 daeMetaCMPolicy *cm = NULL; 39 daeMetaElementAttribute *mea = NULL; 40 cm = new daeMetaChoice( meta, cm, 0, 0, 0, -1 ); 41 42 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 43 mea->setName( "cg_param_type" ); 44 mea->setOffset( daeOffsetOf(domCg_setarray_type,elemCg_param_type_array) ); 45 mea->setElementType( domCg_param_type::registerElement(dae) ); 46 cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) ); 47 48 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 49 mea->setName( "array" ); 50 mea->setOffset( daeOffsetOf(domCg_setarray_type,elemArray_array) ); 51 mea->setElementType( domCg_setarray_type::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 55 mea->setName( "usertype" ); 56 mea->setOffset( daeOffsetOf(domCg_setarray_type,elemUsertype_array) ); 57 mea->setElementType( domCg_setuser_type::registerElement(dae) ); 58 cm->appendChild( mea ); 59 60 cm->setMaxOrdinal( 3000 ); 61 meta->setCMRoot( cm ); 62 // Ordered list of sub-elements 63 meta->addContents(daeOffsetOf(domCg_setarray_type,_contents)); 64 meta->addContentsOrder(daeOffsetOf(domCg_setarray_type,_contentsOrder)); 65 66 meta->addCMDataArray(daeOffsetOf(domCg_setarray_type,_CMData), 1); 67 // Add attribute: length 68 { 69 daeMetaAttribute *ma = new daeMetaAttribute; 70 ma->setName( "length" ); 71 ma->setType( dae.getAtomicTypes().get("xsPositiveInteger")); 72 ma->setOffset( daeOffsetOf( domCg_setarray_type , attrLength )); 73 ma->setContainer( meta ); 74 ma->setIsRequired( false ); 75 76 meta->appendAttribute(ma); 77 } 78 79 meta->setElementSize(sizeof(domCg_setarray_type)); 80 meta->validate(); 81 82 return meta; 83 } 84 85