ArmNN
 20.05
CommandHandlerRegistry Class Reference

#include <CommandHandlerRegistry.hpp>

Public Member Functions

 CommandHandlerRegistry ()=default
 
void RegisterFunctor (CommandHandlerFunctor *functor, uint32_t familyId, uint32_t packetId, uint32_t version)
 
void RegisterFunctor (CommandHandlerFunctor *functor)
 
CommandHandlerFunctorGetFunctor (uint32_t familyId, uint32_t packetId, uint32_t version) const
 

Detailed Description

Definition at line 32 of file CommandHandlerRegistry.hpp.

Constructor & Destructor Documentation

◆ CommandHandlerRegistry()

Member Function Documentation

◆ GetFunctor()

CommandHandlerFunctor * GetFunctor ( uint32_t  familyId,
uint32_t  packetId,
uint32_t  version 
) const

Definition at line 36 of file CommandHandlerRegistry.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), CommandHandler::Stop(), and GatordMockService::WaitCommand().

37 {
38  CommandHandlerKey key(familyId, packetId, version);
39 
40  // Check that the requested key exists
41  if (registry.find(key) == registry.end())
42  {
44  boost::str(boost::format("Functor with requested PacketId=%1% and Version=%2% does not exist")
45  % packetId
46  % version));
47  }
48 
49  CommandHandlerFunctor* commandHandlerFunctor = registry.at(key);
50  if (commandHandlerFunctor == nullptr)
51  {
52  throw RuntimeException(
53  boost::str(boost::format("Invalid functor registered for PacketId=%1% and Version=%2%")
54  % packetId
55  % version));
56  }
57 
58  return commandHandlerFunctor;
59 }

◆ RegisterFunctor() [1/2]

void RegisterFunctor ( CommandHandlerFunctor functor,
uint32_t  familyId,
uint32_t  packetId,
uint32_t  version 
)

Definition at line 18 of file CommandHandlerRegistry.cpp.

References ARMNN_ASSERT_MSG.

Referenced by BOOST_AUTO_TEST_CASE(), GatordMockService::GatordMockService(), ProfilingService::ProfilingService(), and CommandHandlerRegistry::RegisterFunctor().

22 {
23  ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
24 
25  CommandHandlerKey key(familyId, packetId, version);
26  registry[key] = functor;
27 }
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15

◆ RegisterFunctor() [2/2]

void RegisterFunctor ( CommandHandlerFunctor functor)

Definition at line 29 of file CommandHandlerRegistry.cpp.

References ARMNN_ASSERT_MSG, CommandHandlerFunctor::GetFamilyId(), CommandHandlerFunctor::GetPacketId(), CommandHandlerFunctor::GetVersion(), and CommandHandlerRegistry::RegisterFunctor().

30 {
31  ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
32 
33  RegisterFunctor(functor, functor->GetFamilyId(), functor->GetPacketId(), functor->GetVersion());
34 }
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
void RegisterFunctor(CommandHandlerFunctor *functor, uint32_t familyId, uint32_t packetId, uint32_t version)

The documentation for this class was generated from the following files: