File indexing completed on 2024-11-17 04:55:18
0001 /* 0002 SPDX-License-Identifier: MPL-2.0 0003 */ 0004 0005 /* Copyright (c) 2015 Brian R. Bondy. Distributed under the MPL2 license. 0006 * This Source Code Form is subject to the terms of the Mozilla Public 0007 * License, v. 2.0. If a copy of the MPL was not distributed with this 0008 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 0009 0010 #ifndef HASH_SET_WRAP_H_ 0011 #define HASH_SET_WRAP_H_ 0012 0013 #include <node.h> 0014 #include <node_object_wrap.h> 0015 0016 #include "./hash_set.h" 0017 #include "./test/example_data.h" 0018 0019 namespace HashSetWrap { 0020 0021 /** 0022 * Wraps Hash Set for use in Node 0023 */ 0024 class HashSetWrap : public HashSet<ExampleData>, public node::ObjectWrap { 0025 public: 0026 static void Init(v8::Local<v8::Object> exports); 0027 0028 private: 0029 explicit HashSetWrap(uint32_t bucket_count, bool multi_set); 0030 virtual ~HashSetWrap(); 0031 0032 static void New(const v8::FunctionCallbackInfo<v8::Value>& args); 0033 0034 static void AddItem(const v8::FunctionCallbackInfo<v8::Value>& args); 0035 static void ItemExists(const v8::FunctionCallbackInfo<v8::Value>& args); 0036 0037 static v8::Persistent<v8::Function> constructor; 0038 }; 0039 0040 } // namespace HashSetWrap 0041 0042 #endif // HASH_SET_WRAP_H_