• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/domLibrary_nodes.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
create(DAE & dae)20 domLibrary_nodes::create(DAE& dae)
21 {
22 	domLibrary_nodesRef ref = new domLibrary_nodes(dae);
23 	return ref;
24 }
25 
26 
27 daeMetaElement *
registerElement(DAE & dae)28 domLibrary_nodes::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( "library_nodes" );
36 	meta->registerClass(domLibrary_nodes::create);
37 
38 	daeMetaCMPolicy *cm = NULL;
39 	daeMetaElementAttribute *mea = NULL;
40 	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
41 
42 	mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
43 	mea->setName( "asset" );
44 	mea->setOffset( daeOffsetOf(domLibrary_nodes,elemAsset) );
45 	mea->setElementType( domAsset::registerElement(dae) );
46 	cm->appendChild( mea );
47 
48 	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 );
49 	mea->setName( "node" );
50 	mea->setOffset( daeOffsetOf(domLibrary_nodes,elemNode_array) );
51 	mea->setElementType( domNode::registerElement(dae) );
52 	cm->appendChild( mea );
53 
54 	mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
55 	mea->setName( "extra" );
56 	mea->setOffset( daeOffsetOf(domLibrary_nodes,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: id
64 	{
65 		daeMetaAttribute *ma = new daeMetaAttribute;
66 		ma->setName( "id" );
67 		ma->setType( dae.getAtomicTypes().get("xsID"));
68 		ma->setOffset( daeOffsetOf( domLibrary_nodes , attrId ));
69 		ma->setContainer( meta );
70 
71 		meta->appendAttribute(ma);
72 	}
73 
74 	//	Add attribute: name
75 	{
76 		daeMetaAttribute *ma = new daeMetaAttribute;
77 		ma->setName( "name" );
78 		ma->setType( dae.getAtomicTypes().get("xsNCName"));
79 		ma->setOffset( daeOffsetOf( domLibrary_nodes , attrName ));
80 		ma->setContainer( meta );
81 
82 		meta->appendAttribute(ma);
83 	}
84 
85 	meta->setElementSize(sizeof(domLibrary_nodes));
86 	meta->validate();
87 
88 	return meta;
89 }
90 
91