codec.h
// INCLUDE THE SMI MODEL BASE CLASS DECLARATION

#include "smi_model.h"

// DECLARE CLASSES USED IN THE INTERFACE

#include <string>
class SMI_TxMessage;
class SMI_RxMessage;

class Codec:
    public SMI_Model
{
public:
    // CONSTRUCTOR
    //
    // ARGUMENT: name
    //   SMI instance name.
    //
    // DESCRIPTION:
    //   Constructs new software model instance of a Codec model. Registers the
    //   model with SMI with SMI model name "codec" and the SMI instance name
    //   passed by argument.

    Codec(const string& name);

    // DESTRUCTOR

    virtual ~Codec();

    // METHOD: adcData()
    //
    // RETURNS:
    //   Value of the next read channel word.
    //
    // DESCRIPTION:
    //   This method is supplied by the user. The method generates the sequence
    //   of read channel data words, returning one data word each call.

    virtual unsigned long adcData() = 0;

    // METHOD: dacData(data)
    //
    // ARGUMENT: data
    //   Value of the next write channel word.
    //
    // DESCRIPTION:
    //   This method is supplied by the user. The method accepts the sequence of
    //   write channel data words, accepting one data word each call.

    virtual void dacData(unsigned long data) = 0;

private:
    // CONSTANT: USED TO IDENTIFY THE MESSAGE TYPE

    static const int DEV_WRITE;
    static const int DEV_READ;

    // DATA: REPLY MESSAGE

    SMI_TxMessage* d_tx;

    // METHOD: process(rx)
    //
    // ARGUMENT: rx
    //   Incoming message.
    //
    // RETURNS:
    //   Reply message.
    //
    // DESCRIPTION:
    //   Implements codec model operations by processing incoming messages.

    SMI_TxMessage* process(const SMI_RxMessage& rx);

    // DISABLE DEFAULT CONSTRUCTORS

    Codec();
    Codec(const Codec&);
};
© Copyright 2000-2001 Adrian Lewis