Project

General

Profile

Statistics
| Branch: | Revision:

root / src / envir / appreg.cc @ a3be1d55

History | View | Annotate | Download (1.13 KB)

1
//==========================================================================
2
//  APPREG.CC - part of
3
//                     OMNeT++/OMNEST
4
//            Discrete System Simulation in C++
5
//
6
//  Author: Andras Varga
7
//
8
//==========================================================================
9

    
10
/*--------------------------------------------------------------*
11
  Copyright (C) 1992-2008 Andras Varga
12
  Copyright (C) 2006-2008 OpenSim Ltd.
13

14
  This file is distributed WITHOUT ANY WARRANTY. See the file
15
  `license' for details on this and other legal matters.
16
*--------------------------------------------------------------*/
17

    
18
#include "appreg.h"
19

    
20
USING_NAMESPACE
21

    
22
cGlobalRegistrationList omnetapps("omnetapps");
23

    
24
cOmnetAppRegistration *cOmnetAppRegistration::chooseBest()
25
{
26
    // choose the one with highest score
27
    cOmnetAppRegistration *best = NULL;
28
    cRegistrationList *list = omnetapps.getInstance();
29
    for (int i=0; i<list->size(); i++)
30
    {
31
        cOmnetAppRegistration *appreg = static_cast<cOmnetAppRegistration *>(list->get(i));
32
        if (!best || appreg->getScore() > best->getScore())
33
            best = appreg;
34
    }
35
    return best;
36
}
37

    
38