OpenStudioCore:utilities/idd
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
List of all members
openstudio::IddFileAndFactoryWrapper Class Reference

#include <IddFileAndFactoryWrapper.hpp>

Public Member Functions

Constructors and Destructors
 IddFileAndFactoryWrapper ()
 Default constructor sets IddFileType to IddFileType::OpenStudio. More...
 
 IddFileAndFactoryWrapper (const IddFile &iddFile)
 Construct from UserCustom IddFile. More...
 
 IddFileAndFactoryWrapper (IddFileType iddFileType)
 Construct wrapper that provides access to the iddFileType IddFile through the IddFactory . More...
 
virtual ~IddFileAndFactoryWrapper ()
 
Getters
std::string version () const
 Get the file version. More...
 
std::string header () const
 Get the file header. More...
 
std::vector< IddObjectobjects () const
 Get all the objects in the file. More...
 
std::vector< std::string > groups () const
 Get all groups in the file (e.g. More...
 
std::vector< IddObjectgetObjectsInGroup (const std::string &group) const
 Get all the objects in group (e.g. More...
 
std::vector< IddObjectgetObjects (const boost::regex &objectRegex) const
 Get the IddObjects that match objectRegex. More...
 
boost::optional< IddObjectversionObject () const
 If possible, returns the version IddObject for this IddFile. More...
 
boost::optional< IddObjectgetObject (const std::string &objectName) const
 Get the IddObject named objectName. More...
 
boost::optional< IddObjectgetObject (IddObjectType objectType) const
 Get the IddObject of type objectType. More...
 
std::vector< IddObjectrequiredObjects () const
 Get all IddObjects in the file that are required. More...
 
std::vector< IddObjectuniqueObjects () const
 Get all IddObjects in the file that are marked as unique. More...
 
IddFile iddFile () const
 Get the IddFile, which may have been explicitly specified by the user, or may be implicitly specified by reference to the IddFactory. More...
 
IddFileType iddFileType () const
 Get the IddFileType. More...
 
Setters
void setIddFile (const IddFile &iddFile)
 Set the IddFile explicitly. More...
 
void setIddFile (IddFileType iddFileType)
 Set the IddFile by specifying iddFileType. More...
 
Queries
bool isInFile (IddObjectType objectType) const
 Returns whether an IddObject of objectType is in iddFile(), unless objectType == IddObjectType::UserCustom. More...
 
bool isInFile (const std::string &objectName) const
 Returns whether there is an IddObject named objectName in iddFile(). More...
 

Detailed Description

Wraps the functionality of IddFile and IddFactory into one class for use by IdfFile and Workspace.

Constructor & Destructor Documentation

openstudio::IddFileAndFactoryWrapper::IddFileAndFactoryWrapper ( )

Default constructor sets IddFileType to IddFileType::OpenStudio.

openstudio::IddFileAndFactoryWrapper::IddFileAndFactoryWrapper ( const IddFile iddFile)

Construct from UserCustom IddFile.

openstudio::IddFileAndFactoryWrapper::IddFileAndFactoryWrapper ( IddFileType  iddFileType)

Construct wrapper that provides access to the iddFileType IddFile through the IddFactory .

Logs a warning if iddFileType == IddFileType::UserCustom, since this results in an empty IddFile.

virtual openstudio::IddFileAndFactoryWrapper::~IddFileAndFactoryWrapper ( )
inlinevirtual

Member Function Documentation

boost::optional<IddObject> openstudio::IddFileAndFactoryWrapper::getObject ( const std::string &  objectName) const

Get the IddObject named objectName.

Return value will evaluate to false if there is no such object in the file.

boost::optional<IddObject> openstudio::IddFileAndFactoryWrapper::getObject ( IddObjectType  objectType) const

Get the IddObject of type objectType.

Return value will evaluate to false if there is no such object in the IddFile, or if IddObjectType == IddObjectType::UserCustom.

std::vector<IddObject> openstudio::IddFileAndFactoryWrapper::getObjects ( const boost::regex &  objectRegex) const

Get the IddObjects that match objectRegex.

std::vector<IddObject> openstudio::IddFileAndFactoryWrapper::getObjectsInGroup ( const std::string &  group) const

Get all the objects in group (e.g.

"Simulation Parameters").

std::vector<std::string> openstudio::IddFileAndFactoryWrapper::groups ( ) const

Get all groups in the file (e.g.

"" and "Simulation Parameters").

std::string openstudio::IddFileAndFactoryWrapper::header ( ) const

Get the file header.

IddFile openstudio::IddFileAndFactoryWrapper::iddFile ( ) const

Get the IddFile, which may have been explicitly specified by the user, or may be implicitly specified by reference to the IddFactory.

IddFileType openstudio::IddFileAndFactoryWrapper::iddFileType ( ) const

Get the IddFileType.

If iddFileType() == IddFileType::UserCustom, then the file has been explicitly specified by the user. Otherwise, the file is implicitly defined and accessed through IddFactory.

bool openstudio::IddFileAndFactoryWrapper::isInFile ( IddObjectType  objectType) const

Returns whether an IddObject of objectType is in iddFile(), unless objectType == IddObjectType::UserCustom.

In the latter case, false will always be returned. To test whether a UserCustom file is being used, check the value of iddFileType().

bool openstudio::IddFileAndFactoryWrapper::isInFile ( const std::string &  objectName) const

Returns whether there is an IddObject named objectName in iddFile().

std::vector<IddObject> openstudio::IddFileAndFactoryWrapper::objects ( ) const

Get all the objects in the file.

std::vector<IddObject> openstudio::IddFileAndFactoryWrapper::requiredObjects ( ) const

Get all IddObjects in the file that are required.

An IdfFile (or Workspace) conforming to this IddFile must contain at least one object of each of these types.

void openstudio::IddFileAndFactoryWrapper::setIddFile ( const IddFile iddFile)

Set the IddFile explicitly.

This option does not use the IddFactory.

void openstudio::IddFileAndFactoryWrapper::setIddFile ( IddFileType  iddFileType)

Set the IddFile by specifying iddFileType.

This option uses the IddFactory, unless iddFileType == IddFileType::UserCustom, in which case a warning is logged.

std::vector<IddObject> openstudio::IddFileAndFactoryWrapper::uniqueObjects ( ) const

Get all IddObjects in the file that are marked as unique.

An IdfFile (or Workspace) conforming to this IddFile must contain at most one object of each of these types.

std::string openstudio::IddFileAndFactoryWrapper::version ( ) const

Get the file version.

boost::optional<IddObject> openstudio::IddFileAndFactoryWrapper::versionObject ( ) const

If possible, returns the version IddObject for this IddFile.