Tie-rod hydraulic cylinder with built-in magnetostrictive encoder