brave/hashset-cpp

Name: hashset-cpp

Owner: Brave Software

Description: Simple hashtable implementation with easy serialization and deserialization

Created: 2016-01-21 22:00:27.0

Updated: 2018-03-25 02:13:02.0

Pushed: 2018-03-25 02:13:01.0

Homepage: null

Size: 47

Language: C++

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

hashset-cpp

Implements a simple HashSet for strings in environments where you don't have the std lib available. You should probably not be using this. Instead consider using hash_set which is a more generic implementation with templates. This is only useful for very specific use cases having specific memory layout requirements.

Setup
install --save hashset-cpp
Sample
lude <iostream>
lude "HashSet.h"
lude "test/exampleData.h"

g std::cout;
g std::endl;

main(int argc, char **argv) {
shSet<ExampleData> set(256);
t.add(ExampleData("test"));

 Prints true
ut << "test exists: " << (set.exists(ExampleData("test"))
  ? "true" : "false") << endl;
 Prints false
ut << "test2 exists: " << (set.exists(ExampleData("test2"))
  ? "true" : "false") << endl;

nt32_t len;
ar * buffer = set.serialize(&len);
shSet<ExampleData> set2(0);
t2.deserialize(buffer, len);
 Prints true
ut << "test exists: " << (set2.exists(ExampleData("test"))
  ? "true" : "false") << endl;
 Prints false
ut << "test2 exists: " << (set2.exists(ExampleData("test2"))
  ? "true" : "false") << endl;

lete[] buffer;
turn 0;

Build everything in release

Running sample
 sample
Running tests
 test
Clearing build files
 clean
Linting
run lint

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.