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

#include <WorkspaceWatcher.hpp>

Public Member Functions

void change ()
 
virtual void clearState ()
 resets dirty, objectAdded, and objectRemoved More...
 
bool dirty () const
 true if workspace has changed More...
 
bool disable ()
 
void enable ()
 enable the watcher More...
 
bool enabled () const
 is the watcher currently enabled More...
 
void objectAdd (const WorkspaceObject &addedObject, const openstudio::IddObjectType &type, const openstudio::UUID &uuid)
 
bool objectAdded () const
 true if an object has been added More...
 
void objectRemove (const WorkspaceObject &removedObject, const openstudio::IddObjectType &type, const openstudio::UUID &uuid)
 
bool objectRemoved () const
 true if an object has been removed 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 onChangeWorkspace ()
 called each time the IdfObject changes if watcher enabled More...
 
virtual void onObjectAdd (const WorkspaceObject &addedObject)
 called immediately when a new object is added to the workspace if watcher enabled the object may not be fully constructed this may be called when an object is restored after a failed remove More...
 
virtual void onObjectRemove (const WorkspaceObject &removedObject)
 called immediately before an object is removed from the workspace if watcher enabled the object is still valid when this method is called More...
 
 WorkspaceWatcher (const Workspace &workspace)
 
virtual ~WorkspaceWatcher ()=default
 

Detailed Description

WorkspaceWatcher watches a Workspace for signals emitted on changes.

This signals will cause the watcher to mark the Workspace as dirty. The dirty flag will persist until reset by the user. A virtual method onChangeWorkspace is also available to override, it is called everytime the Workspace changes. 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.

WorkspaceWatcher 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::WorkspaceWatcher::WorkspaceWatcher ( const Workspace workspace)
virtual openstudio::WorkspaceWatcher::~WorkspaceWatcher ( )
virtualdefault

Member Function Documentation

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

resets dirty, objectAdded, and objectRemoved

bool openstudio::WorkspaceWatcher::dirty ( ) const

true if workspace has changed

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

enable the watcher

bool openstudio::WorkspaceWatcher::enabled ( ) const

is the watcher currently enabled

void openstudio::WorkspaceWatcher::objectAdd ( const WorkspaceObject addedObject,
const openstudio::IddObjectType &  type,
const openstudio::UUID uuid 
)
bool openstudio::WorkspaceWatcher::objectAdded ( ) const

true if an object has been added

void openstudio::WorkspaceWatcher::objectRemove ( const WorkspaceObject removedObject,
const openstudio::IddObjectType &  type,
const openstudio::UUID uuid 
)
bool openstudio::WorkspaceWatcher::objectRemoved ( ) const

true if an object has been removed

virtual void openstudio::WorkspaceWatcher::onBecomeClean ( )
virtual

called after dirty transitions from true to false if watcher enabled

virtual void openstudio::WorkspaceWatcher::onBecomeDirty ( )
virtual

called after dirty transitions from false to true if watcher enabled

virtual void openstudio::WorkspaceWatcher::onChangeWorkspace ( )
virtual

called each time the IdfObject changes if watcher enabled

virtual void openstudio::WorkspaceWatcher::onObjectAdd ( const WorkspaceObject addedObject)
virtual

called immediately when a new object is added to the workspace if watcher enabled the object may not be fully constructed this may be called when an object is restored after a failed remove

virtual void openstudio::WorkspaceWatcher::onObjectRemove ( const WorkspaceObject removedObject)
virtual

called immediately before an object is removed from the workspace if watcher enabled the object is still valid when this method is called