Private attributes in a CTModule

I am trying to add a private attribute to a CTModule, to be saved to disk, but I think it's being stripped out. Using the provided example code, I constructed a valid CTModule object ("ct"), and used the code at the bottom of this post to test the insertion. I have verified the attribute gets added to the AttributeManager, and I can set the attributes of the CTModule using this AttributeManager, but when I subsequently query the CTModule for attributes at the end, my custom attribute is missing. Is this intended?     // Construct a valid CTModule object (not shown)    SDICOS::Tag tag;    tag.Set(0x0909, 0x0909);    SDICOS::AttributeManager manager;    SDICOS::ErrorLog errorlog;    ct.GetAttributesAndValidate(manager, errorlog);    SDICOS::AttributeManager::AttributePointer<SDICOS::AttributeString> attptr1;        manager.FindAttribute(tag, attptr1, true);    attptr1->SetSize(1, SDICOS::AttributeString::enumLongString);    (*attptr1)[0] = "ASDASD";        SDICOS::AttributeManager manager2;    SDICOS::AttributeManager::AttributePointer<SDICOS::AttributeString> attrptr2;    ct.GetAttributesAndValidate(manager2, errorlog);    bool found = manager2.FindAttribute(tag, attrptr2);        std::cout << "Was value found?: " << found << std::endl;  // Always displays 0    std::cout << "Value: " << (*attrptr2)[0] << std::endl;  // Segfaults because attribute is not found 


(Reposting the code portion to see if the formatting can be fixed) // Construct a valid CTModule object (not shown) SDICOS::Tag tag; tag.Set(0x0909, 0x0909); SDICOS::AttributeManager manager; SDICOS::ErrorLog errorlog; ct.GetAttributesAndValidate(manager, errorlog); SDICOS::AttributeManager::AttributePointer attptr1; manager.FindAttribute(tag, attptr1, true); attptr1->SetSize(1, SDICOS::AttributeString::enumLongString); (*attptr1)[0] = "ASDASD"; SDICOS::AttributeManager manager2; SDICOS::AttributeManager::AttributePointer attrptr2; ct.GetAttributesAndValidate(manager2, errorlog); bool found = manager2.FindAttribute(tag, attrptr2); std::cout << "Was value found?: " << found << std::endl; // Always displays 0 std::cout << "Value: " << (*attrptr2)[0] << std::endl; // Segfaults because attribute is not found
The attribute manager returned by CTModule::GetAttributesAndValidate() is not a reference to an internal member variable, it is strictly a copy of the attributes stored within the CTModule.  The call to GetAttributesAndValidate() clears the passed in attribute manager of any data before copying the CTModule's data. Adding or removing attributes from this attribute manager will not add or remove them from the CTModule.Private tags are only supported by the attribute manager.  To add private tags when using CTModule, retrieve the attribute manager from the GetAttributesAndValidate(), then add the custom attribute, which is what you already did.  The custom attribute will only exist in that attribute manager.