This file is indexed.

/usr/include/opencollada/COLLADASaxFrameworkLoader/COLLADASaxFWLKinematicsIntermediateData.h is in opencollada-dev 0.1.0~20140703.ddf8f47+dfsg1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
/*
    Copyright (c) 2008-2009 NetAllied Systems GmbH

    This file is part of COLLADASaxFrameworkLoader.

    Licensed under the MIT Open Source License, 
    for details please see LICENSE file or the website
    http://www.opensource.org/licenses/mit-license.php
*/

#ifndef __COLLADASAXFWL_KINEMATICSINTERMEDIATEDATA_H__
#define __COLLADASAXFWL_KINEMATICSINTERMEDIATEDATA_H__

#include "COLLADASaxFWLPrerequisites.h"
#include "COLLADASaxFWLUtils.h"
#include "COLLADASaxFWLSidAddress.h"
#include "COLLADASaxFWLIntermediateTargetable.h"

#include "COLLADAFWTransformation.h"

#include "COLLADABUHashFunctions.h"
#include "COLLADABUURI.h"
#include "COLLADABUhash_map.h"

#include <list>


namespace COLLADAFW
{
	class Joint;
}


namespace COLLADASaxFWL
{
	class SidTreeNode;

	typedef std::vector<COLLADAFW::Transformation*> TransformationList;

	/** An instance within kinematics.*/
	class KinematicInstance : public IntermediateTargetableTemplate<INTERMEDIATETARGETABLE_TYPE::KINEMATICS_INSTANCE>
	{
	private:
		/** The URI of the referenced element in the COLLADA file.*/
		COLLADABU::URI mUrl;

		/** The unique id of the frame work object, that will replace the instance in the kinematics model.*/
		COLLADAFW::UniqueId mReplacingObjectUniqueId;

	public:
		KinematicInstance(COLLADABU::URI url) : mUrl(url){}

		KinematicInstance(COLLADABU::URI url, COLLADAFW::UniqueId replacingObjectUniqueId) : mUrl(url), mReplacingObjectUniqueId(replacingObjectUniqueId){}

		const COLLADABU::URI& getUrl() const { return mUrl; }

		/** The unique id of the frame work object, that will replace the instance in the kinematics model.*/
		const COLLADAFW::UniqueId& getReplacingObjectUniqueId() const { return mReplacingObjectUniqueId; }

		/** The unique id of the frame work object, that will replace the instance in the kinematics model.*/
		void setReplacingObjectUniqueId(COLLADAFW::UniqueId replacingObjectUniqueId) { mReplacingObjectUniqueId = replacingObjectUniqueId; }
	};


	class  KinematicAttachment;

	typedef std::vector<KinematicAttachment*> KinematicAttachmentList;

	/** A link within a kinematics model.*/
	class KinematicLink : public IntermediateTargetableTemplate<INTERMEDIATETARGETABLE_TYPE::KINEMATICLINK>
	{
	private:
		KinematicAttachmentList mAttachments;
		TransformationList mTransformations;
	public:
		~KinematicLink(){ deleteVector(mAttachments); deleteVector(mTransformations); }

		/** Adds an attachment to the link. The link will be deleted on destruction.*/
		void addAttachment( KinematicAttachment* attachement ) { mAttachments.push_back(attachement); }

		/** Adds a transformation to the link. The transformation will be deleted on destruction.*/
		void addTransformation( COLLADAFW::Transformation* transformation ) { mTransformations.push_back(transformation); }

		const KinematicAttachmentList& getAttachments() const { return mAttachments; }

		const TransformationList& getTransformations() const { return mTransformations; }
	};
	
	typedef std::vector<KinematicLink*> KinematicLinkList;

	/** An attachment within a kinematics model.*/
	class KinematicAttachment : public IntermediateTargetableTemplate<INTERMEDIATETARGETABLE_TYPE::KINEMATICATTACHMENT>
	{
	public:
		enum Type { FULL, START, END };
	private:
		KinematicLink mLink;
		Type mType;
		TransformationList mTransformations;
		SidAddress mJoint;
	public:
		KinematicAttachment( Type type, const SidAddress& joint ) 
			: mType(type) 
			, mJoint(joint)
		{}

		~KinematicAttachment(){ deleteVector(mTransformations); }

		const KinematicLink& getLink() const { return mLink; }
		KinematicLink& getLink(){ return mLink; }

		Type getType() const { return mType; }

		const SidAddress& getJoint() const { return mJoint; }

		/** Adds a transformation to the link. The transformation will be deleted on destruction.*/
		void addTransformation( COLLADAFW::Transformation* transformation ) { mTransformations.push_back(transformation); }

		const TransformationList& getTransformations() const { return mTransformations; }
	};


	/** A kinematics model as described in COLLADA.*/
	class KinematicsModel: public IntermediateTargetableTemplate<INTERMEDIATETARGETABLE_TYPE::KINEMATICMODEL>
	{
	private:
		KinematicLinkList mBaseLinks;

		/** The id of the kinematics model.*/
		COLLADABU::URI mUrl;

		/** The name of the kinematics model.*/
		String mName;

		SidTreeNode* mSidTreeNode;
	public:
		KinematicsModel(const COLLADABU::URI& url, const char* name );

		~KinematicsModel();

		void addBaseLink( KinematicLink* baseLink ) { mBaseLinks.push_back(baseLink); }

		const KinematicLinkList& getBaseLinks() const { return mBaseLinks; }

		/** The name of the kinematics model.*/
		const String& getName() const { return mName; }

		/** The id of the kinematics model.*/
		const COLLADABU::URI& getUrl() const { return mUrl; }

		SidTreeNode* getSidTreeNode() const { return mSidTreeNode; }
		void setSidTreeNode(SidTreeNode* val) { mSidTreeNode = val; }
	};


	class AxisInfo 	
	{
	private:
		/** The joint primitive which axes is referenced by the AxisInfo.*/
		SidAddress mJointPrimitiveAddress;

		/** True if the joint is active, false otherwise. Defaults to true.*/
		bool mIsActive;

		/** True if the joint is locked, false otherwise. Defaults to false.*/
		bool mIsLocked;

		/** The index of the axis in the roboter. 1-base, 0 meas unset.*/
		int mIndex;
	public:

		/** Constructor. */
		AxisInfo(SidAddress jointPrimitiveAddress) 
			: mJointPrimitiveAddress(jointPrimitiveAddress)
			, mIsActive(true)
			, mIsLocked(false)
			, mIndex(0)
		{}

		/** Destructor. */
		virtual ~AxisInfo(){}

		/** The joint primitive which axes is referenced by the AxisInfo.*/
		const SidAddress& getJointPrimitiveRefAddress() const { return mJointPrimitiveAddress; }

		/** The joint primitive which axes is referenced by the AxisInfo.*/
		void setJointPrimitiveAddress( const SidAddress& jointPrimitiveAddress) { mJointPrimitiveAddress = jointPrimitiveAddress; }

		/** True if the joint is active, false otherwise .*/
		bool getIsActive() const { return mIsActive; }

		/** True if the joint is active, false otherwise .*/
		void setIsActive(bool isActive) { mIsActive = isActive; }

		/** True if the joint is locked, false otherwise .*/
		bool getIsLocked() const { return mIsLocked; }

		/** True if the joint is locked, false otherwise .*/
		void setIsLocked(bool isLocked) { mIsLocked = isLocked; }

		/** The index of the axis in the roboter. 1-base, 0 meas unset.*/
		int getIndex() const { return mIndex; }

		/** The index of the axis in the roboter. 1-base, 0 meas unset.*/
		void setIndex(int index) { mIndex = index; }
	};

	typedef std::vector<AxisInfo> AxisInfoList;


	/** New param as it appears in formula and kinematics */
	class KinematicsNewParam 	
	{
	public:
		enum ValueType { VALUETYPE_UNKNOWN, VALUETYPE_FLOAT, VALUETYPE_INT, VALUETYPE_BOOL, VALUETYPE_SIDREF};
	private:
		/** Value type of the new param.*/
		ValueType mValueType;

		
		union Value
		{
			double _double;
			int _int;
			bool _bool;
			SidAddress* _sidref;
		} mValue;

		/** The name of the new param (sid in COLLADA).*/
		String mName;
	public:

		/** Constructor. */
		KinematicsNewParam(ValueType valueType) 
			: mValueType(valueType)
		{
			switch ( mValueType )
			{
			case VALUETYPE_BOOL: 
				mValue._bool = true;
				break;
			case VALUETYPE_FLOAT: 
				mValue._double = 0;
				break;
			case VALUETYPE_INT: 
				mValue._int = 0;
				break;
			case VALUETYPE_SIDREF: 
				mValue._sidref = 0;
				break;
			case VALUETYPE_UNKNOWN:
				break;
			}
		}

		/** Destructor. */
		virtual ~KinematicsNewParam(){deleteSidRef();}

		/** Returns the value type of the new param.*/
		ValueType getValueType() const { return mValueType; }

		/** Sets the value type of the new param.*/
//		void setValueType(ValueType valueType) { mValueType = valueType; }

		/** Returns the double value of the new param. Type must be VALUETYPE_FLOAT.*/
		double getDoubleValue() const { return mValue._double; }

		/** Sets the double value of the new param. Type will be set to VALUETYPE_FLOAT.*/
		void setDoubleValue(double doubleValue) { deleteSidRef(); mValue._double = doubleValue; mValueType = VALUETYPE_FLOAT; }

		/** Returns the int value of the new param. Type must be VALUETYPE_INT.*/
		int getIntValue() const { return mValue._int; }

		/** Sets the int value of the new param. Type will be set to VALUETYPE_INT.*/
		void setIntValue(int intValue) { deleteSidRef(); mValue._int = intValue; mValueType = VALUETYPE_INT; }

		/** Returns the bool value of the new param. Type must be VALUETYPE_BOOL.*/
		bool getBoolValue() const { return mValue._bool; }

		/** Sets the bool value of the new param. Type will be set to VALUETYPE_BOOL.*/
		void setBoolValue(bool boolValue) { deleteSidRef(); mValue._bool = boolValue; mValueType = VALUETYPE_BOOL; }

		/** Returns the sidref value of the new param. Type must be VALUETYPE_SIDREF.*/
		const SidAddress* getSidrefValue() const { return mValue._sidref; }

		/** Sets the sidref value of the new param. Type will be set to VALUETYPE_SIDREF.*/
		void setSidrefValue( const SidAddress& sidrefValue) { deleteSidRef(); mValue._sidref = new SidAddress(sidrefValue); mValueType = VALUETYPE_SIDREF; }

		/** Returns the name of the new param (sid in COLLADA).*/
		const String& getName() const { return mName; }

		/** Returns the name of the new param (sid in COLLADA).*/
		void setName(const String& name) { mName = name; }

	private:
		void deleteSidRef()
		{
			if ( mValueType == VALUETYPE_SIDREF)
			{
				delete mValue._sidref;
				mValue._sidref = 0;
			}
		}

		/** Disable default copy ctor. */
		KinematicsNewParam( const KinematicsNewParam& pre );

		/** Disable default assignment operator. */
		const KinematicsNewParam& operator= ( const KinematicsNewParam& pre );


	};

	typedef COLLADABU::hash_map<String/*sid*/, KinematicsNewParam*> KinematicsNewParams;


	class KinematicsInstanceKinematicsModel : public KinematicInstance
	{
	private:
		KinematicsNewParams mKinematicsNewParams;
	public:
		KinematicsInstanceKinematicsModel( const COLLADABU::URI& uRL)
			: KinematicInstance(uRL){}

		~KinematicsInstanceKinematicsModel() { deleteMap(mKinematicsNewParams);}

		void addKinematicsNewParam(KinematicsNewParam* newParam);

		const KinematicsNewParams& getKinematicsNewParams() const { return mKinematicsNewParams; }

		KinematicsNewParams& getKinematicsNewParams() { return mKinematicsNewParams; }

		KinematicsNewParam* getNewParamBySid(const String& sid)const;

	};

	typedef std::list<KinematicsInstanceKinematicsModel> KinematicsInstanceKinematicsModels;

	/** A kinematics controller as described in COLLADA articulated system.*/
	class KinematicsController: public IntermediateTargetableTemplate<INTERMEDIATETARGETABLE_TYPE::KINEMATICCONTROLLER>
	{
	private:
		/** The id of the kinematics controller.*/
		COLLADABU::URI mUri;

		/** The name of the kinematics controller.*/
		String mName;

		AxisInfoList mAxisInfos;
		KinematicsInstanceKinematicsModels mKinematicsInstanceKinematicsModels;

	public:
		KinematicsController(const COLLADABU::URI& uri, const String& name )
			: mUri( uri ), mName(name) {}

		~KinematicsController(){}

		/** The name of the kinematics controller.*/
		const String& getName() const { return mName; }

		/** The id of the kinematics controller.*/
		const COLLADABU::URI& getUri() const { return mUri; }

		const AxisInfoList& getAxisInfos() const { return mAxisInfos; }
		AxisInfoList& getAxisInfos(){ return mAxisInfos; }

		const KinematicsInstanceKinematicsModels& getKinematicsInstanceKinematicsModels() const { return mKinematicsInstanceKinematicsModels; }
		KinematicsInstanceKinematicsModels& getKinematicsInstanceKinematicsModels() { return mKinematicsInstanceKinematicsModels; }
	};


	/** Bind as it appears in kinematics */
	class KinematicsBind
	{
	public:
		enum ValueType { VALUETYPE_UNKNOWN, VALUETYPE_FLOAT, VALUETYPE_INT, VALUETYPE_BOOL, VALUETYPE_SIDREF, VALUETYPE_PARAM};
	private:
		/** Value type of the bind.*/
		ValueType mValueType;

		union Value
		{
			double _double;
			int _int;
			bool _bool;
			SidAddress* _sidref;
			String* _param;
		} mValue;

		/** The symbol of the bind (sid in COLLADA).*/
		String mSymbol;
	public:

		/** Constructor. */
		KinematicsBind(ValueType valueType);

		/** Constructor. */
		KinematicsBind();

		/** Destructor. */
		virtual ~KinematicsBind(){deleteAll();}

		/** Returns the value type of the bind.*/
		ValueType getValueType() const { return mValueType; }

		/** Sets the value type of the bind.*/
		//		void setValueType(ValueType valueType) { mValueType = valueType; }

		/** Returns the double value of the bind. Type must be VALUETYPE_FLOAT.*/
		double getDoubleValue() const { return mValue._double; }

		/** Sets the double value of the bind. Type will be set to VALUETYPE_FLOAT.*/
		void setDoubleValue(double doubleValue) { deleteAll(); mValue._double = doubleValue; mValueType = VALUETYPE_FLOAT; }

		/** Returns the int value of the bind. Type must be VALUETYPE_INT.*/
		int getIntValue() const { return mValue._int; }

		/** Sets the int value of the bind. Type will be set to VALUETYPE_INT.*/
		void setIntValue(int intValue) { deleteAll(); mValue._int = intValue; mValueType = VALUETYPE_INT; }

		/** Returns the bool value of the bind. Type must be VALUETYPE_BOOL.*/
		bool getBoolValue() const { return mValue._bool; }

