2424logger = getLogger (__name__ )
2525
2626
27- class LocalNode (Node ):
27+ class LocalNode (Node , MemoryManager ):
2828 """A Node with its own virtual memory
2929 (emulate memory spaces such as for creating a virtual
3030 signal node with settings)"""
3131 def __init__ (self , id : NodeID , snip : SNIP , pipSet : set ,
3232 linkLayer : CanLink ):
3333 Node .__init__ (self , id , snip , pipSet )
34+ MemoryManager .__init__ (self )
3435 self .cdi = None # type: XMLDataProcessor|None
3536 self ._replicated_cdi_tree = None # type: CDIMemo|None
3637 if PIP .CONFIGURATION_DESCRIPTION_INFORMATION in pipSet :
@@ -44,7 +45,6 @@ def __init__(self, id: NodeID, snip: SNIP, pipSet: set,
4445 self .localNodeProcessor = LocalNodeProcessor (linkLayer , self )
4546 linkLayer .registerMessageReceivedListener (
4647 self .localNodeProcessor .process )
47- self .memory = MemoryManager ()
4848
4949 def loadCDIFile (self , path , memo = None ):
5050 """Load a CDI file to generate virtual memory spaces
@@ -107,7 +107,7 @@ def setMemory(self, memo: CDIMemo, var: CDIVar):
107107 assert var is not None
108108 assert var .data is not None
109109 assert len (var .data ) == memo .getSize ()
110- self .memory . set (memo .space , memo .address , var .data )
110+ self .set (memo .space , memo .address , var .data )
111111 print (f"Set LocalNode { self .id } space { memo .space } "
112112 f" address { memo .space } (length { len (var .data )} )." )
113113
@@ -177,7 +177,7 @@ def _reserveSpaces(self, parent: Union[CDIMemo, None] = None, level=0):
177177 logger .warning (
178178 f"Creating cdiBackupDir { self .cdiBackupDir } " )
179179 os .makedirs (self .cdiBackupDir )
180- for space , data in self .memory . spaces .items ():
180+ for space , data in self .spaces .items ():
181181 name = f"{ self .id } .lcc-link-virtual-node.space={ space } .xml"
182182 path = os .path .join (self .cdiBackupDir , name )
183183 with open (path , "wb" ) as stream :
0 commit comments