Skip to content
Advertisement

FilterStore queue

I have a FilterStore and during my simulation there is a queue for the FilterStore.Get event at some times. Now I have two questions:

  1. Is there a way to see the actual elements in the queue, not just the object number? With FilterStore.get_queue I get this output: [FilterStoreGet() object at 0x221a47c6080, FilterStoreGet() object at 0x221a47c6eb8]. But I would like a list with the actual names, for example [1,2,3].

  2. Is there a way to manipulate the queue? I know the elements in the queue are beeing processed with FIFO, but I would like to do LIFO or SIRO.

Advertisement

Answer

I got an answer to my question on another forum. I will post it here too, because I’m sure someone else will eventually have the same problem.

So it is not possible to manipulate the FilterStore.get_queue directly, but by writing a subclass of the Store, you get a queue that behaves differently (LIFO for example).

class PrependList(list):
def append(self, item):
    self.insert(0, item)

class LCFSStore(Store):
    put = BoundClass(StorePut)
    get = BoundClass(FilterStoreGet) 
    GetQueue = PrependList

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement