Changeset 2170 for proto/parabix2/src


Ignore:
Timestamp:
May 28, 2012, 12:44:44 PM (7 years ago)
Author:
ksherdy
Message:

Refactored TagMatcher? and pablo template.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/src/TagMatcher.hpp

    r2160 r2170  
    1717};
    1818
    19 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
     19template <uint64_t BUF_SIZE, uint64_t LA_SIZE> // buffer size, look ahead size
    2020class TagMatcher {
    2121
     
    3030  int does_match(char * s1, char * s2, int lgth);
    3131  int lookup_or_insert(char*s, int lgth);
    32 
    33     int depth;
     32  int depth;
    3433
    3534private:
     
    5655};
    5756
    58 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    59 int TagMatcher<BUF_SIZE, OVER_SIZE>::does_match(char * s1, char * s2, int lgth){
     57template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     58int TagMatcher<BUF_SIZE, LA_SIZE>::does_match(char * s1, char * s2, int lgth){
    6059    int matchlen = 0;
    6160    int i=0;
     
    8079
    8180
    82 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    83 int TagMatcher<BUF_SIZE, OVER_SIZE>::lookup_or_insert(char* s, int lgth){
     81template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     82int TagMatcher<BUF_SIZE, LA_SIZE>::lookup_or_insert(char* s, int lgth){
    8483  for(int i=0; i< this->att_index; i++)
    8584    if(lgth == this->Attr[i].lgth &&  this->does_match(s,this->Attr[i].start,lgth))
     
    9392
    9493
    95 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    96 int TagMatcher<BUF_SIZE, OVER_SIZE>:: tag_match(int pos, int chars_avail) {
     94template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     95int TagMatcher<BUF_SIZE, LA_SIZE>:: tag_match(int pos, int chars_avail) {
    9796        int rt_val=0;
    9897//      end tag
     
    105104
    106105      if (does_match(this->tag_stack[depth],&this->srcbuf[pos],lgth) && ((this->srcbuf[pos+lgth] == '>') ||(this->srcbuf[pos+lgth] <= ' '))) rt_val=0;
    107       else if (pos + lgth >= BUF_SIZE + OVER_SIZE) {
     106          else if (pos + lgth >= BUF_SIZE + LA_SIZE) {
    108107        this->state = InEndTag;
    109108        this-> inTagPos = BUF_SIZE - pos;
     
    185184}
    186185
    187 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    188 int TagMatcher<BUF_SIZE, OVER_SIZE>::StreamScan(int chars_avail) {
     186template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     187int TagMatcher<BUF_SIZE, LA_SIZE>::StreamScan(int chars_avail) {
    189188
    190189        int blk;
     
    220219}
    221220
    222 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    223 void TagMatcher<BUF_SIZE, OVER_SIZE>::store_streams(BitBlock tagMark, BitBlock NameFollow, BitBlock miscMark, int chars_avail){
     221template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     222void TagMatcher<BUF_SIZE, LA_SIZE>::store_streams(BitBlock tagMark, BitBlock NameFollow, BitBlock miscMark, int chars_avail){
    224223#ifdef DUMP
    225224print_register<BitBlock>("tagMark", tagMark);
     
    283282}
    284283
    285 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    286 TagMatcher<BUF_SIZE, OVER_SIZE>::TagMatcher(){
     284template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     285TagMatcher<BUF_SIZE, LA_SIZE>::TagMatcher(){
    287286  this->stream_index = 0;
    288287  this->depth = 0;
     
    294293}
    295294
    296 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    297 TagMatcher<BUF_SIZE, OVER_SIZE>::~TagMatcher(){
    298 
    299 }
    300 
    301 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    302 void TagMatcher<BUF_SIZE, OVER_SIZE>::setSrc(char * src){
     295template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     296TagMatcher<BUF_SIZE, LA_SIZE>::~TagMatcher(){
     297
     298}
     299
     300template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     301void TagMatcher<BUF_SIZE, LA_SIZE>::setSrc(char * src){
    303302  this->srcbuf = src;
    304303}
    305304
    306 template <uint64_t BUF_SIZE, uint64_t OVER_SIZE>
    307 void TagMatcher<BUF_SIZE, OVER_SIZE>::Advance_buffer(){
     305template <uint64_t BUF_SIZE, uint64_t LA_SIZE>
     306void TagMatcher<BUF_SIZE, LA_SIZE>::Advance_buffer(){
    308307  this->buf_base += BUF_SIZE;
    309308  this->stream_index=0;
Note: See TracChangeset for help on using the changeset viewer.