Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No "using" in public header file. #14

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/BloomFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <fstream>
#include "BloomFilter.hpp"

using namespace std;

static const size_t BITS_PER_BLOCK = 8;

// Forward declarations
Expand Down Expand Up @@ -151,4 +153,4 @@ static vector<BlockType> readVectorFromStream(BinaryInputStream &in) {

size_t BloomFilter::getBitCount() const {
return bitCount;
}
}
17 changes: 7 additions & 10 deletions src/BloomFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
#include <iostream>
#include <string>
#include <vector>
#include <iterator>

using namespace std;

typedef char BlockType;
typedef basic_istream<BlockType> BinaryInputStream;
typedef basic_ostream<BlockType> BinaryOutputStream;
typedef std::basic_istream<BlockType> BinaryInputStream;
typedef std::basic_ostream<BlockType> BinaryOutputStream;

/*
Bloom filter with djb2 and sdbm hashing. It is a loose C++ port of
Expand All @@ -34,22 +31,22 @@ class BloomFilter {
public:
BloomFilter(size_t maxItems, double targetProbability);

BloomFilter(const string &importFilePath, size_t bitCount, size_t maxItems);
BloomFilter(const std::string &importFilePath, size_t bitCount, size_t maxItems);

BloomFilter(BinaryInputStream &in, size_t bitCount, size_t maxItems);

void add(const string &element);
void add(const std::string &element);

bool contains(const string &element);
bool contains(const std::string &element);

void writeToFile(const string &exportFilePath);
void writeToFile(const std::string &exportFilePath);

void writeToStream(BinaryOutputStream &out);

size_t getBitCount() const;

private:
size_t bitCount;
vector<BlockType> bloomVector;
std::vector<BlockType> bloomVector;
size_t hashRounds;
};