From 6b23c5402ae7520ffead6156991362676c40ae9d Mon Sep 17 00:00:00 2001
From: Mansard <nmansard@laas.fr>
Date: Thu, 8 Sep 2011 10:45:07 +0200
Subject: [PATCH] Added the global "ping" function.

---
 python/attime.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/python/attime.py b/python/attime.py
index 2f900ff..6ed7e19 100644
--- a/python/attime.py
+++ b/python/attime.py
@@ -1,5 +1,7 @@
 class Calendar:
-    events=dict()
+    def __init__(self):
+        self.events=dict()
+        self.ping = list()
     def __repr__(self):
         res=''
 #        for iter in sort(self.events.keys()):
@@ -30,9 +32,12 @@ class Calendar:
                         self.registerEvent(iter, (fun.functor,fun.functor.__doc__) )
                     else:
                         self.registerEvent(iter, (fun,fun.__doc__) )
-
+    def addPing(self,f): self.ping.append(f)
+    def callPing(self):
+        for f in self.ping: f()
     def run(self,iter,*args):
         if iter in self.events.keys():
+            self.callPing()
             for fun,doc in self.events[iter]:
                 intro = "At time "+str(iter)+": "
                 if doc!=None:               print intro, doc
-- 
GitLab