Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (25 sloc) 854 Bytes
#ifndef STOCHASTIC_LOSS_HPP
#define STOCHASTIC_LOSS_HPP
#include "channel.hpp"
#include "packet.hpp"
#include "close.hpp"
class StochasticLoss : public Channel {
private:
double loss_probability;
public:
class ForkState : public Channel::ForkState {
public:
Packet pack;
ForkState( Packet s_pack ) : pack( s_pack ) {}
ForkState( void ) : pack( -1, -1, -1, -1 ) {}
};
StochasticLoss( double s_prob );
void send( Packet pack );
bool sendable( void ) { return true; }
void after_fork( bool is_other, ForkState x );
string identify( void ) const;
bool operator==( const StochasticLoss &x ) const { return (loss_probability == x.loss_probability); }
friend size_t hash_value( StochasticLoss const & ch );
void quantize_markovize( void ) { loss_probability = quantize_probability( loss_probability ); }
};
#endif