Home | History | Annotate | Download | only in dom
      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_newparam.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_newparam::create(DAE& dae)
     21 {
     22 	domCg_newparamRef ref = new domCg_newparam(dae);
     23 	return ref;
     24 }
     25 
     26 
     27 daeMetaElement *
     28 domCg_newparam::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_newparam" );
     36 	meta->registerClass(domCg_newparam::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, 0, -1 );
     43 	mea->setName( "annotate" );
     44 	mea->setOffset( daeOffsetOf(domCg_newparam,elemAnnotate_array) );
     45 	mea->setElementType( domFx_annotate_common::registerElement(dae) );
     46 	cm->appendChild( mea );
     47 
     48 	mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 );
     49 	mea->setName( "semantic" );
     50 	mea->setOffset( daeOffsetOf(domCg_newparam,elemSemantic) );
     51 	mea->setElementType( domCg_newparam::domSemantic::registerElement(dae) );
     52 	cm->appendChild( mea );
     53 
     54 	mea = new daeMetaElementAttribute( meta, cm, 2, 0, 1 );
     55 	mea->setName( "modifier" );
     56 	mea->setOffset( daeOffsetOf(domCg_newparam,elemModifier) );
     57 	mea->setElementType( domCg_newparam::domModifier::registerElement(dae) );
     58 	cm->appendChild( mea );
     59 
     60 	cm = new daeMetaChoice( meta, cm, 0, 3, 1, 1 );
     61 
     62 	mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
     63 	mea->setName( "cg_param_type" );
     64 	mea->setOffset( daeOffsetOf(domCg_newparam,elemCg_param_type) );
     65 	mea->setElementType( domCg_param_type::registerElement(dae) );
     66 	cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) );
     67 
     68 	mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
     69 	mea->setName( "usertype" );
     70 	mea->setOffset( daeOffsetOf(domCg_newparam,elemUsertype) );
     71 	mea->setElementType( domCg_setuser_type::registerElement(dae) );
     72 	cm->appendChild( mea );
     73 
     74 	mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
     75 	mea->setName( "array" );
     76 	mea->setOffset( daeOffsetOf(domCg_newparam,elemArray) );
     77 	mea->setElementType( domCg_newarray_type::registerElement(dae) );
     78 	cm->appendChild( mea );
     79 
     80 	cm->setMaxOrdinal( 0 );
     81 	cm->getParent()->appendChild( cm );
     82 	cm = cm->getParent();
     83 
     84 	cm->setMaxOrdinal( 3 );
     85 	meta->setCMRoot( cm );
     86 	// Ordered list of sub-elements
     87 	meta->addContents(daeOffsetOf(domCg_newparam,_contents));
     88 	meta->addContentsOrder(daeOffsetOf(domCg_newparam,_contentsOrder));
     89 
     90 	meta->addCMDataArray(daeOffsetOf(domCg_newparam,_CMData), 1);
     91 	//	Add attribute: sid
     92 	{
     93 		daeMetaAttribute *ma = new daeMetaAttribute;
     94 		ma->setName( "sid" );
     95 		ma->setType( dae.getAtomicTypes().get("Cg_identifier"));
     96 		ma->setOffset( daeOffsetOf( domCg_newparam , attrSid ));
     97 		ma->setContainer( meta );
     98 		ma->setIsRequired( true );
     99 
    100 		meta->appendAttribute(ma);
    101 	}
    102 
    103 	meta->setElementSize(sizeof(domCg_newparam));
    104 	meta->validate();
    105 
    106 	return meta;
    107 }
    108 
    109 daeElementRef
    110 domCg_newparam::domSemantic::create(DAE& dae)
    111 {
    112 	domCg_newparam::domSemanticRef ref = new domCg_newparam::domSemantic(dae);
    113 	return ref;
    114 }
    115 
    116 
    117 daeMetaElement *
    118 domCg_newparam::domSemantic::registerElement(DAE& dae)
    119 {
    120 	daeMetaElement* meta = dae.getMeta(ID());
    121 	if ( meta != NULL ) return meta;
    122 
    123 	meta = new daeMetaElement(dae);
    124 	dae.setMeta(ID(), *meta);
    125 	meta->setName( "semantic" );
    126 	meta->registerClass(domCg_newparam::domSemantic::create);
    127 
    128 	meta->setIsInnerClass( true );
    129 	//	Add attribute: _value
    130 	{
    131 		daeMetaAttribute *ma = new daeMetaAttribute;
    132 		ma->setName( "_value" );
    133 		ma->setType( dae.getAtomicTypes().get("xsNCName"));
    134 		ma->setOffset( daeOffsetOf( domCg_newparam::domSemantic , _value ));
    135 		ma->setContainer( meta );
    136 		meta->appendAttribute(ma);
    137 	}
    138 
    139 	meta->setElementSize(sizeof(domCg_newparam::domSemantic));
    140 	meta->validate();
    141 
    142 	return meta;
    143 }
    144 
    145 daeElementRef
    146 domCg_newparam::domModifier::create(DAE& dae)
    147 {
    148 	domCg_newparam::domModifierRef ref = new domCg_newparam::domModifier(dae);
    149 	return ref;
    150 }
    151 
    152 
    153 daeMetaElement *
    154 domCg_newparam::domModifier::registerElement(DAE& dae)
    155 {
    156 	daeMetaElement* meta = dae.getMeta(ID());
    157 	if ( meta != NULL ) return meta;
    158 
    159 	meta = new daeMetaElement(dae);
    160 	dae.setMeta(ID(), *meta);
    161 	meta->setName( "modifier" );
    162 	meta->registerClass(domCg_newparam::domModifier::create);
    163 
    164 	meta->setIsInnerClass( true );
    165 	//	Add attribute: _value
    166 	{
    167 		daeMetaAttribute *ma = new daeMetaAttribute;
    168 		ma->setName( "_value" );
    169 		ma->setType( dae.getAtomicTypes().get("Fx_modifier_enum_common"));
    170 		ma->setOffset( daeOffsetOf( domCg_newparam::domModifier , _value ));
    171 		ma->setContainer( meta );
    172 		meta->appendAttribute(ma);
    173 	}
    174 
    175 	meta->setElementSize(sizeof(domCg_newparam::domModifier));
    176 	meta->validate();
    177 
    178 	return meta;
    179 }
    180 
    181