Way to flag attribute as (non)serializable, read-only from python etc

Registered by Václav Šmilauer

YADE_CLASS_BASE_DOC_ATTRS(...) makes all attributes both serializable and read-write from python. There are ways around this -- |yreadonly| in docstring to make python attribute readon-only, separate .def_readwrite(...) to make it accessible from python but not serialized. It would be possible to add a 5th field to attribute definition (empty by default) containing OR'd flags (ATTR_NOSAVE|ATTR_READONLY for instance). Then docstring would not have to be searched for |yreadonly| and .def_readwrite hacks would disappear. Additional flags are envisageable, such as ATTR_FIXEDSIZE for sequences that should not change in length, for instance.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
Václav Šmilauer
Definition:
New
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Václav Šmilauer
Completed by
Václav Šmilauer

Related branches

Sprints

Whiteboard

(another flag could be used to make python access the attribute with accessors that would trigger postProcessAttributes after modification; the function would have to be a template, otherwise it would not be possible to do it via preprocessor exclusively since cpp cannot read flag value)

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.