pelican/examples/reference/src/EmulatorExample.cpp
EmulatorExample::EmulatorExample(const ConfigNode& configNode)
    : AbstractUdpEmulator(configNode)
{
    // Initialise members.
    _counter = 0;
    _interval = configNode.getOption("packet", "interval", "100000").toULong();
    _packetSize = configNode.getOption("packet", "size", "8192").toULong();
    _initialValue = configNode.getOption("packet", "initialValue", "0").toDouble();

    // Check that the packet size is a multiple of 8.
    if (_packetSize % sizeof(double) != 0)
        throw QString("EmulatorExample: "
                "Packet size must be a whole number of doubles.");

    // Check that the packet size is not empty.
    if (_packetSize == 0)
        throw QString("EmulatorExample: Packet size must be > 0.");

    // Initialise the packet.
    _packet.resize(_packetSize);
}
/**
 * @details Constructs the EmulatorExample.
 * This obtains the relevant configuration parameters.
 */
@details Constructs the EmulatorExample.
This obtains the relevant configuration parameters.
@details Constructs the EmulatorExample . This obtains the relevant configuration parameters .
EmulatorExample::EmulatorExample(const ConfigNode& configNode)
    : AbstractUdpEmulator(configNode)
{
    _counter = 0;
    _interval = configNode.getOption("packet", "interval", "100000").toULong();
    _packetSize = configNode.getOption("packet", "size", "8192").toULong();
    _initialValue = configNode.getOption("packet", "initialValue", "0").toDouble();
    if (_packetSize % sizeof(double) != 0)
        throw QString("EmulatorExample: "
                "Packet size must be a whole number of doubles.");
    if (_packetSize == 0)
        throw QString("EmulatorExample: Packet size must be > 0.");
    _packet.resize(_packetSize);
}
EmulatorExample :: EmulatorExample ( const ConfigNode & configNode ) : AbstractUdpEmulator ( configNode ) { _counter = 0 ; _interval = configNode . getOption ( " " , " " , " " ) . toULong ( ) ; _packetSize = configNode . getOption ( " " , " " , " " ) . toULong ( ) ; _initialValue = configNode . getOption ( " " , " " , " " ) . toDouble ( ) ; if ( _packetSize % sizeof ( double ) != 0 ) throw QString ( " " " " ) ; if ( _packetSize == 0 ) throw QString ( " " ) ; _packet . resize ( _packetSize ) ; }
@details Constructs the EmulatorExample.
@details Constructs the EmulatorExample .
// Initialise members. // Check that the packet size is a multiple of 8. // Check that the packet size is not empty. // Initialise the packet.