@@ -86,7 +86,7 @@ def __init__(self):
8686 self .obj .oms_getVersion .restype = ctypes .c_char_p
8787 self .obj .oms_importFile .argtypes = [ctypes .c_char_p , ctypes .POINTER (ctypes .c_char_p )]
8888 self .obj .oms_importFile .restype = ctypes .c_int
89- self .obj .oms_importSnapshot .argtypes = [ctypes .c_char_p , ctypes .c_char_p ]
89+ self .obj .oms_importSnapshot .argtypes = [ctypes .c_char_p , ctypes .c_char_p , ctypes . POINTER ( ctypes . c_char_p ) ]
9090 self .obj .oms_importSnapshot .restype = ctypes .c_int
9191 self .obj .oms_initialize .argtypes = [ctypes .c_char_p ]
9292 self .obj .oms_initialize .restype = ctypes .c_int
@@ -199,7 +199,7 @@ def exportDependencyGraphs(self, cref, initialization, event, simulation):
199199 def exportSnapshot (self , ident ):
200200 contents = ctypes .c_char_p ()
201201 status = self .obj .oms_exportSnapshot (ident .encode (), ctypes .byref (contents ))
202- return [contents .value .decode ('utf-8' ), status ]
202+ return [contents .value .decode ('utf-8' ) if contents . value else None , status ]
203203 def exportSSMTemplate (self , ident , filename ):
204204 return self .obj .oms_exportSSMTemplate (ident .encode (), filename .encode ())
205205 def exportSSVTemplate (self , ident , filename ):
@@ -226,7 +226,7 @@ def getResultFile(self, cref):
226226 filename = ctypes .c_char_p ()
227227 bufferSize = ctypes .c_int ()
228228 status = self .obj .oms_getResultFile (cref .encode (), ctypes .byref (filename ), ctypes .byref (bufferSize ))
229- return [filename .value .decode ('utf-8' ), bufferSize .value , status ]
229+ return [filename .value .decode ('utf-8' ) if filename . value else None , bufferSize .value , status ]
230230 def getSolver (self , cref ):
231231 value = ctypes .c_int ()
232232 status = self .obj .oms_getSolver (cref .encode (), ctypes .byref (value ))
@@ -258,26 +258,27 @@ def getVersion(self):
258258 def importFile (self , filename ):
259259 cref = ctypes .c_char_p ()
260260 status = self .obj .oms_importFile (filename .encode (), ctypes .byref (cref ))
261- return [cref .value .decode (" utf-8" ) , status ]
261+ return [cref .value .decode (' utf-8' ) if cref . value else None , status ]
262262 def importSnapshot (self , ident , snapshot ):
263- status = self .obj .oms_importSnapshot (ident .encode (), snapshot .encode ())
264- return status
263+ newCref = ctypes .c_char_p ()
264+ status = self .obj .oms_importSnapshot (ident .encode (), snapshot .encode (), ctypes .byref (newCref ))
265+ return [newCref .value .decode ('utf-8' ) if newCref .value else None , status ]
265266 def initialize (self , cref ):
266267 return self .obj .oms_initialize (cref .encode ())
267268 def instantiate (self , cref ):
268269 return self .obj .oms_instantiate (cref .encode ())
269270 def list (self , ident ):
270271 contents = ctypes .c_char_p ()
271272 status = self .obj .oms_list (ident .encode (), ctypes .byref (contents ))
272- return [contents .value .decode ('utf-8' ), status ]
273+ return [contents .value .decode ('utf-8' ) if contents . value else None , status ]
273274 def listUnconnectedConnectors (self , ident ):
274275 contents = ctypes .c_char_p ()
275276 status = self .obj .oms_listUnconnectedConnectors (ident .encode (), ctypes .byref (contents ))
276- return [contents .value .decode ('utf-8' ), status ]
277+ return [contents .value .decode ('utf-8' ) if contents . value else None , status ]
277278 def loadSnapshot (self , ident , snapshot ):
278279 newCref = ctypes .c_char_p ()
279280 status = self .obj .oms_loadSnapshot (ident .encode (), snapshot .encode (), ctypes .byref (newCref ))
280- return [newCref .value .decode (" utf-8" ) , status ]
281+ return [newCref .value .decode (' utf-8' ) if newCref . value else None , status ]
281282 def newModel (self , cref ):
282283 return self .obj .oms_newModel (cref .encode ())
283284 def removeSignalsFromResults (self , cref , regex ):
0 commit comments