ArmNN
 20.02
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 35 of file CommandHandlerRegistry.cpp.

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

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

◆ RegisterFunctor() [1/2]

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

Definition at line 17 of file CommandHandlerRegistry.cpp.

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

21 {
22  BOOST_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
23 
24  CommandHandlerKey key(familyId, packetId, version);
25  registry[key] = functor;
26 }

◆ RegisterFunctor() [2/2]

void RegisterFunctor ( CommandHandlerFunctor functor)

Definition at line 28 of file CommandHandlerRegistry.cpp.

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

29 {
30  BOOST_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
31 
32  RegisterFunctor(functor, functor->GetFamilyId(), functor->GetPacketId(), functor->GetVersion());
33 }
void RegisterFunctor(CommandHandlerFunctor *functor, uint32_t familyId, uint32_t packetId, uint32_t version)

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