Functions

Utils.h File Reference

#include <vector>
#include <omnetpp.h>
#include "IntServ.h"

Go to the source code of this file.

Functions

void removeDuplicates (std::vector< int > &vec)
bool find (std::vector< int > &vec, int value)
bool find (const IPAddressVector &vec, IPAddress addr)
void append (std::vector< int > &dest, const std::vector< int > &src)
int find (const EroVector &ERO, IPAddress node)
cModule * getPayloadOwner (cPacket *msg)

Function Documentation

void append ( std::vector< int > &  dest,
const std::vector< int > &  src 
)

TODO documentation

Definition at line 59 of file Utils.cc.

{
    for (unsigned int i = 0; i < src.size(); i++)
        dest.push_back(src[i]);
}

bool find ( std::vector< int > &  vec,
int  value 
)

TODO documentation

Definition at line 43 of file Utils.cc.

{
    for (unsigned int i = 0; i < vec.size(); i++)
        if (vec[i] == value)
            return true;
    return false;
}

int find ( const EroVector &  ERO,
IPAddress  node 
)

TODO documentation

Definition at line 34 of file Utils.cc.

Referenced by TED::calculateShortestPath(), RTP::createProfile(), RTPProfile::createSenderModule(), RTPProfile::dataIn(), RoutingTable::deleteRoute(), RSVP::refreshResv(), SCTP::removeAssociation(), RoutingTable6::removeRoute(), FailureManager::replaceNode(), LinkStateRouting::sendToPeers(), NotificationBoard::subscribe(), and NotificationBoard::unsubscribe().

{
    for (unsigned int i = 0; i < ERO.size(); i++)
        if (ERO[i].node == node)
            return i;
    ASSERT(false);
    return -1; // to prevent warning
}

bool find ( const IPAddressVector &  vec,
IPAddress  addr 
)

TODO documentation

Definition at line 51 of file Utils.cc.

{
    for (unsigned int i = 0; i < vec.size(); i++)
        if (vec[i] == addr)
            return true;
    return false;
}

cModule* getPayloadOwner ( cPacket *  msg  ) 

XXX function appears to be unused

Definition at line 65 of file Utils.cc.

{
    while(msg->getEncapsulatedMsg())
        msg = msg->getEncapsulatedMsg();

    if (msg->hasPar("owner"))
        return simulation.getModule(msg->par("owner"));
    else
        return NULL;
}

void removeDuplicates ( std::vector< int > &  vec  ) 

TODO documentation

Definition at line 18 of file Utils.cc.

{
    for (unsigned int i = 0; i < vec.size(); i++)
    {
        unsigned int j;
        for (j = 0; j < i; j++)
            if (vec[j] == vec[i])
                break;
        if (j < i)
        {
            vec.erase(vec.begin() + i);
            --i;
        }
    }
}