Definition at line 200 of file root_pickle.py.
◆ __init__()
| python.root_pickle.Pickler.__init__ |
( |
| self, |
|
|
| file, |
|
|
| proto = 0 ) |
Create a root pickler.
FILE should be a Root TFile. PROTO is the python pickle protocol
version to use. The python part will be pickled to a Root
TObjString called _pickle; it will contain references to the
Root objects.
Definition at line 201 of file root_pickle.py.
201 def __init__ (self, file, proto=0):
202 """Create a root pickler.
203FILE should be a Root TFile. PROTO is the python pickle protocol
204version to use. The python part will be pickled to a Root
205TObjString called _pickle; it will contain references to the
206Root objects.
207"""
208 self.__file = file
209 self.__keys = file.GetListOfKeys()
210 self.__io = Write_Wrapper()
211 self.__pickle = pickle.Pickler (self.__io, proto)
212 self.__pickle.persistent_id = self._persistent_id
213 self.__pmap = {}
214 return
215
216
◆ _persistent_id()
| python.root_pickle.Pickler._persistent_id |
( |
| self, |
|
|
| o ) |
|
protected |
Definition at line 242 of file root_pickle.py.
242 def _persistent_id (self, o):
243 if hasattr (o, '_Root_Proxy__obj'):
244 o = o._Root_Proxy__obj()
245 if (isinstance (o, ROOT.TObject)):
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264 nm = o.GetName()
265 k = self.__keys.FindObject(nm)
266 o.Write()
267 if k:
268 k = self.__file.GetKey (nm)
269 pid = "%s;%d" % (nm, k.GetCycle())
270 else:
271 pid = nm + ";1"
272 return pid
273 return
274
275
276
◆ clear_memo()
| python.root_pickle.Pickler.clear_memo |
( |
| self | ) |
|
Clears the pickler's internal memo.
Definition at line 235 of file root_pickle.py.
235 def clear_memo (self):
236 """Clears the pickler's internal memo."""
237 self.__pickle.memo.clear()
238 return
239
240
241
◆ dump()
| python.root_pickle.Pickler.dump |
( |
| self, |
|
|
| o, |
|
|
| key = None ) |
Write a pickled representation of o to the open TFile.
Definition at line 217 of file root_pickle.py.
217 def dump (self, o, key=None):
218 """Write a pickled representation of o to the open TFile."""
219 if key is None:
220 key = '_pickle'
221 directory = _getdir()
222 try:
223 self.__file.cd()
224 self.__pickle.dump (o)
225 s = self.__io.getvalue()
226 self.__io.reopen()
227 s.Write (key)
228 self.__file.Flush()
230 finally:
231 _setdir (directory)
232 return
233
234
void clear()
Empty the pool.
◆ __file
| python.root_pickle.Pickler.__file = file |
|
private |
◆ __io
◆ __keys
| python.root_pickle.Pickler.__keys = file.GetListOfKeys() |
|
private |
◆ __pickle
| python.root_pickle.Pickler.__pickle = pickle.Pickler (self.__io, proto) |
|
private |
◆ __pmap
| dict python.root_pickle.Pickler.__pmap = {} |
|
private |
The documentation for this class was generated from the following file: