示例#1
0
文件: persist.py 项目: jbalint/spark
 def writePersistInfo():
     # write out non-object predicates
     writePredicates(agent, predicates, predOutput, errOutput)
     # Write out information about all objects that need to be persisted.
     for iefact in PERSIST_ID_SAVE.nextIdIEFacts():
         writeIEFact(agent, P_ObjectNextId, iefact, objOutput)
     for iefact in PERSIST_ID_SAVE.existsIEFacts():
         writeIEFact(agent, P_ObjectExists, iefact, objOutput)
     for iefact in PERSIST_ID_SAVE.stateIEFacts():
         writeIEFact(agent, P_ObjectState, iefact, objOutput)
示例#2
0
文件: persist.py 项目: jbalint/spark
 def writePersistInfo():
     # write out non-object predicates
     writePredicates(agent, predicates, predOutput, errOutput)
     # Write out information about all objects that need to be persisted.
     for iefact in PERSIST_ID_SAVE.nextIdIEFacts():
         writeIEFact(agent, P_ObjectNextId, iefact, objOutput)
     for iefact in PERSIST_ID_SAVE.existsIEFacts():
         writeIEFact(agent, P_ObjectExists, iefact, objOutput)
     for iefact in PERSIST_ID_SAVE.stateIEFacts():
         writeIEFact(agent, P_ObjectState, iefact, objOutput)
示例#3
0
文件: persist.py 项目: jbalint/spark
def withPersistIdSaveCall(function):
    old_id_save = None
    try:
        # keep track of all objects used from here on
        old_id_save = set_id_save(PERSIST_ID_SAVE)
        if (old_id_save != STANDARD_ID_SAVE):            raise AssertionError, \
"Overlapping calls to persist"
        PERSIST_ID_SAVE.clear()
        function()
    finally:
        if old_id_save is not None:
            newer_id_save = set_id_save(old_id_save)
            if (newer_id_save != PERSIST_ID_SAVE):                raise AssertionError, \
"Something has changed ID_SAVE"
        PERSIST_ID_SAVE.clear()
示例#4
0
文件: persist.py 项目: jbalint/spark
def withPersistIdSaveCall(function):
    old_id_save = None
    try:
        # keep track of all objects used from here on
        old_id_save = set_id_save(PERSIST_ID_SAVE)
        if (old_id_save != STANDARD_ID_SAVE): raise AssertionError, \
           "Overlapping calls to persist"
        PERSIST_ID_SAVE.clear()
        function()
    finally:
        if old_id_save is not None:
            newer_id_save = set_id_save(old_id_save)
            if (newer_id_save != PERSIST_ID_SAVE): raise AssertionError, \
                   "Something has changed ID_SAVE"
        PERSIST_ID_SAVE.clear()
示例#5
0
文件: persist.py 项目: jbalint/spark
 def persistSPULoadInfo():
     # write added facts of the file
     for fact in asserted:
         functor = fact.functor
         if functor in SPU_LOAD_INFO_PREDICATES:
             iefactlist.append(ieFact(agent, functor, fact))
     # assert LoadedFileObjects
     objects = List(PERSIST_ID_SAVE.recordedObjects())
     lfofact = (spu.filename, spu.index, objects)
     agent.addfact(P_LoadedFileObjects, lfofact)
示例#6
0
文件: persist.py 项目: jbalint/spark
 def persistSPULoadInfo():
     # write added facts of the file
     for fact in asserted:
         functor = fact.functor
         if functor in SPU_LOAD_INFO_PREDICATES:
             iefactlist.append(ieFact(agent, functor, fact))
     # assert LoadedFileObjects
     objects = List(PERSIST_ID_SAVE.recordedObjects())
     lfofact = (spu.filename, spu.index, objects)
     agent.addfact(P_LoadedFileObjects, lfofact)