Advertisement
Guest User

ultimo

a guest
May 27th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. #include "Receptor1.hpp"
  2. #include <iostream>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7.         Receptor::Receptor():transmisiones(), msgs_recibidos()
  8.         {}
  9.  
  10.  
  11.         Receptor::Receptor(const Receptor& rc){
  12.             transmisiones = rc.transmisiones;
  13.             msgs_recibidos = rc.msgs_recibidos;
  14.             }
  15.  
  16.  
  17.         Receptor::~Receptor(){
  18.             transmisiones.~ListaPaquetes();
  19.             msgs_recibidos.~vector();
  20.             }
  21.  
  22.  
  23.         void Receptor::clear(){
  24.             transmisiones.clear();
  25.             msgs_recibidos.clear();
  26.         }
  27.  
  28.  
  29.         void Receptor::add_pack(const Paquete& pq){
  30.                 transmisiones.add_pack(pq);
  31.                 }
  32.  
  33.  
  34.         string Receptor::extraer_msgs(){
  35.                 string idaux;
  36.                 ostringstream os;
  37.  
  38.                 while(transmisiones.esta_vacia()!=true){
  39.                     idaux = transmisiones.primer_id();
  40.  
  41.  
  42.                     os << transmisiones.recuperar_mensaje(idaux);
  43.  
  44.                 }
  45.                 return os.str();
  46.         }
  47.  
  48.         string Receptor::str() const{
  49.             int dim = msgs_recibidos.size();
  50.             ostringstream os;
  51.             os << endl << "PAQUETES" << endl << endl << transmisiones.str() << endl << "MSGS" << endl;
  52.  
  53.             if(dim>0){
  54.                 for(unsigned i = 0; i<dim; i++){
  55.                     os << msgs_recibidos.at(i) << endl;
  56.  
  57.                     }
  58.             }
  59.             return os.str();
  60.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement