2 /* { dg-timeout-factor 2.0 } */
3 /* { dg-skip-if "Program too big" { "avr-*-*" } { "*" } { "" } } */
8 template <class T, class U>
21 typename T1 = NullType, typename T2 = NullType, typename T3 =
23 typename T4 = NullType, typename T5 = NullType, typename T6 =
25 typename T7 = NullType, typename T8 = NullType, typename T9 =
27 typename T10 = NullType, typename T11 = NullType, typename T12
29 typename T13 = NullType, typename T14 = NullType, typename T15
31 typename T16 = NullType, typename T17 = NullType, typename T18
33 typename T19 = NullType, typename T20 = NullType, typename T21
35 typename T22 = NullType, typename T23 = NullType, typename T24
37 typename T25 = NullType, typename T26 = NullType, typename T27
39 typename T28 = NullType, typename T29 = NullType, typename T30
41 typename T31 = NullType, typename T32 = NullType, typename T33
43 typename T34 = NullType, typename T35 = NullType, typename T36
45 typename T37 = NullType, typename T38 = NullType, typename T39
47 typename T40 = NullType
52 typedef typename MakeTypelist
71 typedef Typelist<T1, TailResult> Result;
77 typedef NullType Result;
85 template <class Key, bool iW>
98 template <class Key, bool isWrite>
99 class CreatorUnitBaseImpl
102 typedef Context<Key, isWrite> Context_;
104 typedef void*(CreatorUnitBaseImpl::*CreateFun)(Context_&, unsigned&, const
106 CreateFun createFun_;
109 virtual void* createUninitialized () = 0;
110 template <class Value>
111 void* createImpl (Context_& ctx, unsigned& ver, const Key& k)
113 return createUninitialized();
116 CreatorUnitBaseImpl();
118 template <class Value>
119 CreatorUnitBaseImpl (Value*) :
120 createFun_( &CreatorUnitBaseImpl::template createImpl<Value> )
124 virtual ~CreatorUnitBaseImpl () {}
126 CreatorUnitBaseImpl(const CreatorUnitBaseImpl& s)
127 : createFun_(s.createFun_)
131 CreatorUnitBaseImpl& operator=(const CreatorUnitBaseImpl& s)
133 createFun_ = s.createFun_;
136 void* create (Context_& ctx, unsigned& ver, const Key& k)
138 return (this->*createFun_)(ctx, ver, k);
143 class Creator : protected CreatorUnitBaseImpl<Key, true>, protected
144 CreatorUnitBaseImpl<Key, false>
147 typedef void* (*CreatorFun) ();
152 virtual void* createUninitialized ()
161 template <class Value>
162 Creator (CreatorFun f, Value*) :
163 CreatorUnitBaseImpl<Key, true>((Value*)0),
164 CreatorUnitBaseImpl<Key, false>((Value*)0),
169 Creator(const Creator& s) :
170 CreatorUnitBaseImpl<Key, true>(s),
171 CreatorUnitBaseImpl<Key, false>(s),
177 Creator& operator=(const Creator& s)
179 CreatorUnitBaseImpl<Key, true>::operator=(s);
180 CreatorUnitBaseImpl<Key, false>::operator=(s);
189 template <class Context>
190 void* createObject (Context& ctx, unsigned& ver, const Key& k)
192 void* r = CreatorUnitBaseImpl<Key, Context::isWrite>::create(ctx, ver,
205 typedef void* (*CreatorFun) ();
206 typedef detail::Creator<Key> Creator;
211 template <class Value>
212 bool registerCreator (const Key& k, CreatorFun fun)
216 template <class Context>
217 void* createObject (const Key& k, Context& ctx, unsigned& ver)
223 template <class Key, class Base, Key key>
227 typedef Base BaseType;
228 enum {KeyValue = key};
231 template <class Key, class T>
234 template <class Key, class Base, Key key>
235 class Serializer<Key, ClassSpec <Key, Base, key> >
236 : public virtual Factory<Key>
239 typedef Base BaseType;
240 enum {KeyValue = key};
241 typedef Factory<Key> Inherited;
242 typedef Serializer<Key, ClassSpec< Key, Base, key > > SelfType;
244 static void* create ()
246 return (void*) (new BaseType);
251 Inherited::template registerCreator<BaseType>(
257 template <class Key, class Head>
258 class Serializer<Key, Loki::Typelist<Head, Loki::NullType> >:
259 public Serializer<Key, Head>
263 template <class Key, class Head, class Tail>
264 class Serializer<Key, Loki::Typelist<Head, Tail> >:
265 public virtual Serializer<Key, Head>,
266 public virtual Serializer<Key, Tail>
271 class Serializer<Key, Loki::NullType> : public virtual Factory<Key>
278 typedef unsigned KeyType;
282 typedef Factory<KeyType> FactoryType;
288 template <class Context>
289 bool serialize(Context& ctx, unsigned& ver)
293 static Key classId() { return 1; }
294 static const char* className () {return "A001";}
299 template <class Context>
300 bool serialize(Context& ctx, unsigned& ver)
304 static Key classId() { return 2; }
305 static const char* className () {return "A002";}
310 template <class Context>
311 bool serialize(Context& ctx, unsigned& ver)
315 static Key classId() { return 3; }
316 static const char* className () {return "A003";}
321 template <class Context>
322 bool serialize(Context& ctx, unsigned& ver)
326 static Key classId() { return 4; }
327 static const char* className () {return "A004";}
332 template <class Context>
333 bool serialize(Context& ctx, unsigned& ver)
337 static Key classId() { return 5; }
338 static const char* className () {return "A005";}
343 template <class Context>
344 bool serialize(Context& ctx, unsigned& ver)
348 static Key classId() { return 6; }
349 static const char* className () {return "A006";}
354 template <class Context>
355 bool serialize(Context& ctx, unsigned& ver)
359 static Key classId() { return 7; }
360 static const char* className () {return "A007";}
365 template <class Context>
366 bool serialize(Context& ctx, unsigned& ver)
370 static Key classId() { return 8; }
371 static const char* className () {return "A008";}
376 template <class Context>
377 bool serialize(Context& ctx, unsigned& ver)
381 static Key classId() { return 9; }
382 static const char* className () {return "A009";}
387 template <class Context>
388 bool serialize(Context& ctx, unsigned& ver)
392 static Key classId() { return 10; }
393 static const char* className () {return "A010";}
398 template <class Context>
399 bool serialize(Context& ctx, unsigned& ver)
403 static Key classId() { return 11; }
404 static const char* className () {return "A011";}
409 template <class Context>
410 bool serialize(Context& ctx, unsigned& ver)
414 static Key classId() { return 12; }
415 static const char* className () {return "A012";}
420 template <class Context>
421 bool serialize(Context& ctx, unsigned& ver)
425 static Key classId() { return 13; }
426 static const char* className () {return "A013";}
431 template <class Context>
432 bool serialize(Context& ctx, unsigned& ver)
436 static Key classId() { return 14; }
437 static const char* className () {return "A014";}
442 template <class Context>
443 bool serialize(Context& ctx, unsigned& ver)
447 static Key classId() { return 15; }
448 static const char* className () {return "A015";}
453 template <class Context>
454 bool serialize(Context& ctx, unsigned& ver)
458 static Key classId() { return 16; }
459 static const char* className () {return "A016";}
464 template <class Context>
465 bool serialize(Context& ctx, unsigned& ver)
469 static Key classId() { return 17; }
470 static const char* className () {return "A017";}
475 template <class Context>
476 bool serialize(Context& ctx, unsigned& ver)
480 static Key classId() { return 18; }
481 static const char* className () {return "A018";}
486 template <class Context>
487 bool serialize(Context& ctx, unsigned& ver)
491 static Key classId() { return 19; }
492 static const char* className () {return "A019";}
497 template <class Context>
498 bool serialize(Context& ctx, unsigned& ver)
502 static Key classId() { return 20; }
503 static const char* className () {return "A020";}
508 template <class Context>
509 bool serialize(Context& ctx, unsigned& ver)
513 static Key classId() { return 21; }
514 static const char* className () {return "A021";}
519 template <class Context>
520 bool serialize(Context& ctx, unsigned& ver)
524 static Key classId() { return 22; }
525 static const char* className () {return "A022";}
530 template <class Context>
531 bool serialize(Context& ctx, unsigned& ver)
535 static Key classId() { return 23; }
536 static const char* className () {return "A023";}
541 template <class Context>
542 bool serialize(Context& ctx, unsigned& ver)
546 static Key classId() { return 24; }
547 static const char* className () {return "A024";}
552 template <class Context>
553 bool serialize(Context& ctx, unsigned& ver)
557 static Key classId() { return 25; }
558 static const char* className () {return "A025";}
563 template <class Context>
564 bool serialize(Context& ctx, unsigned& ver)
568 static Key classId() { return 26; }
569 static const char* className () {return "A026";}
574 template <class Context>
575 bool serialize(Context& ctx, unsigned& ver)
579 static Key classId() { return 27; }
580 static const char* className () {return "A027";}
585 template <class Context>
586 bool serialize(Context& ctx, unsigned& ver)
590 static Key classId() { return 28; }
591 static const char* className () {return "A028";}
596 template <class Context>
597 bool serialize(Context& ctx, unsigned& ver)
601 static Key classId() { return 29; }
602 static const char* className () {return "A029";}
607 template <class Context>
608 bool serialize(Context& ctx, unsigned& ver)
612 static Key classId() { return 30; }
613 static const char* className () {return "A030";}
618 template <class Context>
619 bool serialize(Context& ctx, unsigned& ver)
623 static Key classId() { return 31; }
624 static const char* className () {return "A031";}
629 template <class Context>
630 bool serialize(Context& ctx, unsigned& ver)
634 static Key classId() { return 32; }
635 static const char* className () {return "A032";}
640 template <class Context>
641 bool serialize(Context& ctx, unsigned& ver)
645 static Key classId() { return 33; }
646 static const char* className () {return "A033";}
651 template <class Context>
652 bool serialize(Context& ctx, unsigned& ver)
656 static Key classId() { return 34; }
657 static const char* className () {return "A034";}
662 template <class Context>
663 bool serialize(Context& ctx, unsigned& ver)
667 static Key classId() { return 35; }
668 static const char* className () {return "A035";}
673 template <class Context>
674 bool serialize(Context& ctx, unsigned& ver)
678 static Key classId() { return 36; }
679 static const char* className () {return "A036";}
684 template <class Context>
685 bool serialize(Context& ctx, unsigned& ver)
689 static Key classId() { return 37; }
690 static const char* className () {return "A037";}
695 template <class Context>
696 bool serialize(Context& ctx, unsigned& ver)
700 static Key classId() { return 38; }
701 static const char* className () {return "A038";}
706 template <class Context>
707 bool serialize(Context& ctx, unsigned& ver)
711 static Key classId() { return 39; }
712 static const char* className () {return "A039";}
717 template <class Context>
718 bool serialize(Context& ctx, unsigned& ver)
722 static Key classId() { return 40; }
723 static const char* className () {return "A040";}
726 Factory<Key>& getInstance()
728 static Serializer<Key,
729 Loki::TL::MakeTypelist<
730 ClassSpec<Key, A001, 1>,
731 ClassSpec<Key, A002, 2>,
732 ClassSpec<Key, A003, 3>,
733 ClassSpec<Key, A004, 4>,
734 ClassSpec<Key, A005, 5>,
735 ClassSpec<Key, A006, 6>,
736 ClassSpec<Key, A007, 7>,
737 ClassSpec<Key, A008, 8>,
738 ClassSpec<Key, A009, 9>,
739 ClassSpec<Key, A010, 10>,
740 ClassSpec<Key, A011, 11>,
741 ClassSpec<Key, A012, 12>,
742 ClassSpec<Key, A013, 13>,
743 ClassSpec<Key, A014, 14>,
744 ClassSpec<Key, A015, 15>,
745 ClassSpec<Key, A016, 16>,
746 ClassSpec<Key, A017, 17>,
747 ClassSpec<Key, A018, 18>,
748 ClassSpec<Key, A019, 19>,
749 ClassSpec<Key, A020, 20>,
750 ClassSpec<Key, A021, 21>,
751 ClassSpec<Key, A022, 22>,
752 ClassSpec<Key, A023, 23>,
753 ClassSpec<Key, A024, 24>,
754 ClassSpec<Key, A025, 25>,
755 ClassSpec<Key, A026, 26>,
756 ClassSpec<Key, A027, 27>,
757 ClassSpec<Key, A028, 28>,
758 ClassSpec<Key, A029, 29>,
759 ClassSpec<Key, A030, 30>,
760 ClassSpec<Key, A031, 31>,
761 ClassSpec<Key, A032, 32>,
762 ClassSpec<Key, A033, 33>,
763 ClassSpec<Key, A034, 34>,
764 ClassSpec<Key, A035, 35>,
765 ClassSpec<Key, A036, 36>,
766 ClassSpec<Key, A037, 37>,
767 ClassSpec<Key, A038, 38>,
768 ClassSpec<Key, A039, 39>,
769 ClassSpec<Key, A040, 40>