1 #ifndef ORG_EEROS_HAL_HAL_HPP_ 2 #define ORG_EEROS_HAL_HAL_HPP_ 6 #include <unordered_set> 37 template<
typename ... ArgTypesOut>
40 void (*featureFunction)(
OutputInterface*, ArgTypesOut...) =
reinterpret_cast<void(*)(
OutputInterface*, ArgTypesOut...)
>(getOutputFeature(obj, featureName));
41 if(featureFunction ==
nullptr){
42 throw Fault(
"could not find method in dynamic library: " + featureName);
44 featureFunction(obj, args...);
47 template<
typename ... ArgTypesIn>
50 void (*featureFunction)(
InputInterface*, ArgTypesIn...) =
reinterpret_cast<void(*)(
InputInterface*, ArgTypesIn...)
>(getInputFeature(obj, featureName));
51 if(featureFunction ==
nullptr){
52 throw Fault(
"could not find method in dynamic library: " + featureName);
54 featureFunction(obj, args...);
60 HAL& operator=(
const HAL&);
62 bool loadModule(std::string moduleName);
64 void* getOutputFeature(std::string name, std::string featureName);
66 void* getInputFeature(std::string name, std::string featureName);
67 void* getInputFeature(
InputInterface * obj, std::string featureName);
69 std::unordered_set<OutputInterface*> exclusiveReservedOutputs;
70 std::unordered_set<OutputInterface*> nonExclusiveOutputs;
71 std::unordered_set<InputInterface*> exclusiveReservedInputs;
72 std::unordered_set<InputInterface*> nonExclusiveInputs;
74 std::map<std::string, InputInterface*> inputs;
75 std::map<std::string, OutputInterface*> outputs;
77 std::map<std::string, void*> hwLibraries;
Definition: JsonParser.hpp:9
OutputInterface * getOutput(std::string name, bool exclusive=true)
Definition: HAL.cpp:143
InputInterface * getInput(std::string name, bool exclusive=true)
Definition: HAL.cpp:194
Definition: Logger.hpp:15
Definition: Output.hpp:10
ScalableOutput< double > * getScalableOutput(std::string name, bool exclusive=true)
Definition: HAL.cpp:176
Input< bool > * getLogicInput(std::string name, bool exclusive=true)
Definition: HAL.cpp:209
bool addOutput(OutputInterface *systemOutput)
Definition: HAL.cpp:96
Definition: Config.hpp:14
Output< bool > * getLogicOutput(std::string name, bool exclusive=true)
Definition: HAL.cpp:158
ScalableInput< double > * getScalableInput(std::string name, bool exclusive=true)
Definition: HAL.cpp:227
void callInputFeature(InputInterface *obj, std::string featureName, ArgTypesIn...args)
Definition: HAL.hpp:48
static HAL & instance()
Definition: HAL.cpp:13
void callOutputFeature(OutputInterface *obj, std::string featureName, ArgTypesOut...args)
Definition: HAL.hpp:38
bool readConfigFromFile(std::string file)
Definition: HAL.cpp:18
Definition: ScalableOutput.hpp:11
bool addInput(InputInterface *systemInput)
Definition: HAL.cpp:86
void releaseInput(std::string name)
Definition: HAL.cpp:107
void releaseOutput(std::string name)
Definition: HAL.cpp:125