IVGCVSW-5483 'Implement Loading and Saving to File'
[platform/upstream/armnn.git] / src / backends / cl / ClContextSerializer.hpp
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5
6 #pragma once
7
8 #include <arm_compute/core/CL/CLCompileContext.h>
9
10 #include <flatbuffers/flatbuffers.h>
11
12 namespace armnn
13 {
14
15 class ClContextSerializer
16 {
17 public:
18     ClContextSerializer()  = default;
19     ~ClContextSerializer() = default;
20
21     /// Serializes the CLCompileContext built-in programs
22     /// @param [in] clCompileContext The CLCompileContext to be serialized.
23     void Serialize(const arm_compute::CLCompileContext& clCompileContext);
24
25     /// Serializes the ClContext to the stream.
26     /// @param [stream] the stream to save to
27     /// @return true if ClContext is Serialized to the Stream, false otherwise
28     bool SaveSerializedToStream(std::ostream& stream);
29
30 private:
31     /// FlatBufferBuilder to create the CLContext FlatBuffers.
32     flatbuffers::FlatBufferBuilder m_FlatBufferBuilder;
33 };
34
35 } // namespace armnn