OpenStudio:utilities
 AllClasses Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages

#include "IdfObjectWatcher.hpp"

Inheritance diagram for openstudio::IdfObjectWatcher:

Public Member Functions

void change ()
virtual void clearState ()
void dataChange ()
bool dataChanged () const
bool dirty () const
bool disable ()
void enable ()
bool enabled () const
 IdfObjectWatcher (const IdfObject &idfObject)
void nameChange ()
bool nameChanged () const
virtual void onBecomeClean ()
virtual void onBecomeDirty ()
virtual void onChangeIdfObject ()
virtual void onDataFieldChange ()
virtual void onNameChange ()
virtual ~IdfObjectWatcher ()

Protected Attributes

bool m_dataChanged
bool m_dirty
bool m_enabled
bool m_nameChanged

Detailed Description

IdfObjectWatcher watches an IdfObject for signals emitted on changes.

These signals will cause the watcher to mark the IdfObject as dirty. The dirty flag will persist until reset by the user. Virtual methods onChangeIdfObject and onDataFieldChange are also available to override. The former is called every time the IdfObject changes in any way; the latter is called whenever a data field changes (not triggered by comment changes, and is superceded by onRelationshipChange for WorkspaceObject pointer fields.) The virtual method onBecomeDirty is called only after dirty transitions from false to true. Alternatively, the virtual method onBecomeClean is called only after dirty transitions from true to false.

IdfObjectWatcher is an atypical QObject because it is designed to be stack allocated. In many cases it would be preferred to connect your own heap allocated QObject to the Workspace signals directly rather than using this convenience class.

Constructor & Destructor Documentation

openstudio::IdfObjectWatcher::IdfObjectWatcher ( const IdfObject idfObject)

constructor with IdfObject to watch

virtual openstudio::IdfObjectWatcher::~IdfObjectWatcher ( )
virtual

virtual destructor

Member Function Documentation

void openstudio::IdfObjectWatcher::change ( )
virtual void openstudio::IdfObjectWatcher::clearState ( )
virtual

reset dirty, dataChanged, and nameChanged

Reimplemented in openstudio::WorkspaceObjectWatcher.

void openstudio::IdfObjectWatcher::dataChange ( )
bool openstudio::IdfObjectWatcher::dataChanged ( ) const

if dirty, then true if data field changed, false if some other change

bool openstudio::IdfObjectWatcher::dirty ( ) const

true if object has changed

bool openstudio::IdfObjectWatcher::disable ( )
void openstudio::IdfObjectWatcher::enable ( )

enable the watcher

bool openstudio::IdfObjectWatcher::enabled ( ) const

is the watcher currently enabled

void openstudio::IdfObjectWatcher::nameChange ( )
bool openstudio::IdfObjectWatcher::nameChanged ( ) const

if dirty, then true if name field changed, false otherwise

virtual void openstudio::IdfObjectWatcher::onBecomeClean ( )
virtual

called after dirty transitions from true to false if watcher enabled

virtual void openstudio::IdfObjectWatcher::onBecomeDirty ( )
virtual

called after dirty transitions from false to true if watcher enabled

virtual void openstudio::IdfObjectWatcher::onChangeIdfObject ( )
virtual

called each time the IdfObject changes if watcher enabled

virtual void openstudio::IdfObjectWatcher::onDataFieldChange ( )
virtual

called each time one of the IdfObject's data fields changes if watcher enabled

virtual void openstudio::IdfObjectWatcher::onNameChange ( )
virtual

called each time the IdfObject's name changes if watcher enabled

Member Data Documentation

bool openstudio::IdfObjectWatcher::m_dataChanged
protected
bool openstudio::IdfObjectWatcher::m_dirty
protected
bool openstudio::IdfObjectWatcher::m_enabled
protected
bool openstudio::IdfObjectWatcher::m_nameChanged
protected