X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libhashkit%2Fhashkit.h;h=451333075f225c83641647dcd93065db946935f1;hb=55e0ec6389a0d13dde237552cfef6b83b4728e3f;hp=5f19f9d34af3221da3a6f564f5a076940eb038ce;hpb=284978b1dc258cb8cd2a32d6a0f25f2f9b284149;p=awesomized%2Flibmemcached diff --git a/libhashkit/hashkit.h b/libhashkit/hashkit.h index 5f19f9d3..45133307 100644 --- a/libhashkit/hashkit.h +++ b/libhashkit/hashkit.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -63,36 +64,32 @@ struct hashkit_st struct { bool is_allocated:1; } options; +}; #ifdef __cplusplus +class Hashkit : private hashkit_st { + +public: - hashkit_st() : - base_hash(), - distribution_hash(), - flags(), - options() + Hashkit() { hashkit_create(this); } - hashkit_st(const hashkit_st& source) : - base_hash(), - distribution_hash(), - flags(), - options() + Hashkit(const Hashkit& source) { hashkit_clone(this, &source); } - hashkit_st& operator=(const hashkit_st& source) - { + Hashkit& operator=(const Hashkit& source) + { hashkit_free(this); hashkit_clone(this, &source); return *this; } - friend bool operator==(const hashkit_st &left, const hashkit_st &right) + friend bool operator==(const Hashkit &left, const Hashkit &right) { return hashkit_compare(&left, &right); } @@ -117,12 +114,12 @@ struct hashkit_st return hashkit_set_function(this, hash_algorithm); } - ~hashkit_st() + ~Hashkit() { hashkit_free(this); } -#endif }; +#endif #endif /* HASHKIT_H */