sdbf  3.3
 All Classes Functions Variables Friends
Public Member Functions | Static Public Attributes | Friends
sdbf Class Reference

sdbf class More...

#include <sdbf_class.h>

List of all members.

Public Member Functions

 sdbf (FILE *in)
 to read formatted sdbfs from open file pointer
 sdbf (const char *filename, uint32_t dd_block_size)
 to create new from a single file
 sdbf (const char *name, std::istream *ifs, uint32_t dd_block_size, uint64_t msize, index_info *info)
 to create by reading from an open stream
 sdbf (const char *name, char *str, uint32_t dd_block_size, uint64_t length, index_info *info)
 to create from a c-string
 ~sdbf ()
 destructor
const char * name ()
 object name
uint64_t size ()
 object size
uint64_t input_size ()
 source object size
int32_t compare (sdbf *other, uint32_t sample)
 matching algorithm, take other object and run match
string to_string () const
 return a string representation of this sdbf
string get_index_results () const
 return results of index search
uint8_t * clone_filter (uint32_t position)
 return a copy of an individual bloom filter from this sdbf

Static Public Attributes

static class sdbf_confconfig = new sdbf_conf(1, FLAG_OFF, _MAX_ELEM_COUNT, _MAX_ELEM_COUNT_DD)
 global configuration object

Friends

std::ostream & operator<< (std::ostream &os, const sdbf &s)
 output operator
std::ostream & operator<< (std::ostream &os, const sdbf *s)
 output operator

Detailed Description

sdbf: a Similarity Digest Bloom Filter class.

Examples:
sdbf_test.cc.

Constructor & Destructor Documentation

sdbf::sdbf ( FILE *  in)

Reads an already generated sdbf from open file. Throws exceptions in case of bad formatting.

Parameters:
inFILE* open formatted as list of sdbfs
sdbf::sdbf ( const char *  filename,
uint32_t  dd_block_size 
)

Create new sdbf from file. dd_block_size turns on "block" mode.

Parameters:
filenamefile to hash
dd_block_sizesize of block to process file with. 0 is off.
sdbf::sdbf ( const char *  name,
std::istream *  ifs,
uint32_t  dd_block_size,
uint64_t  msize,
index_info *  info 
)

Generates a new sdbf, with a maximum size read from an open stream. dd_block_size enables block mode.

Parameters:
namename of stream
ifsopen istream to read raw data from
dd_block_sizesize of block to divide data with. 0 is off.
msizeamount of data to read and process
infoblock of information about indexes
sdbf::sdbf ( const char *  name,
char *  str,
uint32_t  dd_block_size,
uint64_t  length,
index_info *  info 
)

Generates a new sdbf, from a char *string dd_block_size enables block mode.

Parameters:
namename of stream
strinput to be hashed
dd_block_sizesize of block to divide data with. 0 is off.
lengthlength of str to be hashed
infoblock of information about indexes

Destroys this sdbf


Member Function Documentation

uint8_t * sdbf::clone_filter ( uint32_t  position)

Clones a copy of a single bloom filter in this sdbf.

Warning: 256-bytes long, not terminated, may contain nulls.

Parameters:
positionindex of bloom filter
Returns:
uint8_t* pointer to 256-byte long bloom filter
int32_t sdbf::compare ( sdbf other,
uint32_t  sample 
)

Compares this sdbf to other passed sdbf, returns a confidence score

Parameters:
othersdbf* to compare to self
samplesets the number of BFs to sample - 0 uses all
Returns:
int32_t confidence score
Examples:
sdbf_test.cc.
uint64_t sdbf::input_size ( )

Returns the size of the data that the hash was generated from.

Returns:
uint64_t length value
const char * sdbf::name ( )

Returns the name of the file or data this sdbf represents.

Returns:
char* of file name
uint64_t sdbf::size ( )

Returns the size of the hash data for this sdbf

Returns:
uint64_t length value
string sdbf::to_string ( ) const

Encode this sdbf and return it as a string.

Returns:
std::string containing sdbf suitable for display or writing to file

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