MCPcopy Create free account
hub / github.com/EdwardLiuyc/StaticMapping / SetValue

Method SetValue

pre_processors/xml_interface.h:55–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54 template <typename T>
55 bool SetValue(const std::string& name, const T& value) {
56 if (name_to_param_.count(name) == 0) {
57 return false;
58 }
59
60 auto& param_item = name_to_param_[name];
61 switch (param_item.type) {
62 case kInt32Param:
63 *(reinterpret_cast<int32_t*>(param_item.target)) =
64 static_cast<int32_t>(value);
65 break;
66 case kFloatParam:
67 *(reinterpret_cast<float*>(param_item.target)) =
68 static_cast<float>(value);
69 break;
70 default:
71 return false;
72 }
73
74 return true;
75 }
76
77 virtual void DisplayAllParams() {}
78

Callers 2

InitFromXmlNodeMethod · 0.80
ConnectAllSubmapMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected