from_json() for attribute items

@Haocheng_Liu I’m writing from_json() and to_json() methods for a new subclass of smtk::attribute::Item (ReferenceItem which holds references to smtk::resource::PersistentObject) and want to understand why the signature for from_json is

from_json(
  const json& j,
  smtk::attribute::ReferenceItemPtr& itemPtr,
  smtk::attribute::CollectionPtr colPtr)

Why do we need to pass in colPtr? We should be able to obtain it by calling itemPtr->attribute()->collection(), since the item must already have been created before calling from_json(). Right?

Yep. You are right. It’s unncessary.

Good to know I’m not losing my marbles. I’ll either change the signature or create an issue.

1 Like

For posterity, I change the signature here:
https://gitlab.kitware.com/cmb/smtk/merge_requests/1096