Thermodynamical theory of elasticity and plasticity