File indexing completed on 2026-04-09 07:49:34
0001 #include <vector>
0002 #include "SStr.hh"
0003 #include "SEnabled.hh"
0004
0005 template<unsigned N>
0006 SEnabled<N>::SEnabled(const char* spec)
0007 :
0008 enabled(new std::bitset<N>())
0009 {
0010 char delim = ',' ;
0011 std::vector<int> ivec ;
0012 SStr::ISplit( spec, ivec, delim );
0013
0014 for(unsigned i=0 ; i < ivec.size() ; i++)
0015 {
0016 int idx = ivec[i];
0017 if(idx < 0 ) idx += int(N) ;
0018 assert( idx >= 0 && idx < int(N) );
0019 (*enabled)[unsigned(idx)] = true ;
0020 }
0021 }
0022
0023
0024
0025 template<unsigned N>
0026 bool SEnabled<N>::isEnabled(unsigned idx) const
0027 {
0028 return (*enabled)[idx] ;
0029 }
0030
0031 template struct SEnabled<1>;
0032 template struct SEnabled<2>;
0033 template struct SEnabled<4>;
0034 template struct SEnabled<8>;
0035 template struct SEnabled<16>;
0036 template struct SEnabled<32>;
0037 template struct SEnabled<64>;
0038 template struct SEnabled<128>;
0039 template struct SEnabled<256>;
0040 template struct SEnabled<512>;
0041 template struct SEnabled<1024>;
0042
0043