Implement the SatelliteNetwork class with these void methods:
class SatelliteNetwork {
public:
void SatelliteConnected(int satelliteId);
void RelationshipEstablished(int satelliteId1, int satelliteId2);
void MessageReceived(int M, const List<int>& satelliteIds);
void ErrDuplicateSatellite(int id);
void ErrInvalidSatellite(int id);
void OnSatelliteReportedBack(int satelliteId);
};
The input is a stream of N instruction records. MessageReceived receives M separately from a list containing exactly M satellite IDs; M is not part of that list.
Use one global simulation clock, initially at time 0, and an event queue for transmission-completion events. Transmissions and processing advance this clock, and callbacks are emitted from the resulting event order.
Handle a sequence of N instructions by implementing the SatelliteNetwork class:
SatelliteConnected(satelliteId) — registers a satellite with the network. If that satellite connects again, invoke ErrDuplicateSatellite(id).RelationshipEstablished(satelliteId1, satelliteId2) — creates a bidirectional connection. If either referenced satellite does not exist, invoke ErrInvalidSatellite(id) and ignore the entire instruction.MessageReceived(M, id_1, …, id_M) — indicates that M satellites receive an Earth message at the same instant.Protocol:
OnSatelliteReportedBack(satelliteId).