Default [Q] Samsung OS upgrade policy

As a general question on the availability and delay of Samsung upgrades; how good is Samsung in making the latest Android OS available to legacy devices? Do they support one, two or more generations? I know that there are sometime HW constraints that prevents the owner from upgrading, but suppose that the HW supports the latest OS version?

The reason for asking is that I currently have Apple and I might consider getting an S5 but at least in regards to OS upgrades, i am a little spoiled as Apple makes the latest OS available to all devices.