DDModEvent.h

Classes

DDModEvent -- Class used by DisplayDatas to signal change in data (full description)

class DDModEvent : public DisplayDataEvent

Interface

Public Members
DDModEvent(DisplayData* dd, const Record *rec)
virtual ~DDModEvent()
virtual const Record *dataRecord() const
Protected Members
DDModEvent()
DDModEvent(const DDModEvent &other)
DDModEvent &operator=(const DDModEvent &other)

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Etymology

"DisplayData Modified Event" describes "Events" (ie. things which happen at a measurable time) which signal to event handlers that the data of the transmitting displaydata has been modified.

Prerequisite

Synopsis

This class adds to the information stored in the DisplayDataEvent class. It adds a pointer to a record that holds the modified data. The structure of the record is specific to each type of Display Data so the event handlers will need to know the structure they are listening for

Example

    // Sending a DDModEvent from a Profile2dDD (inherits from ActiveCaching2dDD)
    Record rec;
    fillRecordWithData(rec); // DD specific function
    DDModEvent ev(this, &rec);
    ActiveCaching2dDD::handleEvent(ev); // let super classes send events
    
    // Receiving a DDModEvent from a Profile2dDD
    ...
    profile2dDD->addDisplayEventHandler(this);
    ...
    void MyClass::handleEvent(DisplayEvent &ev) {
      DDModEvent *dev = dynamic_cast<DDModEvent*>(&ev);
      if (dev) {
        Profile2dDD *pdd = dynamic_cast<Profile2dDD*>(dev->displayData());
        if (pdd) {
        // event from Profile2dDD received!
        }
      }
    }
    

Motivation

It's desirable to send some data with DisplayDataEvents that has information about the DisplayData and the data that is modified within it.

Thrown Exceptions

To Do

Member Description

DDModEvent(DisplayData* dd, const Record *rec)

Constructor, taking a pointer to a DisplayData and a pointer to a data record.

virtual ~DDModEvent()

Destructor.

virtual const Record *dataRecord() const

Return a pointer to the data record.

DDModEvent()

(Required) default constructor.

DDModEvent(const DDModEvent &other)

(Required) copy constructor.

DDModEvent &operator=(const DDModEvent &other)

(Required) copy assignment.