Files
scandocs/uni/masterarbeit/source/moversight/ms/InvitationList.h
2014-06-30 13:58:10 +02:00

66 lines
1.6 KiB
C++

/*
* File: InvitationList.h
* Author: jgaebler
*
* Created on March 3, 2011, 2:48 PM
*/
#pragma once
#ifndef INVITATIONLIST_H
#define INVITATIONLIST_H
#include "Invitation.h"
#include "common/container/List.h"
namespace ubeeme {
namespace moversight {
class InvitationList: public List<Invitation> {
public:
/**
* @brief Default constructor
*/
InvitationList(){
}
/**
* @brief Constructor. Creates an object, based on the given list.
* @param list The list to add to the new list.
*/
InvitationList(const List<Invitation> & list){
for(size_t i=0; i<list.size(); i++){
add(list.get(i));
}//End for
}
const Invitation & find(const InvitationID invId) const{
TList::const_iterator it = std::find(queue.begin(), queue.end(), invId);
if ( it != queue.end() ) {
return *it;
}//end if
throw InvitationNotFoundException("no valid invitation for the given invitation id present");
}
const Invitation & findByInviteeAddress(const TransportAddress & ta) const {
for(size_t i=0; i< queue.size(); i++){
if(queue[i].getInviteeAddress() == ta){
return queue[i];
}
}
throw InvitationNotFoundException("no valid invitation for the given transport address present");
}
};
}
}
#endif /* INVITATIONLIST_H */