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

#include <IddFactory.hxx>

Public Member Functions

Getters
std::string getVersion (IddFileType fileType) const
 Get the file version. More...
 
std::string getHeader (IddFileType fileType) const
 Get the file header. More...
 
std::vector< IddObjectobjects () const
 Return all IddObjects registered in factory. More...
 
std::vector< IddObjectgetObjects (IddFileType fileType) const
 Return all IddObjects in IddFileType type. More...
 
std::vector< std::string > groups () const
 Return all groups in the factory (e.g. More...
 
std::vector< std::string > getGroups (IddFileType fileType) const
 Return all groups in fileType. More...
 
std::vector< IddObjectgetObjectsInGroup (const std::string &group) const
 Return all IddObjects in group (e.g. More...
 
std::vector< IddObjectgetObjectsInGroup (const std::string &group, IddFileType fileType) const
 Return all IddObjects in group and fileType. More...
 
std::vector< IddObjectgetObjects (const boost::regex &objectRegex) const
 Return all IddObjects that match objectRegex. More...
 
std::vector< IddObjectgetObjects (const boost::regex &objectRegex, IddFileType fileType) const
 Return all IddObjects that match objectRegex and are in fileType. More...
 
IddObject getVersionObject (IddFileType fileType) const
 Returns the version IddObject for fileType. More...
 
boost::optional< IddObjectgetObject (const std::string &objectName) const
 Return the IddObject with .name() objectName, if it exists in the factory. More...
 
boost::optional< IddObjectgetObject (IddObjectType objectType) const
 Return the IddObject corresponding to objectType. More...
 
std::vector< IddObjectrequiredObjects () const
 Return all objects in the factory that are required. More...
 
std::vector< IddObjectgetRequiredObjects (IddFileType fileType) const
 Return all objects in IddFile fileType that are required. More...
 
std::vector< IddObjectuniqueObjects () const
 Return all objects in the factory that are unique. More...
 
std::vector< IddObjectgetUniqueObjects (IddFileType fileType) const
 Return all objects in IddFile fileType that are unique. More...
 
IddFile getIddFile (IddFileType fileType) const
 Return the (current) IddFile corresponding to type. More...
 
boost::optional< IddFilegetIddFile (IddFileType fileType, const VersionString &version) const
 Return the IddFile corresponding to type and version. More...
 
Queries
bool isInFile (IddObjectType objectType, IddFileType fileType) const
 Returns true if IddObject of objectType belongs to IddFile of fileType. More...
 

Related Functions

(Note that these are not member functions.)

typedef openstudio::Singleton
< IddFactorySingleton
IddFactory
 Convenience typedef for accessing IddFactorySingleton. More...
 

Detailed Description

IddFactorySingleton can return IddObjects and IddFiles for the current version of EnergyPlus and OpenStudio.

It can return IddFiles only (no link with other methods in this class, for instance, no by-IddObjectType access to individual IddObjects) for previous versions of OpenStudio, back to version 0.7.0. It also supports the default IddObject type, Catchall, which is provided to enable the display of IdfObjects with misspelled type names, and a CommentOnly object. Its primary function is to establish a single set of IDD schema across all of OpenStudio, thereby ensuring consistency and reducing file I-O.

IddFactorySingleton should be used through the IddFactory typedef as in

IddFile osIddFile = IddFactory::instance().iddFile(IddFileType::OpenStudio);

Member Function Documentation

std::vector<std::string> openstudio::IddFactorySingleton::getGroups ( IddFileType  fileType) const

Return all groups in fileType.

std::string openstudio::IddFactorySingleton::getHeader ( IddFileType  fileType) const

Get the file header.

Throws if fileType == IddFileType::UserCustom or IddFileType::WholeFactory.

IddFile openstudio::IddFactorySingleton::getIddFile ( IddFileType  fileType) const

Return the (current) IddFile corresponding to type.

boost::optional<IddFile> openstudio::IddFactorySingleton::getIddFile ( IddFileType  fileType,
const VersionString &  version 
) const

Return the IddFile corresponding to type and version.

Unless version is equal to VersionString(getVersion(fileType)), files are loaded from disk and returned as IddFileType::UserCustom, to distinguish them from the IDD information wrapped by the IddFactory. At this time, only IddFileType::OpenStudio files are supported, and only for valid version identifiers >= VersionString("0.7.0"). Returns false in all other cases.

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

Return the IddObject with .name() objectName, if it exists in the factory.

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

Return the IddObject corresponding to objectType.

Returns false if type == IddObjectType::UserCustom.

std::vector<IddObject> openstudio::IddFactorySingleton::getObjects ( IddFileType  fileType) const

Return all IddObjects in IddFileType type.

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

Return all IddObjects that match objectRegex.

std::vector<IddObject> openstudio::IddFactorySingleton::getObjects ( const boost::regex &  objectRegex,
IddFileType  fileType 
) const

Return all IddObjects that match objectRegex and are in fileType.

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

Return all IddObjects in group (e.g.

"Simulation Parameters").

std::vector<IddObject> openstudio::IddFactorySingleton::getObjectsInGroup ( const std::string &  group,
IddFileType  fileType 
) const

Return all IddObjects in group and fileType.

std::vector<IddObject> openstudio::IddFactorySingleton::getRequiredObjects ( IddFileType  fileType) const

Return all objects in IddFile fileType that are required.

std::vector<IddObject> openstudio::IddFactorySingleton::getUniqueObjects ( IddFileType  fileType) const

Return all objects in IddFile fileType that are unique.

std::string openstudio::IddFactorySingleton::getVersion ( IddFileType  fileType) const

Get the file version.

Throws if fileType == IddFileType::UserCustom or IddFileType::WholeFactory.

IddObject openstudio::IddFactorySingleton::getVersionObject ( IddFileType  fileType) const

Returns the version IddObject for fileType.

Throws if fileType == IddFileType::UserCustom or IddFileType::WholeFactory.

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

Return all groups in the factory (e.g.

"" and "Simulation Parameters").

bool openstudio::IddFactorySingleton::isInFile ( IddObjectType  objectType,
IddFileType  fileType 
) const

Returns true if IddObject of objectType belongs to IddFile of fileType.

IddObjectType::Catchall is in no IddFiles; IddObjectType::CommentOnly is in all IddFiles.

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

Return all IddObjects registered in factory.

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

Return all objects in the factory that are required.

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

Return all objects in the factory that are unique.

Friends And Related Function Documentation

typedef openstudio::Singleton<IddFactorySingleton> IddFactory
related

Convenience typedef for accessing IddFactorySingleton.

Usage:

unsigned n = IddFactory::instance().objects().size();