		/** Sets the bool value of the bind. Type will be set to VALUETYPE_BOOL.*/
		void setBoolValue(bool boolValue) { deleteAll(); mValue._bool = boolValue; mValueType = VALUETYPE_BOOL; }

		/** Returns the sidref value of the bind. Type must be VALUETYPE_SIDREF.*/
		const SidAddress* getSidrefValue() const { return mValue._sidref; }

		/** Sets the sidref value of the bind. Type will be set to VALUETYPE_SIDREF.*/
		void setSidrefValue( const SidAddress& sidrefValue) { deleteAll(); mValue._sidref = new SidAddress(sidrefValue); mValueType = VALUETYPE_SIDREF; }

		/** Returns the param ref of the bind. Type must be VALUETYPE_PARAM.*/
		const String* getParamValue() const { return mValue._param; }

		/** Sets the param value of the bind. Type will be set to VALUETYPE_PARAM.*/
		void setParamValue( const String& paramValue) { deleteAll(); mValue._param = new String(paramValue); mValueType = VALUETYPE_PARAM; }

		/** Returns the name of the bind (sid in COLLADA).*/
		const String& getSymbol() const { return mSymbol; }

		/** Returns the name of the bind (sid in COLLADA).*/
		void setSymbol(const String& symbol) { mSymbol = symbol; }

	private:
		void deleteSidRef()
		{
			if ( mValueType == VALUETYPE_SIDREF)
			{
				delete mValue._sidref;
				mValue._sidref = 0;
			}
		}

		void deleteParam()
		{
			if ( mValueType == VALUETYPE_PARAM)
			{
				delete mValue._param;
				mValue._param = 0;
			}
		}

		void deleteAll()
		{
			deleteSidRef();
			deleteParam();
		}

		/** Disable default copy ctor. */
		KinematicsBind( const KinematicsBind& pre );

		/** Disable default assignment operator. */
		const KinematicsBind& operator= ( const KinematicsBind& pre );
	};

	typedef std::vector<KinematicsBind*> KinematicsBinds;



	/** A kinematics controller as described in COLLADA articulated system.*/
	class KinematicsInstanceArticulatedSystem : public KinematicInstance	
	{
	private:
		KinematicsNewParams mKinematicsNewParams;
		KinematicsBinds mKinematicsBinds;

	public:
		KinematicsInstanceArticulatedSystem( const COLLADABU::URI& uRL)
			: KinematicInstance(uRL){}

		~KinematicsInstanceArticulatedSystem();

		void addBind( KinematicsBind* bind) { mKinematicsBinds.push_back(bind); }

	};

	typedef std::vector<KinematicsInstanceArticulatedSystem*> KinematicsInstanceArticulatedSystems;

	/** A kinematics scene as described in COLLADA articulated system.*/
	class KinematicsScene: public IntermediateTargetableTemplate<INTERMEDIATETARGETABLE_TYPE::KINEMATICSCENE>
	{
	private:
		/** The id of the kinematics scene.*/
		COLLADABU::URI mUri;

		/** The name of the kinematics scene.*/
		String mName;

		KinematicsInstanceArticulatedSystems mKinematicsInstanceArticulatedSystems;

		KinematicsInstanceKinematicsModels mKinematicsInstanceKinematicsModels;

	public:
		KinematicsScene(const COLLADABU::URI& uri, const String& name )
			: mUri( uri ), mName(name) {}

		~KinematicsScene();

		void addInstanceArticulatedSystem(KinematicsInstanceArticulatedSystem* kinematicsInstanceArticulatedSystem);

		const KinematicsInstanceArticulatedSystems& getKinematicsInstanceArticulatedSystems() const { return mKinematicsInstanceArticulatedSystems; }

		void addInstanceKinematicsModel(KinematicsInstanceKinematicsModel* kinematicsInstanceKinematicsModel);

