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/domInstance_controller.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 domInstance_controller::create(DAE& dae)
     21 {
     22 	domInstance_controllerRef ref = new domInstance_controller(dae);
     23 	return ref;
     24 }
     25 
     26 
     27 daeMetaElement *
     28 domInstance_controller::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( "instance_controller" );
     36 	meta->registerClass(domInstance_controller::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( "skeleton" );
     44 	mea->setOffset( daeOffsetOf(domInstance_controller,elemSkeleton_array) );
     45 	mea->setElementType( domInstance_controller::domSkeleton::registerElement(dae) );
     46 	cm->appendChild( mea );
     47 
     48 	mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 );
     49 	mea->setName( "bind_material" );
     50 	mea->setOffset( daeOffsetOf(domInstance_controller,elemBind_material) );
     51 	mea->setElementType( domBind_material::registerElement(dae) );
     52 	cm->appendChild( mea );
     53 
     54 	mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
     55 	mea->setName( "extra" );
     56 	mea->setOffset( daeOffsetOf(domInstance_controller,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: url
     64 	{
     65 		daeMetaAttribute *ma = new daeMetaAttribute;
     66 		ma->setName( "url" );
     67 		ma->setType( dae.getAtomicTypes().get("xsAnyURI"));
     68 		ma->setOffset( daeOffsetOf( domInstance_controller , attrUrl ));
     69 		ma->setContainer( meta );
     70 		ma->setIsRequired( true );
     71 
     72 		meta->appendAttribute(ma);
     73 	}
     74 
     75 	//	Add attribute: sid
     76 	{
     77 		daeMetaAttribute *ma = new daeMetaAttribute;
     78 		ma->setName( "sid" );
     79 		ma->setType( dae.getAtomicTypes().get("xsNCName"));
     80 		ma->setOffset( daeOffsetOf( domInstance_controller , attrSid ));
     81 		ma->setContainer( meta );
     82 
     83 		meta->appendAttribute(ma);
     84 	}
     85 
     86 	//	Add attribute: name
     87 	{
     88 		daeMetaAttribute *ma = new daeMetaAttribute;
     89 		ma->setName( "name" );
     90 		ma->setType( dae.getAtomicTypes().get("xsNCName"));
     91 		ma->setOffset( daeOffsetOf( domInstance_controller , attrName ));
     92 		ma->setContainer( meta );
     93 
     94 		meta->appendAttribute(ma);
     95 	}
     96 
     97 	meta->setElementSize(sizeof(domInstance_controller));
     98 	meta->validate();
     99 
    100 	return meta;
    101 }
    102 
    103 daeElementRef
    104 domInstance_controller::domSkeleton::create(DAE& dae)
    105 {
    106 	domInstance_controller::domSkeletonRef ref = new domInstance_controller::domSkeleton(dae);
    107 	return ref;
    108 }
    109 
    110 
    111 daeMetaElement *
    112 domInstance_controller::domSkeleton::registerElement(DAE& dae)
    113 {
    114 	daeMetaElement* meta = dae.getMeta(ID());
    115 	if ( meta != NULL ) return meta;
    116 
    117 	meta = new daeMetaElement(dae);
    118 	dae.setMeta(ID(), *meta);
    119 	meta->setName( "skeleton" );
    120 	meta->registerClass(domInstance_controller::domSkeleton::create);
    121 
    122 	meta->setIsInnerClass( true );
    123 	//	Add attribute: _value
    124 	{
    125 		daeMetaAttribute *ma = new daeMetaAttribute;
    126 		ma->setName( "_value" );
    127 		ma->setType( dae.getAtomicTypes().get("xsAnyURI"));
    128 		ma->setOffset( daeOffsetOf( domInstance_controller::domSkeleton , _value ));
    129 		ma->setContainer( meta );
    130 		meta->appendAttribute(ma);
    131 	}
    132 
    133 	meta->setElementSize(sizeof(domInstance_controller::domSkeleton));
    134 	meta->validate();
    135 
    136 	return meta;
    137 }
    138 
    139