// 2007 Hiroyuki Ogasawara // vim:ts=4 sw=4: // http://dench.flatlib.jp/ /*! @file StaticTaskSystem.h @author Hiroyuki Ogasawara @date 2007/09/01 @brief */ #ifndef __FL_STATICTASKSYSTEM__H__ #define __FL_STATICTASKSYSTEM__H__ namespace TS { //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- struct Null_T { }; template< typename TA= Null_T, typename TB= Null_T, typename TC= Null_T, typename TD= Null_T, typename TE= Null_T, typename TF= Null_T, typename TG= Null_T, typename TH= Null_T, typename TI= Null_T, typename TJ= Null_T, typename TK= Null_T, typename TL= Null_T, typename TM= Null_T, typename TN= Null_T, typename TO= Null_T, typename TP= Null_T, typename TQ= Null_T, typename TR= Null_T, typename TS= Null_T, typename TT= Null_T, typename TU= Null_T, typename TV= Null_T, typename TW= Null_T, typename TX= Null_T, typename TY= Null_T, typename TZ= Null_T > struct Array { typedef TA Head; typedef Array Tail; }; template<> struct Array< Null_T,Null_T,Null_T,Null_T,Null_T,Null_T,Null_T,Null_T, Null_T,Null_T,Null_T,Null_T,Null_T,Null_T,Null_T,Null_T, Null_T,Null_T,Null_T,Null_T,Null_T,Null_T,Null_T,Null_T, Null_T,Null_T> { typedef Null_T Head; typedef Null_T Tail; }; template struct Length { enum { value= Length::value + 1, }; }; template<> struct Length > { enum { value= 0, }; }; template struct Index { enum { value= Index::value, }; }; template struct Index { enum { value= C, }; }; template struct Index,B,C> { enum { value= -1, }; }; template struct Node { typedef A Head; typedef B TypeL; typedef C TypeS; }; template struct HSortRef; template struct HSortSub { private: enum { value= B::value >= A::Head::value, }; typedef typename HSortRef::result L1; typedef typename HSortRef::result S1; public: typedef Node result; }; template struct HSortSub { typedef Node result; }; template struct HSortRef { typedef typename HSortSub::result result; }; template struct HSortRef { typedef A result; }; template struct Sort { typedef typename Sort::result>::result result; }; template struct Sort,B> { typedef B result; }; #define __TS_FORCEINLINE __forceinline template struct ExecTask { __TS_FORCEINLINE static void Exec() { ExecTask::Exec(); A::Head::Exec(); ExecTask::Exec(); } }; template<> struct ExecTask { static void Exec() { } }; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- } #endif