ad_map_access
Serializer.hpp
Go to the documentation of this file.
1 // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 //
3 // Copyright (C) 2018-2021 Intel Corporation
4 //
5 // SPDX-License-Identifier: MIT
6 //
7 // ----------------- END LICENSE BLOCK -----------------------------------
12 #pragma once
13 
14 #include <string>
15 #include <vector>
16 
20 
22 namespace ad {
24 namespace map {
26 namespace serialize {
27 
31 class Serializer : public ISerializer, virtual public IChecksum
32 {
33 public: // Constants
34  static size_t VERSION_MAJOR;
35  static size_t VERSION_MINOR;
36 
37 private: // Constants
38  static size_t MAGIC;
39 
40 public: // Constructor/Destructor
41  Serializer(bool store, bool calc_checksum);
42  virtual ~Serializer();
43 
44 public: // Operations
45  bool open(std::string const &config, size_t &version_major, size_t &version_minor);
46  bool close();
47 
48 private: // Aux Methods
49  bool openForRead(std::string const &config, size_t &version_major, size_t &version_minor);
50  bool openForWrite(std::string const &config);
51  bool closeForRead();
52  bool closeForWrite();
53 
54  bool write(const void *x, size_t bytes) override;
55  bool read(void *x, size_t bytes) override;
56 
57 private: // Data Members
58  bool open_;
59  bool calc_checksum_;
60 };
61 
62 } // namespace serialize
63 } // namespace map
64 } // namespace ad
ad
namespace ad
Definition: GeometryStoreItem.hpp:28
ad::map::serialize::ISerializer
Interface for Serializer.
Definition: ISerializer.hpp:34
ISerializer.hpp
ad::map::serialize::IChecksum
Interface for Checksum.
Definition: IChecksum.hpp:28
ad::map::serialize::Serializer
Serializer implementation.
Definition: Serializer.hpp:31
IChecksum.hpp
IStorage.hpp