		const KinematicsInstanceKinematicsModels& getKinematicsInstanceKinematicsModels() const { return mKinematicsInstanceKinematicsModels; }

		KinematicsInstanceKinematicsModels& getKinematicsInstanceKinematicsModels() { return mKinematicsInstanceKinematicsModels; }

		/** The id of the kinematics scene.*/
		const COLLADABU::URI& getUri() const { return mUri; }
	};


	/** Bind as it appears in kinematics */
	class KinematicsSidrefOrParam
	{
	public:
		enum ValueType { VALUETYPE_UNKNOWN, VALUETYPE_PARAM, VALUETYPE_SIDREF};
	private:
		/** Value type of the bind.*/
		ValueType mValueType;

		union Value
		{
			SidAddress* _sidref;
			String* _param;
		} mValue;

		/** The symbol of the bind (sid in COLLADA).*/
		String mSymbol;
	public:

		/** Constructor. */
		KinematicsSidrefOrParam(ValueType axisType);

		/** Constructor. */
		KinematicsSidrefOrParam() : mValueType(VALUETYPE_UNKNOWN){}

		/** Destructor. */
		virtual ~KinematicsSidrefOrParam(){deleteAll();}

		/** Returns the value type SidrefOrParam.*/
		ValueType getValueType() const { return mValueType; }

		/** Returns the sidref value SidrefOrParam. Type must be VALUETYPE_SIDREF.*/
		const SidAddress* getSidrefValue() const { return mValue._sidref; }

		/** Sets the sidref value SidrefOrParam. Type will be set to VALUETYPE_SIDREF.*/
		void setSidrefValue( const SidAddress& sidrefValue);

		/** Returns the param ref SidrefOrParam. Type must be VALUETYPE_PARAM.*/
		const String* getParamValue() const { return mValue._param; }

		/** Sets the param value SidrefOrParam. Type will be set to VALUETYPE_PARAM.*/
		void setParamValue( const String& paramValue);
	private:
		void deleteSidRef();

		void deleteParam();

		void deleteAll();

		/** Disable default copy ctor. */
		KinematicsSidrefOrParam( const KinematicsSidrefOrParam& pre );

		/** Disable default assignment operator. */
		const KinematicsSidrefOrParam& operator= ( const KinematicsSidrefOrParam& pre );
	};

	typedef KinematicsSidrefOrParam KinematicsAxis;

	/** Bind as it appears in kinematics */
	class KinematicsFloatOrParam
	{
	public:
		enum ValueType { VALUETYPE_UNKNOWN, VALUETYPE_PARAM, VALUETYPE_FLOAT};
	private:
		/** Value type of the bind.*/
		ValueType mValueType;

		union Value
		{
			float _float;
			String* _param;
		} mValue;

		/** The symbol of the bind (sid in COLLADA).*/
		String mSymbol;
	public:

		/** Constructor. */
		KinematicsFloatOrParam(ValueType axisType);

		/** Constructor. */
		KinematicsFloatOrParam() : mValueType(VALUETYPE_UNKNOWN){}

		/** Destructor. */
		virtual ~KinematicsFloatOrParam(){deleteParam();}

		/** Returns the axis type FloatOrParam.*/
		ValueType getValueType() const { return mValueType; }

		/** Returns the sidref value FloatOrParam. Type must be VALUETYPE_FLOAT.*/
		float getFloatValue() const { return mValue._float; }

		/** Sets the sidref value FloatOrParam. Type will be set to VALUETYPE_FLOAT.*/
		void setFloatValue( float value) { deleteParam(); mValue._float=value; mValueType = VALUETYPE_FLOAT; }

		/** Returns the param ref FloatOrParam. Type must be VALUETYPE_PARAM.*/
		const String* getParamValue() const { return mValue._param; }

