bakaid commented on issue #515: MINIFICPP-646 - Re-evaluate passing attributes. 
Potentially deprecate…
URL: https://github.com/apache/nifi-minifi-cpp/pull/515#issuecomment-504003243
 
 
   @arpadboda 
   
   I agree that attributes should be owned by the flowfile structure, otherwise 
it would be very error-prone to handle lifetimes. It is more than worth the 
small overhead.
   Because of this, we must provide setters.
   With getters we have a choice: either we can make the internal storage of 
the attributes part of the API, and we don't have to provide getters, or we 
make the attribute structure opaque and provide getters for the attributes 
(which can either copy the values, or return a const pointer to them, with the 
proper lifetime warning part of the specification of the getter).
   This choice does not influence how we store the attributes, but it 
influences whether we can change how we store them without breaking the API.
   From a setter standpoint I see the merits of having a buffer + size setter 
along with the C string setter.
   From a getter standpoint I think it is easier to use the API if it returns a 
C string.
   Therefore my preference would be to:
    - make the structure opaque
    - create getters
    - make getters return a C string
    - because we can now modify the internal struct it does not really matter 
how we store the data internally, but because we are returning a C string in 
the getter, if there are no other considerations it would be worth storing it 
that way for the time being.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to