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

#include "WorkspaceObject.hpp"

Inheritance diagram for openstudio::WorkspaceObject:

Public Member Functions

virtual ~WorkspaceObject ()
std::vector
< openstudio::IdfObject
remove ()
Workspace workspace () const
boost::optional< WorkspaceObjectgetTarget (unsigned index) const
std::vector< WorkspaceObjecttargets () const
std::vector< unsigned > getSourceIndices (const Handle &targetHandle) const
std::vector< WorkspaceObjectsources () const
std::vector< WorkspaceObjectgetSources (IddObjectType type) const
boost::optional< std::string > getField (unsigned index) const
bool setPointer (unsigned index, const Handle &targetHandle)
bool operator< (const WorkspaceObject &right) const
bool initialized () const
unsigned numSources () const
bool isSource () const
bool canBeSource () const
bool canBeSource (unsigned index, const std::vector< std::string > &refLists=std::vector< std::string >()) const
bool isTarget () const
std::vector< std::string > canBeTarget () const
bool objectListFieldsEqual (const WorkspaceObject &other) const
bool objectListFieldsNonConflicting (const WorkspaceObject &other) const
IdfObject idfObject ()
IdfObject idfObject () const

Protected Types

typedef
detail::WorkspaceObject_Impl 
ImplType

Protected Member Functions

 WorkspaceObject (std::shared_ptr< detail::WorkspaceObject_Impl > impl)

Related Functions

std::ostream & operator<< (std::ostream &os, const WorkspaceObject &workspaceObject)
typedef boost::optional
< WorkspaceObject
OptionalWorkspaceObject
typedef std::vector
< WorkspaceObject
WorkspaceObjectVector

Detailed Description

WorkspaceObject holds and manipulates data objects in Energyplus IDF format in the context of a Workspace.

Over and above IdfObject, WorkspaceObject maintains ObjectListType fields as pointers (possibly null) to other WorkspaceObjects in the same Workspace, and only commits changes that maintain the validity of its Workspace at the current StrictnessLevel (typically Draft, moving to Final right before simulation).

Member Typedef Documentation

typedef detail::WorkspaceObject_Impl openstudio::WorkspaceObject::ImplType
protected

Constructor & Destructor Documentation

virtual openstudio::WorkspaceObject::~WorkspaceObject ( )
inlinevirtual
openstudio::WorkspaceObject::WorkspaceObject ( std::shared_ptr< detail::WorkspaceObject_Impl >  impl)
protected

Member Function Documentation

bool openstudio::WorkspaceObject::canBeSource ( ) const

Returns true if this object can point to another object.

To qualify, there must be at least one object-list field.

bool openstudio::WorkspaceObject::canBeSource ( unsigned  index,
const std::vector< std::string > &  refLists = std::vector< std::string >() 
) const

Returns true if field index can be a source field.

If no refLists are specified, then this call is equivalent to iddObject().getField(index)->isObjectListField(). If a non-empty vector of refLists is specified, then true is only returned if there is a match between field index's object lists and the referencesLists argument.

std::vector<std::string> openstudio::WorkspaceObject::canBeTarget ( ) const

Returns the reference lists of which this object is a member, if this object has a name.

boost::optional<std::string> openstudio::WorkspaceObject::getField ( unsigned  index) const

Like getString except for reference fields getString will return the name of the referenced object.

This method, getField, will always return the string value of the field.

std::vector<unsigned> openstudio::WorkspaceObject::getSourceIndices ( const Handle targetHandle) const

Returns the index of the field in this object that points to targetHandle, if possible.

std::vector<WorkspaceObject> openstudio::WorkspaceObject::getSources ( IddObjectType  type) const

Returns all objects of type that point to this object, filtering for duplicate objects.

boost::optional<WorkspaceObject> openstudio::WorkspaceObject::getTarget ( unsigned  index) const

Returns the object pointed to by field index, if it exists.

IdfObject openstudio::WorkspaceObject::idfObject ( )

Returns an equivalent IdfObject, naming target objects if necessary.

All data is cloned. If the objects have handle fields (as in the OpenStudio IDD), pointers to other objects are printed as handles; otherwise pointers are printed as names.

IdfObject openstudio::WorkspaceObject::idfObject ( ) const

Returns an equivalent IdfObject, leaving unnamed target objects unnamed.

All data is cloned. If the objects have handle fields (as in the OpenStudio IDD), pointers to other objects are printed as handles; otherwise pointers are printed as names.

bool openstudio::WorkspaceObject::initialized ( ) const
bool openstudio::WorkspaceObject::isSource ( ) const

Returns true if this object points to another object.

To qualify, there must be at least one pointer field holding a non-null pointer.

bool openstudio::WorkspaceObject::isTarget ( ) const

Returns true if another object points to this object.

unsigned openstudio::WorkspaceObject::numSources ( ) const

Returns the number of objects that point to this object.

bool openstudio::WorkspaceObject::objectListFieldsEqual ( const WorkspaceObject other) const

Checks for equality of objectListFields().

Prerequisite: iddObject()s must be equal. Looks for object equality of targets if same workspace(), otherwise, looks for data field equality of targets.

bool openstudio::WorkspaceObject::objectListFieldsNonConflicting ( const WorkspaceObject other) const

Returns true if for all objectListFields() that for both objects are non-empty, the values are equal (using the same criteria as objectListFieldsEqual).

Prerequisite: iddObject()s must be equal.

bool openstudio::WorkspaceObject::operator< ( const WorkspaceObject right) const
std::vector<openstudio::IdfObject> openstudio::WorkspaceObject::remove ( )

Removes the object from the Workspace.

Returns an IdfObjectVector of all removed object(s).

bool openstudio::WorkspaceObject::setPointer ( unsigned  index,
const Handle targetHandle 
)

Sets the pointer at field index to targetHandle, if possible.

The field must be of object-list type, and targetHandle must be valid (null or in the containing Workspace, and if the strictness is greater than enums::None, must correspond to an object of a proper type).

std::vector<WorkspaceObject> openstudio::WorkspaceObject::sources ( ) const

Returns all objects that point to this object, filtering for duplicate objects.

std::vector<WorkspaceObject> openstudio::WorkspaceObject::targets ( ) const

Returns all objects pointed to by this object.

Workspace openstudio::WorkspaceObject::workspace ( ) const

Return the Workspace that contains this WorkspaceObject.

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  os,
const WorkspaceObject workspaceObject 
)
related

Outputs WorkspaceObject as (IDF) text.

typedef boost::optional<WorkspaceObject> OptionalWorkspaceObject
related
typedef std::vector<WorkspaceObject> WorkspaceObjectVector
related