cmn_FastZeroRecSearch Class Reference
[G_new_group]

#include <cmn_FastSearch.h>

Inheritance diagram for cmn_FastZeroRecSearch:

Inheritance graph
[legend]
Collaboration diagram for cmn_FastZeroRecSearch:

Collaboration graph
[legend]

List of all members.


Detailed Description

This is a class for fast search of zeroes through buffer.

Definition at line 218 of file cmn_FastSearch.h.


Public Member Functions

 cmn_FastZeroRecSearch (int a_numberOfZeroes)
 cmn_FastZeroRecSearch (const char *const a_buffer_p, const int a_bufLen, int a_numberOfZeroes)
virtual ~cmn_FastZeroRecSearch ()
void SetPattern (const string &a_pattern)
 set new search pattern, just to implement virtual method
void SetNumberOfZeroes (const int a_num)
Int32_t Find ()
 NOTE! if return value is grater than buffer then string was not found the return value is willing handled in this way, because of using same algorithem with merging buffers.

Public Attributes

 log_CLASSID_m
 Macro to add class name member s_className.

Constructor & Destructor Documentation

cmn_FastZeroRecSearch::cmn_FastZeroRecSearch ( int  a_numberOfZeroes  ) 

Definition at line 306 of file cmn_FastSearch.cpp.

References log_FUNC_m.

00308             :
00309             cmn_FastZeroSearch(NULL, 0, a_recLen)
00310 {
00311     log_FUNC_m(cmn_FastZeroRecSearch);
00312     //Empty
00313 } 
//============================================================================//

cmn_FastZeroRecSearch::cmn_FastZeroRecSearch ( const char *const   a_buffer_p,
const int  a_bufLen,
int  a_numberOfZeroes 
)

Definition at line 317 of file cmn_FastSearch.cpp.

References log_FUNC_m.

00321             :
00322             cmn_FastZeroSearch(a_buffer_p, a_bufLen, a_recLen)
00323 {
00324     log_FUNC_m(cmn_FastZeroRecSearch);
00325     //Empty
00326 }
//============================================================================//

virtual cmn_FastZeroRecSearch::~cmn_FastZeroRecSearch (  )  [inline, virtual]

Definition at line 229 of file cmn_FastSearch.h.

00229 {};


Member Function Documentation

void cmn_FastZeroRecSearch::SetPattern ( const string &  a_pattern  )  [inline, virtual]

set new search pattern, just to implement virtual method

Reimplemented from cmn_FastZeroSearch.

Definition at line 239 of file cmn_FastSearch.h.

00239                                                      {
00240         m_numberOfZeroes = static_cast<UInt32_t>(a_pattern.length());
00241     };

void cmn_FastZeroRecSearch::SetNumberOfZeroes ( const int  a_num  )  [inline]

Reimplemented from cmn_FastZeroSearch.

Definition at line 243 of file cmn_FastSearch.h.

00243 {m_numberOfZeroes = a_num;};

Int32_t cmn_FastZeroRecSearch::Find (  )  [virtual]

NOTE! if return value is grater than buffer then string was not found the return value is willing handled in this way, because of using same algorithem with merging buffers.

It's known how much buffer is need to be merged at front of next buffer.

Reimplemented from cmn_FastZeroSearch.

Definition at line 330 of file cmn_FastSearch.cpp.

References log_FUNC_m, cmn_FastSearch::m_buffer_p, cmn_FastSearch::m_bufLen, cmn_FastZeroSearch::m_numberOfZeroes, and zero.

00330                                     {
00331     log_FUNC_m(Find);
00332 
00333     register UInt32_t   patLen   = m_numberOfZeroes;
00334     register UInt32_t   patLen_1 = patLen - 1;
00335 
00336     register const char *p    = m_buffer_p + patLen_1;
00337     register const char *s    = m_buffer_p;
00338 
00339     register char    zero = 0;
00340 
00341     const char          *buff = m_buffer_p;
00342 
00343     const char *limit = buff + m_bufLen;
00344     while (p < limit) {                           
00345        while (*p == zero) {
00346            if (p == s) {
00347               return static_cast<Int32_t>(p - buff);
00348            }
00349            p--;
00350        }
00351        p = patLen_1 + (s += patLen);  // s = start of next rec and p = end of next record
00352     }
00353     return static_cast<Int32_t>( (p - buff - m_bufLen) - patLen );  // NOTE! if return value is negative then string was not found
00354 }


Member Data Documentation

Macro to add class name member s_className.

Reimplemented from cmn_FastZeroSearch.

Definition at line 229 of file cmn_FastSearch.h.


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 19:04:28 2012 for OPENARCHIVE by  doxygen 1.5.6