A Stochastic Model Of Macroscopic Traffic Flow: Theoretical Foundations