Switch to side-by-side view

--- a/src/DIF/FA/FAITable.cc
+++ b/src/DIF/FA/FAITable.cc
@@ -15,10 +15,16 @@
 
 #include "FAITable.h"
 
+//Statistic collextion
+const char* SIG_STAT_FT_SIZE             = "FT_FlowTableSize";
+
 Define_Module(FAITable);
 
 void FAITable::initialize()
 {
+    //Inits
+    initSignalsAndListeners();
+    //Watchers
     WATCH_LIST(FaiTable);
 }
 
@@ -80,6 +86,15 @@
     return NULL;
 }
 
+FAITableEntry* FAITable::findEntryByInvokeId(long invId) {
+    for(TFTIter it = FaiTable.begin(); it != FaiTable.end(); ++it) {
+        FAITableEntry tft = *it;
+        if (tft.getCFlow()->getAllocInvokeId() == invId)
+            return &(*it);
+    }
+    return NULL;
+}
+
 void FAITable::handleMessage(cMessage *msg)
 {
 
@@ -87,6 +102,9 @@
 
 void FAITable::insertNew(Flow* flow) {
     this->insert(FAITableEntry(flow));
+    updateDisplayString();
+    EV << "FT emits signal " << (long)FaiTable.size() << endl;
+    emit(sigStatFTSize, (long)FaiTable.size());
 }
 
 void FAITable::insert(const FAITableEntry& entry) {
@@ -119,7 +137,7 @@
     return NULL;
 }
 
-void FAITable::changeAllocStatus(Flow* flow, FAITableEntry::AllocateStatus status) {
+void FAITable::changeAllocStatus(Flow* flow, FAITableEntry::EAllocateStatus status) {
     FAITableEntry* fte = findEntryByFlow(flow);
     if (fte) {
         fte->setAllocateStatus(status);
@@ -128,7 +146,7 @@
         EV << "findByFlow() returned NULL" << endl;
 }
 
-void FAITable::changeAllocStatus(FAIBase* fai, FAITableEntry::AllocateStatus status) {
+void FAITable::changeAllocStatus(FAIBase* fai, FAITableEntry::EAllocateStatus status) {
     FAITableEntry* fte = findEntryByFai(fai);
     if (fte)
         fte->setAllocateStatus(status);
@@ -141,3 +159,15 @@
     fte->setFai(fai);
 }
 
+void FAITable::updateDisplayString() {
+    // display number of flows
+    cDisplayString& disp = getDisplayString();
+    disp.setTagArg("t", 1, "t");
+    std::ostringstream os;
+    os << "records: " << FaiTable.size();
+    disp.setTagArg("t", 0, os.str().c_str());
+}
+
+void FAITable::initSignalsAndListeners() {
+    sigStatFTSize = registerSignal(SIG_STAT_FT_SIZE);
+}