ArmNN
 20.02
CommandHandlerRegistry.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
9 #include "CommandHandlerKey.hpp"
10 
11 #include <boost/functional/hash.hpp>
12 
13 #include <unordered_map>
14 
15 namespace armnn
16 {
17 
18 namespace profiling
19 {
20 
22 {
23  std::size_t operator() (const CommandHandlerKey& commandHandlerKey) const
24  {
25  std::size_t seed = 0;
26  boost::hash_combine(seed, commandHandlerKey.GetPacketId());
27  boost::hash_combine(seed, commandHandlerKey.GetVersion());
28  return seed;
29  }
30 };
31 
33 {
34 public:
35  CommandHandlerRegistry() = default;
36 
37  void RegisterFunctor(CommandHandlerFunctor* functor, uint32_t familyId, uint32_t packetId, uint32_t version);
38 
39  void RegisterFunctor(CommandHandlerFunctor* functor);
40 
41  CommandHandlerFunctor* GetFunctor(uint32_t familyId, uint32_t packetId, uint32_t version) const;
42 
43 private:
44  std::unordered_map<CommandHandlerKey, CommandHandlerFunctor*, CommandHandlerHash> registry;
45 };
46 
47 } // namespace profiling
48 
49 } // namespace armnn
Copyright (c) 2020 ARM Limited.
std::size_t operator()(const CommandHandlerKey &commandHandlerKey) const