OpenStudio:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Attributes | List of all members
openstudio::IdfObjectWatcher Class Reference

#include <IdfObjectWatcher.hpp>

+ Inheritance diagram for openstudio::IdfObjectWatcher:

Public Member Functions

void change ()
 
virtual void clearState ()
 reset dirty, dataChanged, and nameChanged More...
 
void dataChange ()
 
bool dataChanged () const
 if dirty, then true if data field changed, false if some other change More...
 
bool dirty () const
 true if object has changed More...
 
bool disable ()
 
void enable ()
 enable the watcher More...
 
bool enabled () const
 is the watcher currently enabled More...
 
 IdfObjectWatcher (const IdfObject &idfObject)
 constructor with IdfObject to watch More...
 
void nameChange ()
 
bool nameChanged () const
 if dirty, then true if name field changed, false otherwise More...
 
virtual void onBecomeClean ()
 called after dirty transitions from true to false if watcher enabled More...
 
virtual void onBecomeDirty ()
 called after dirty transitions from false to true if watcher enabled More...
 
virtual void onChangeIdfObject ()
 called each time the IdfObject changes if watcher enabled More...
 
virtual void onDataFieldChange ()
 called each time one of the IdfObject's data fields changes if watcher enabled More...
 
virtual void onNameChange ()
 called each time the IdfObject's name changes if watcher enabled More...
 
virtual ~IdfObjectWatcher ()
 virtual destructor More...
 

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 object because it is designed to be stack allocated. In many cases it would be preferred to connect your own heap allocated object 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