MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/configuration/hardware/FunctionTable.hpp
2024-06-07 11:12:56 +03:00

42 lines
989 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!\file
* \brief \todo Описание файла.
*/
/*
* FunctionTable.hpp
*
* Created on: 23 мая 2019 г.
* Author: titov
*/
#ifndef SOURCE_APPLICATION_HARDWARE_FUNCTIONTABLE_HPP_
#define SOURCE_APPLICATION_HARDWARE_FUNCTIONTABLE_HPP_
#include "PeripheralId.hh"
#include "PeripheralFactory.hpp"
namespace configuration { namespace hardware {
template<const PeripheralFactory::FunctionId * table, std::size_t size,
PeripheralFactory::FunctionId unknow = 0>
struct FunctionTable {
PeripheralFactory::FunctionId operator()( PeripheralId peripheral_id );
};
template<const PeripheralFactory::FunctionId * table, std::size_t size,
PeripheralFactory::FunctionId unknow>
PeripheralFactory::FunctionId FunctionTable<table, size, unknow>::operator()( PeripheralId peripheral_id ) {
if( peripheral_id < size)
return table[peripheral_id];
else
return unknow;
}
}}
#endif /* SOURCE_APPLICATION_HARDWARE_FUNCTIONTABLE_HPP_ */