Added support for char arrays
authornvalimak <nvalimak@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Tue, 10 Mar 2009 19:09:33 +0000 (19:09 +0000)
committernvalimak <nvalimak@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Tue, 10 Mar 2009 19:09:33 +0000 (19:09 +0000)
git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@238 3cdefd35-fc62-479d-8e8d-bae585ffb9ca

libcds/src/static_sequence/wt_coder_binary.cpp
libcds/src/static_sequence/wt_coder_binary.h

index f8cc209..e9f37dc 100644 (file)
@@ -28,6 +28,13 @@ wt_coder_binary::wt_coder_binary(uint * seq, uint n, alphabet_mapper * am) {
   h=bits(max_v);
 }
 
+wt_coder_binary::wt_coder_binary(uchar * seq, uint n, alphabet_mapper * am) {
+       uint max_v = 0;
+  for(uint i=0;i<n;i++)
+      max_v = max(am->map((uint)seq[i]),max_v);
+  h=bits(max_v);
+}
+
 wt_coder_binary::wt_coder_binary() {}
 
 wt_coder_binary::~wt_coder_binary() {}
index 2b87854..850daf2 100644 (file)
@@ -36,6 +36,7 @@ class wt_coder_binary: public wt_coder {
     /** Buils a wt_coder_binary using the sequence of length n and the alphabet_mapper
      *  to determine the length of the binary codes */
                wt_coder_binary(uint * seq, uint n, alphabet_mapper * am);
+               wt_coder_binary(uchar * seq, uint n, alphabet_mapper * am);
                virtual ~wt_coder_binary();
                virtual bool is_set(uint symbol, uint l);
                virtual bool done(uint symbol, uint l);