-

Revision:
4:c15c22484205
Parent:
2:f02ac448ecd3
Child:
5:bb12605080d5
--- a/Counter.cpp	Mon Nov 12 19:08:35 2018 +0000
+++ b/Counter.cpp	Fri Nov 16 14:51:40 2018 +0000
@@ -12,8 +12,7 @@
 #ifdef COUNTER_DEBUG
     debug_out.printf("Constructing Object...\r\n");
 #endif
-    for(int i=0; i<MAX_LEN; i++)
-        count[i] = 0;
+    memset(&counter, 0, MAX_LEN);
     this->init();
 }
 
@@ -77,4 +76,21 @@
 #endif
     count[party_id]++;
     memwrite();
+}
+
+void Counter::decrement(int party_id)
+{
+#ifdef COUNTER_DEBUG
+    debug_out.printf("Decrementing %d\r\n", party_id);
+#endif
+    count[party_id]--;
+    memwrite();
+}
+
+void Counter::clear(){
+    #ifdef COUNTER_DEBUG
+        debug_out.printf("Clearing stored values\r\n");
+    #endif
+    memset(&counter, 0, MAX_LEN);
+    memwrite();
 }
\ No newline at end of file