{"action":"created","issue":{"url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/4672","repository_url":"https://api.github.com/repos/ArduPilot/ardupilot","labels_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/4672/labels{/name}","comments_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/4672/comments","events_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/4672/events","html_url":"https://github.com/ArduPilot/ardupilot/pull/4672","id":171407027,"number":4672,"title":"A neater method of constructing Backends","user":{"login":"kwikius","id":3257079,"avatar_url":"https://avatars.githubusercontent.com/u/3257079?v=3","gravatar_id":"","url":"https://api.github.com/users/kwikius","html_url":"https://github.com/kwikius","followers_url":"https://api.github.com/users/kwikius/followers","following_url":"https://api.github.com/users/kwikius/following{/other_user}","gists_url":"https://api.github.com/users/kwikius/gists{/gist_id}","starred_url":"https://api.github.com/users/kwikius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwikius/subscriptions","organizations_url":"https://api.github.com/users/kwikius/orgs","repos_url":"https://api.github.com/users/kwikius/repos","events_url":"https://api.github.com/users/kwikius/events{/privacy}","received_events_url":"https://api.github.com/users/kwikius/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ArduPilot/ardupilot/labels/AllVehicles","name":"AllVehicles","color":"bfd4f2"},{"url":"https://api.github.com/repos/ArduPilot/ardupilot/labels/Driver","name":"Driver","color":"006b75"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-08-16T13:22:02Z","updated_at":"2016-08-17T02:20:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/4672","html_url":"https://github.com/ArduPilot/ardupilot/pull/4672","diff_url":"https://github.com/ArduPilot/ardupilot/pull/4672.diff","patch_url":"https://github.com/ArduPilot/ardupilot/pull/4672.patch"},"body":"A neater method of constructing sensor Backends.\r\n\r\nI chose the AP_Baro as an example sensor, but the same applies to many other sensors\r\n\r\nIn this version a template function is declared in AP_Baro.h \r\n\r\ntemplate \\<uint32_t BackendID\\>\r\nAP_Baro_Backend* create_default_baro_backend(AP_Baro& baro);\r\n\r\nNote there is no default function definition. It is up to each Backend to create a specialisation of the function.\r\nThe  BackendID is the value of the HAL_BARO_DEFAULT macro.\r\n\r\nThe resulting code reduction can be seen in the void AP_Baro::init(void) function in AP_Baro.cpp, which is now much cleaner and easier to read.\r\n\r\nA more advanced version would use class tags and typedefs to provide the same functionality without the need for macros."},"comment":{"url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/comments/240295898","html_url":"https://github.com/ArduPilot/ardupilot/pull/4672#issuecomment-240295898","issue_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/4672","id":240295898,"user":{"login":"magicrub","id":4782875,"avatar_url":"https://avatars.githubusercontent.com/u/4782875?v=3","gravatar_id":"","url":"https://api.github.com/users/magicrub","html_url":"https://github.com/magicrub","followers_url":"https://api.github.com/users/magicrub/followers","following_url":"https://api.github.com/users/magicrub/following{/other_user}","gists_url":"https://api.github.com/users/magicrub/gists{/gist_id}","starred_url":"https://api.github.com/users/magicrub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magicrub/subscriptions","organizations_url":"https://api.github.com/users/magicrub/orgs","repos_url":"https://api.github.com/users/magicrub/repos","events_url":"https://api.github.com/users/magicrub/events{/privacy}","received_events_url":"https://api.github.com/users/magicrub/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T02:20:13Z","updated_at":"2016-08-17T02:20:13Z","body":"Also, if we let this in are you willing to port the changes to the other libraries too.. soon?"}}
{"actor":{"display_login":"magicrub"}}