00001 /* Copyright (C) GridGain Systems. All Rights Reserved. */ 00002 00003 /* _________ _____ __________________ _____ 00004 * __ ____/___________(_)______ /__ ____/______ ____(_)_______ 00005 * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ 00006 * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / 00007 * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ 00008 */ 00009 00010 #ifndef GRID_CLIENT_BOOL_HASHEABLE_OBJECT_HPP_INCLUDED 00011 #define GRID_CLIENT_BOOL_HASHEABLE_OBJECT_HPP_INCLUDED 00012 00013 #include "gridgain/gridhasheableobject.hpp" 00014 #include "gridgain/impl/utils/gridclientbyteutils.hpp" 00015 00019 class GridBoolHasheableObject : public GridClientHasheableObject { 00020 public: 00026 GridBoolHasheableObject(bool pVal); 00027 00033 virtual int32_t hashCode() const { return hashCode_; } 00034 00040 virtual void convertToBytes(std::vector<int8_t>& opBytes) const { opBytes = bytes; } 00041 00042 protected: 00044 int32_t hashCode_; 00045 00047 std::vector<int8_t> bytes; 00048 }; 00049 00055 inline GridBoolHasheableObject::GridBoolHasheableObject(bool pVal) { 00056 hashCode_ = pVal ? 1231 : 1237; 00057 00058 bytes.resize(sizeof(hashCode_)); 00059 memset(&bytes[0], 0, sizeof(hashCode_)); 00060 00061 GridClientByteUtils::valueToBytes(hashCode_, &bytes[0], sizeof(hashCode_), GridClientByteUtils::LITTLE_ENDIAN_ORDER); 00062 } 00063 00064 #endif
1.7.1