Closed tclose closed 9 years ago
Just checked that this branch works with the Brunel Model. To do so I had to push some more changes to my code generation and pyNN branches
Also implemented __getitem__
for convenient access to members by name only (would not be recommended way to access them in production scripts but useful for prototyping and debugging)
This PR combines a few different enhancements that generally clean up the code and a few that are required to get my code generation code to work but which I thought would be nice to have upstream:
_aliases
,_parameters
,_on_events
, etc,OnCondition
)aliases
,parameters
,on_events
, and their keys,alias_names
,parameter_names
,on_event_port_names
alias('name')
,parameter('name')
,on_event('port_name')
, etc.class_to_member
dictionaries in each class that has child members, mapping the type of child element to the appropriate member dictionary. Using this I have written generic methodsadd
- add new child element to the appropriate dictionary (which is found by the type of the child element)remove
- removes a child element from the appropriate dictionary__contains__
- tests to see whether an element (or a name) is used within the child member container__iter__
- provides an iterator over all child elements (most visitors now use this iterator, which should make them easier to update)index_of
- generates and stores an index for a child member on demand. Useful for code generation where you would like to refer to an object via a unique index__copy__
->*ClonerVisitor
(although not sure whether__deepcopy__
is more appropriate)rename_symbol
->*RenameSymbol
required_for
->*RequiredDefinitions
. This is a new visitor I have created to determine which expressions (aliases, ports, etc) are required for any given expression. Particularly useful for code generation