LCOV - code coverage report
Current view: top level - include/ad/map/serialize - ChecksumCRC32.hpp (source / functions) Hit Total Coverage
Test: ad_map_access Lines: 2 2 100.0 %
Date: 2022-10-04 09:48:07 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2018-2021 Intel Corporation
       4                 :            : //
       5                 :            : // SPDX-License-Identifier: MIT
       6                 :            : //
       7                 :            : // ----------------- END LICENSE BLOCK -----------------------------------
       8                 :            : /**
       9                 :            :  * @file
      10                 :            :  */
      11                 :            : 
      12                 :            : #pragma once
      13                 :            : 
      14                 :            : #include <cstdint>
      15                 :            : 
      16                 :            : #include "ad/map/serialize/IChecksum.hpp"
      17                 :            : #include "ad/map/serialize/IStorage.hpp"
      18                 :            : 
      19                 :            : /** @brief namespace ad */
      20                 :            : namespace ad {
      21                 :            : /** @brief namespace map */
      22                 :            : namespace map {
      23                 :            : /** @brief namespace serialize */
      24                 :            : namespace serialize {
      25                 :            : 
      26                 :            : /**
      27                 :            :  * @brief Standalone checksum CRC32 calculation
      28                 :            :  */
      29                 :            : uint32_t calculateCRC32Checksum(const void *x, size_t bytes);
      30                 :            : 
      31                 :            : /**
      32                 :            :  * @brief Checksum CRC32 calculation implementation
      33                 :            :  */
      34                 :            : class ChecksumCRC32 : virtual public IChecksum, virtual public IStorage
      35                 :            : {
      36                 :            : protected: // Constructor/Destructor
      37                 :            :   ChecksumCRC32();
      38                 :            :   virtual ~ChecksumCRC32();
      39                 :            : 
      40                 :            : public: // Overriden IChecksum
      41                 :          1 :   const char *getChecksumType() override
      42                 :            :   {
      43                 :          1 :     return "CRC-32";
      44                 :            :   }
      45                 :            : 
      46                 :            : protected: // Overriden IChecksum
      47                 :            :   void initChecksum() override;
      48                 :            :   void updateChecksum(const void *x, size_t bytes) override;
      49                 :            :   bool writeChecksum() override;
      50                 :            :   bool checksumOK() override;
      51                 :            : 
      52                 :            : private:
      53                 :            :   uint32_t mCrc;
      54                 :            : };
      55                 :            : 
      56                 :            : } // namespace serialize
      57                 :            : } // namespace map
      58                 :            : } // namespace ad

Generated by: LCOV version 1.14