Bournemouth have agreed a four-year contract with Dan Gosling after the midfielder was not offered a new deal by Newcastle United.