		/** Sets the param value FloatOrParam. Type will be set to VALUETYPE_PARAM.*/
		void setParamValue( const String& paramValue) { deleteParam(); mValue._param = new String(paramValue); mValueType = VALUETYPE_PARAM; }
	private:
		void deleteParam()
		{
			if ( mValueType == VALUETYPE_PARAM)
			{
				delete mValue._param;
				mValue._param = 0;
			}
		}

		/** Disable default copy ctor. */
		KinematicsFloatOrParam( const KinematicsFloatOrParam& pre );

		/** Disable default assignment operator. */
		const KinematicsFloatOrParam& operator= ( const KinematicsFloatOrParam& pre );
	};

	typedef KinematicsFloatOrParam KinematicsValue;

	/** bind_joint_axis as it appears in kinematics */
	class KinematicsBindJointAxis
	{
	private:

		/** The target of the bind (sid in COLLADA).*/
		SidAddress mTarget;
	
		/** The axis.*/
		KinematicsAxis mAxis;

		/** The value of the axis.*/
		KinematicsValue mValue;
	public:

		/** Constructor. */
		KinematicsBindJointAxis(SidAddress target) : mTarget(target){}

		/** Destructor. */
		virtual ~KinematicsBindJointAxis(){}

		/** Returns the target of the bind (sid in COLLADA).*/
		const SidAddress& getTarget() const { return mTarget; }

		/** Sets the target of the bind (sid in COLLADA).*/
		void setTarget( const SidAddress& target) { mTarget = target; }

		/** Returns the axis.*/
		const KinematicsAxis& getAxis() const { return mAxis; }

		/** Returns the axis.*/
		KinematicsAxis& getAxis(){ return mAxis; }

		/** Returns the value.*/
		const KinematicsValue& getValue() const { return mValue; }

		/** Returns the value.*/
		KinematicsValue& getValue(){ return mValue; }

	private:
		/** Disable default copy ctor. */
		KinematicsBindJointAxis( const KinematicsBindJointAxis& pre );

		/** Disable default assignment operator. */
		const KinematicsBindJointAxis& operator= ( const KinematicsBindJointAxis& pre );
	};

	typedef std::vector<KinematicsBindJointAxis*> KinematicsBindJointAxes;


	/** instance_kinematics_scene as it appears in kinematics */
	class KinematicsInstanceKinematicsScene
	{
	private:

		/** The url of the instantiate kinematics scene.*/
		COLLADABU::URI mUrl;

		KinematicsBindJointAxes mBindJointAxes;

		// file id

	public:

		/** Constructor. */
		KinematicsInstanceKinematicsScene(){}

		/** Destructor. */
		virtual ~KinematicsInstanceKinematicsScene();

		/** The url of the instantiate kinematics scene.*/
		COLLADABU::URI getUrl() const { return mUrl; }

		/** The url of the instantiate kinematics scene.*/
		void setUrl(COLLADABU::URI url) { mUrl = url; }

		void addBindJointAxis(KinematicsBindJointAxis* bindJointAxis) { mBindJointAxes.push_back(bindJointAxis);}

		const KinematicsBindJointAxes& getBindJointAxes() const { return mBindJointAxes; }
	private:
		/** Disable default copy ctor. */
		KinematicsInstanceKinematicsScene( const KinematicsInstanceKinematicsScene& pre );

		/** Disable default assignment operator. */
		const KinematicsInstanceKinematicsScene& operator= ( const KinematicsInstanceKinematicsScene& pre );
	};


    /** Kinematics data that needs to be stored while parsing a COLLADA file. This data is used to 
	build the kinematics model, after the entire file has been parsed. 
	All the heap instances of FW classes are created by using FW_NEW, instances of other classes by using new.*/
	class KinematicsIntermediateData 	
	{
	public:
		/** List of Joints.*/
		typedef std::vector< COLLADAFW::Joint* > JointList;

		/** List of instance instances.*/
		typedef std::vector< KinematicInstance* > KinematicInstanceList;

		/** List of kinematic models.*/
		typedef COLLADABU::hash_map< COLLADABU::URI, KinematicsModel* > KinematicsModelMap;

		/** List of kinematic controllers.*/
		typedef COLLADABU::hash_map< COLLADABU::URI, KinematicsController* > KinematicsControllerMap;

		/** List of kinematic scenes.*/
		typedef COLLADABU::hash_map< COLLADABU::URI, KinematicsScene* > KinematicsSceneMap;

		/** List of instance kinematics scenes.*/
		typedef std::vector<KinematicsInstanceKinematicsScene*> KinematicsInstanceKinematicsScenes;

	private:
		/** List of all joints already created. They will be written as part of kinematics.*/
		JointList mJoints;

		/** List of all instance joints already created. They will be written as part of kinematics.*/
		KinematicInstanceList mInstanceJoints;

		/** List of all kinematic models already created. They will be written as part of kinematics.*/
		KinematicsModelMap mKinematicsModels;

		/** List of all kinematic controller already created. They will be written as part of kinematics.*/
		KinematicsControllerMap mKinematicsControllers;

		/** List of all kinematic scenes already created. They will be written as part of kinematics.*/
		KinematicsSceneMap mKinematicsScenes;

		/** The only instance kinematics scenes.*/
		KinematicsInstanceKinematicsScenes mInstanceKinematicsScenes;

	public:

		/** Returns the list of all joints already created. They will be written as part of kinematics.*/
		const JointList& getJoints() const { return mJoints; }

		/** Returns the list of all joints already created. They will be written as part of kinematics.*/
		JointList& getJoints() { return mJoints; }

		/** Returns the list of all InstanceJoints already created. They will be written as part of kinematics.*/
		const KinematicInstanceList& getInstanceJoints() const { return mInstanceJoints; }

		/** Returns the list of all InstanceJoints already created. They will be written as part of kinematics.*/
		KinematicInstanceList& getInstanceJoints() { return mInstanceJoints; }

		/** List of all kinematic models already created. They will be written as part of kinematics.*/
		const KinematicsModelMap& getKinematicsModels() const { return mKinematicsModels; }

		/** List of all kinematic models already created. They will be written as part of kinematics.*/
		KinematicsModelMap& getKinematicsModels() { return mKinematicsModels; }

		/** List of all kinematic controllers already created. They will be written as part of kinematics.*/
		const KinematicsControllerMap& getKinematicsControllers() const { return mKinematicsControllers; }

		/** List of all kinematic controllers already created. They will be written as part of kinematics.*/
		KinematicsControllerMap& getKinematicsControllers() { return mKinematicsControllers; }

		/** List of all kinematic scenes already created. They will be written as part of kinematics.*/
		const KinematicsSceneMap& getKinematicsScenes() const { return mKinematicsScenes; }

		/** List of all kinematic scenes already created. They will be written as part of kinematics.*/
		KinematicsSceneMap& getKinematicsScenes() { return mKinematicsScenes; }

		/** List of all instance kinematic scenes already created. They will be written as part of kinematics.*/
		const KinematicsInstanceKinematicsScenes& getInstanceKinematicsScenes() const { return mInstanceKinematicsScenes; }

		/** List of all instance kinematic scenes already created. They will be written as part of kinematics.*/
		KinematicsInstanceKinematicsScenes& getInstanceKinematicsScenes() { return mInstanceKinematicsScenes; }

        /** Constructor. */
		KinematicsIntermediateData();

        /** Destructor. */
		virtual ~KinematicsIntermediateData();

	private:

        /** Disable default copy ctor. */
		KinematicsIntermediateData( const KinematicsIntermediateData& pre );

        /** Disable default assignment operator. */
		const KinematicsIntermediateData& operator= ( const KinematicsIntermediateData& pre );

	};

} // namespace COLLADASAXFWL

#endif // __COLLADASAXFWL_KINEMATICSINTERMEDIATEDATA_H__