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/domMorph.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 domMorph::create(DAE& dae) 21 { 22 domMorphRef ref = new domMorph(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domMorph::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( "morph" ); 36 meta->registerClass(domMorph::create); 37 38 daeMetaCMPolicy *cm = NULL; 39 daeMetaElementAttribute *mea = NULL; 40 cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); 41 42 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 2, -1 ); 43 mea->setName( "source" ); 44 mea->setOffset( daeOffsetOf(domMorph,elemSource_array) ); 45 mea->setElementType( domSource::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 mea = new daeMetaElementAttribute( meta, cm, 1, 1, 1 ); 49 mea->setName( "targets" ); 50 mea->setOffset( daeOffsetOf(domMorph,elemTargets) ); 51 mea->setElementType( domMorph::domTargets::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); 55 mea->setName( "extra" ); 56 mea->setOffset( daeOffsetOf(domMorph,elemExtra_array) ); 57 mea->setElementType( domExtra::registerElement(dae) ); 58 cm->appendChild( mea ); 59 60 cm->setMaxOrdinal( 2 ); 61 meta->setCMRoot( cm ); 62 63 // Add attribute: method 64 { 65 daeMetaAttribute *ma = new daeMetaAttribute; 66 ma->setName( "method" ); 67 ma->setType( dae.getAtomicTypes().get("MorphMethodType")); 68 ma->setOffset( daeOffsetOf( domMorph , attrMethod )); 69 ma->setContainer( meta ); 70 ma->setDefaultString( "NORMALIZED"); 71 72 meta->appendAttribute(ma); 73 } 74 75 // Add attribute: source 76 { 77 daeMetaAttribute *ma = new daeMetaAttribute; 78 ma->setName( "source" ); 79 ma->setType( dae.getAtomicTypes().get("xsAnyURI")); 80 ma->setOffset( daeOffsetOf( domMorph , attrSource )); 81 ma->setContainer( meta ); 82 ma->setIsRequired( true ); 83 84 meta->appendAttribute(ma); 85 } 86 87 meta->setElementSize(sizeof(domMorph)); 88 meta->validate(); 89 90 return meta; 91 } 92 93 daeElementRef 94 domMorph::domTargets::create(DAE& dae) 95 { 96 domMorph::domTargetsRef ref = new domMorph::domTargets(dae); 97 return ref; 98 } 99 100 101 daeMetaElement * 102 domMorph::domTargets::registerElement(DAE& dae) 103 { 104 daeMetaElement* meta = dae.getMeta(ID()); 105 if ( meta != NULL ) return meta; 106 107 meta = new daeMetaElement(dae); 108 dae.setMeta(ID(), *meta); 109 meta->setName( "targets" ); 110 meta->registerClass(domMorph::domTargets::create); 111 112 meta->setIsInnerClass( true ); 113 daeMetaCMPolicy *cm = NULL; 114 daeMetaElementAttribute *mea = NULL; 115 cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); 116 117 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 2, -1 ); 118 mea->setName( "input" ); 119 mea->setOffset( daeOffsetOf(domMorph::domTargets,elemInput_array) ); 120 mea->setElementType( domInputLocal::registerElement(dae) ); 121 cm->appendChild( mea ); 122 123 mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 ); 124 mea->setName( "extra" ); 125 mea->setOffset( daeOffsetOf(domMorph::domTargets,elemExtra_array) ); 126 mea->setElementType( domExtra::registerElement(dae) ); 127 cm->appendChild( mea ); 128 129 cm->setMaxOrdinal( 1 ); 130 meta->setCMRoot( cm ); 131 132 meta->setElementSize(sizeof(domMorph::domTargets)); 133 meta->validate(); 134 135 return meta; 136 } 137 138