Added TailProduce static code and macros for streams definition.

You have a Stream *.  Who owns that Pointer?  Wouldn't it be better to use a std::shared_ptr<Stream>?