diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-04-13 21:16:12 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-04-13 21:16:12 +0200 |
commit | eeb9927c89d6d2425a74c33ff8773bceba39af1c (patch) | |
tree | e5e770fc041fa27b6e13a78dc9c3dc3f75c7c213 /fevendoor.py | |
parent | 99561b834dbd9d52b83aa7b0fb980431fa1aa056 (diff) | |
download | pyevenja-eeb9927c89d6d2425a74c33ff8773bceba39af1c.zip pyevenja-eeb9927c89d6d2425a74c33ff8773bceba39af1c.tar.gz |
Diffstat (limited to 'fevendoor.py')
-rw-r--r-- | fevendoor.py | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/fevendoor.py b/fevendoor.py index a378844..2e4d8a5 100644 --- a/fevendoor.py +++ b/fevendoor.py @@ -27,7 +27,7 @@ description : evenDoor would convert a specific data format to the internal evenData format and the evenData format to the external data format. - + *@author Fabian Padilla */""" @@ -48,75 +48,75 @@ from evenjastrings import XML_LNKDEST from evenjastrings import TXT_NULL class FspecialDestination: - """ """ + """ """ - def __init__(self, linkTypesNames, valueA, linkFieldsNames, linkDest): - self.type = FstringHash() - self.value = FstringHash() - self.fields = FstringHash() - self.dest = FstringHash() + def __init__(self, linkTypesNames, valueA, linkFieldsNames, linkDest): + self.type = FstringHash() + self.value = FstringHash() + self.fields = FstringHash() + self.dest = FstringHash() - self.type.setString(linkTypesNames) - self.value.setString(valueA) - self.fields.setString(linkFieldsNames) - self.dest.setString(linkDest) + self.type.setString(linkTypesNames) + self.value.setString(valueA) + self.fields.setString(linkFieldsNames) + self.dest.setString(linkDest) class FevenDoor(FportBkpEvenData): - """ """ - def __init__(self): - FportBkpEvenData.__init__(self) # force constructor - self.list = Flist() #/** List of special destination */a - - def __del__(self): - """I believe this is for no use.""" - while self.list.getCount(): - self.list.remove(0) - - def __str__(self): - return "\t"+FportBkpEvenData.__str__(self)+\ - "FevenDoor - list : "+str(self.list)+"\n" - - def justDoItSys(self,evenData): - """/** Methods called by Fstarter. */""" - ret = RET_OK - if evenData.getCurrentDestination().getAction().equals(gvActionSysAddDest): - ret = self.list.add( FspecialDestination(evenData.getData(XML_LNKTYPE),\ - evenData.getData(XML_LNKVALUE),\ - evenData.getData(XML_LNKFIELDS),\ - evenData.getData(XML_LNKDEST))) - self.setFreeEvenData(evenData) - return ret - - def sendEvenData(self,evenData): - """/** Methods to enable all ports to sends evenDatas to a port. */""" - spDestToDo = None - if evenData.getCurrentDestination() != RET_NOTEXIST: - return FportBkpEvenData.sendEvenData(self,evenData) - for I in range(self.list.getCount()): - spDest = self.list.get(I) - spDestString = spDest.type.getString() - if spDestString != TXT_NULL: # if we got a destination - evenData.setLinkFieldsNames(spDestString) - if spDestString == TXT_NULL or evenData.equals(spDest.value): - if spDestToDo <> None: - evenDataToDo = getFreeEvenData() - evenDataToDo = copyFrom(evenData) - evenDataToDo.setSource(self.getString()) - evenDataToDo.setLinkFieldsNames(spDestToDo.fields.getString()) - evenDataToDo.resetDestination() - evenDataToDo.addDestinatio(spDestToDo.dest.getString()) - FportBkpEvenData.sendEvenData(self,evenDataToDo) - spDestToDo = spDest - if spDestToDo: # something to send - evenData.setSource(self.getString()) - evenData.setLinkFieldsNames(spDestToDo.fields.getString()) - evenData.resetDestination() - evenData.addDestination(spDestToDo.dest.getString()) - FportBkpEvenData.sendEvenData(self,evenData) - else: - self.parent.setFreeEvenData(evenData) - - def getFreeEvenData(self): - """/** Get a new evenData. */""" - return self.parent.getFreeEvenData() + """ """ + def __init__(self): + FportBkpEvenData.__init__(self) # force constructor + self.list = Flist() #/** List of special destination */a + + def __del__(self): + """I believe this is for no use.""" + while self.list.getCount(): + self.list.remove(0) + + def __str__(self): + return "\t"+FportBkpEvenData.__str__(self)+\ + "FevenDoor - list : "+str(self.list)+"\n" + + def justDoItSys(self,evenData): + """/** Methods called by Fstarter. */""" + ret = RET_OK + if evenData.getCurrentDestination().getAction().equals(gvActionSysAddDest): + ret = self.list.add( FspecialDestination(evenData.getData(XML_LNKTYPE),\ + evenData.getData(XML_LNKVALUE),\ + evenData.getData(XML_LNKFIELDS),\ + evenData.getData(XML_LNKDEST))) + self.setFreeEvenData(evenData) + return ret + + def sendEvenData(self,evenData): + """/** Methods to enable all ports to sends evenDatas to a port. */""" + spDestToDo = None + if evenData.getCurrentDestination() != RET_NOTEXIST: + return FportBkpEvenData.sendEvenData(self,evenData) + for I in range(self.list.getCount()): + spDest = self.list.get(I) + spDestString = spDest.type.getString() + if spDestString != TXT_NULL: # if we got a destination + evenData.setLinkFieldsNames(spDestString) + if spDestString == TXT_NULL or evenData.equals(spDest.value): + if spDestToDo <> None: + evenDataToDo = getFreeEvenData() + evenDataToDo = copyFrom(evenData) + evenDataToDo.setSource(self.getString()) + evenDataToDo.setLinkFieldsNames(spDestToDo.fields.getString()) + evenDataToDo.resetDestination() + evenDataToDo.addDestinatio(spDestToDo.dest.getString()) + FportBkpEvenData.sendEvenData(self,evenDataToDo) + spDestToDo = spDest + if spDestToDo: # something to send + evenData.setSource(self.getString()) + evenData.setLinkFieldsNames(spDestToDo.fields.getString()) + evenData.resetDestination() + evenData.addDestination(spDestToDo.dest.getString()) + FportBkpEvenData.sendEvenData(self,evenData) + else: + self.parent.setFreeEvenData(evenData) + + def getFreeEvenData(self): + """/** Get a new evenData. */""" + return self.parent.getFreeEvenData() |