TypedCreationPreferences.hpp

00001 #ifndef __FISH_BONE_TYPEDCREATIONPREFERENCES_HPP
00002 #define __FISH_BONE_TYPEDCREATIONPREFERENCES_HPP
00003 
00004 #include "fishboneDllApi.h"
00005 
00006 #include <ocean/plankton/VCreationPreferences.hpp>
00007 #include <field/FiberType.hpp>
00008 #include <meta/LIST.hpp>
00009 
00010 namespace Wizt
00011 {
00012 
00017 class fishbone_API TypedCreationPreferencesBase : public VCreationPreferences
00018 {
00019 public:
00020         TypedCreationPreferencesBase (); 
00021         ~TypedCreationPreferencesBase (); 
00022 
00026         virtual int AcceptTypes(Fiber::TypeList_t&AcceptedFields) const = 0;
00027 };
00028 
00029 
00033 template <class T>
00034 class   TypedCreationPreferences : public TypedCreationPreferencesBase 
00035 {
00036 public:
00037         TypedCreationPreferences() {}
00038         ~TypedCreationPreferences() {}
00039 
00040         override int AcceptTypes(Fiber::TypeList_t&AcceptedFields) const 
00041         {
00042         Fiber::AcceptType<T> XXX(AcceptedFields);
00043                 return 1;
00044         }
00045 };
00046 
00051 template <class T, class NEXT>
00052 class   TypedCreationPreferences<META::LIST<T, NEXT> >  : public TypedCreationPreferences<NEXT>
00053 {
00054 public:
00055         TypedCreationPreferences() {}
00056         ~TypedCreationPreferences() {}
00057 
00058         override int AcceptTypes(Fiber::TypeList_t&AcceptedFields) const 
00059         {
00060         Fiber::AcceptType<T> XXX(AcceptedFields); 
00061                 return TypedCreationPreferences<NEXT>::AcceptTypes(AcceptedFields)+1;
00062         }
00063 };
00064 
00065 template <class T>
00066 class   TypedCreationPreferences<META::LIST<T> >  : public TypedCreationPreferencesBase
00067 {
00068 public:
00069         override int AcceptTypes(Fiber::TypeList_t&AcceptedFields) const 
00070         {
00071         Fiber::AcceptType<T> XXX(AcceptedFields);
00072                 return 1;
00073         }
00074 };
00075 
00076 } // namespace Wizt
00077 
00078 #endif /* __FISH_BONE_TYPEDCREATIONPREFERENCES_HPP */
00079 
00080