PdxReader advances the cursor of the internal buffer on each call. If we consider that each call moves the cursor to the requested field position we could make the cursor mutable but we also need to specify that all accessor fields are const as well. If we do this then I could support the approach. The use of PdxReader in this way, while const, is not thread safe because the object member variable is mutated on each call non-atomically.
-Jake On Fri, Sep 15, 2017 at 10:53 AM Mark Hanson <mhan...@pivotal.io> wrote: > Readers do in fact hold state, but they do not appear to modify the state > during normal reads. I could be wrong on that, but that is what I just read. > > Thanks, > Mark > > On Sep 15, 2017, at 10:51 AM, Jacob Barrett <jbarr...@pivotal.io> wrote: > > > > -1 > > > > PdxReader holds state. All calls to read the state on PdxReader also > result > > in a change in that state. > > > > On Fri, Sep 15, 2017 at 10:40 AM Mark Hanson <mhan...@pivotal.io> wrote: > > > >> Note the const on PdxReaderPtr virtual void fromData(const PdxReaderPtr > >> input); > >> > >> Hi All, > >> > >> So there is a question outstanding about whether or not we want to add > >> const to PdxReaderPtr for fromData calls. It seems reasonable and > plausible. > >> > >> Proposal: Change to virtual void fromData(const PdxReaderPtr input) from > >> virtual void fromData(PdxReaderPtr input) > >> > >> Get your +1’s and -1’s in to vote. > >> > >> Thanks, > >> Mark > >