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 NO_FINGERPRINT_DOMAIN_H_ 0011 #define NO_FINGERPRINT_DOMAIN_H_ 0012 0013 #include "./base.h" 0014 0015 class NoFingerprintDomain { 0016 public: 0017 NoFingerprintDomain(); 0018 NoFingerprintDomain(const NoFingerprintDomain &other); 0019 NoFingerprintDomain(const char * data, int dataLen); 0020 ~NoFingerprintDomain(); 0021 0022 uint64_t hash() const; 0023 uint64_t GetHash() const { 0024 return hash(); 0025 } 0026 0027 uint32_t Serialize(char *buffer); 0028 uint32_t Deserialize(char *buffer, uint32_t bufferSize); 0029 // Nothing needs to be updated when being added multiple times 0030 void Update(const NoFingerprintDomain&) {} 0031 0032 bool operator==(const NoFingerprintDomain &rhs) const; 0033 0034 private: 0035 // Holds true if the data should not free memory because for example it 0036 // was loaded from a large buffer somewhere else via the serialize and 0037 // deserialize functions. 0038 bool borrowed_data; 0039 char *data; 0040 int dataLen; 0041 }; 0042 0043 #endif // NO_FINGERPRINT_DOMAIN_H_