OpenStudio:utilities/idd
Loading...
Searching...
No Matches
openstudio::IddFile Class Reference

#include <IddFile.hpp>

Public Member Functions

Getters
std::string version () const
 Returns the file version (as specified in the header).
 
std::string build () const
 Returns the file build (as specified in the header).
 
std::string header () const
 Returns the file header.
 
std::vector< IddObjectobjects () const
 Returns all the objects in the file.
 
std::vector< std::string > groups () const
 Returns all groups in the file (e.g.
 
std::vector< IddObjectgetObjectsInGroup (const std::string &group) const
 Returns all objects in group (e.g.
 
std::vector< IddObjectgetObjects (const boost::regex &objectRegex) const
 Returns the objects whose names match objectRegex.
 
boost::optional< IddObjectversionObject () const
 Returns the version IddObject for this file, if possible.
 
boost::optional< IddObjectgetObject (const std::string &objectName) const
 Returns the object named objectName (case-insensitive).
 
boost::optional< IddObjectgetObject (IddObjectType objectType) const
 Returns the object of type objectType, if possible.
 
std::vector< IddObjectrequiredObjects () const
 Returns all objects in the file that are required.
 
std::vector< IddObjectuniqueObjects () const
 Returns all objects in the file that are marked as unique.
 

Related Symbols

(Note that these are not member symbols.)

using IddFileVector = std::vector<IddFile>
 
std::ostream & operator<< (std::ostream &os, const IddFile &iddFile)
 
using OptionalIddFile = boost::optional<IddFile>
 

Serialization

std::ostream & print (std::ostream &os) const
 Prints this file to std::ostream os.
 
bool save (const openstudio::path &p, bool overwrite=false)
 Saves file to path p.
 
static boost::optional< IddFileload (std::istream &is)
 Load an IddFile from std::istream, if possible.
 
static boost::optional< IddFileload (const openstudio::path &p)
 Load an IddFile from path p, if possible.
 
static std::pair< VersionString, std::string > parseVersionBuild (const openstudio::path &p)
 Returns the version and build SHA from the given Idd.
 
void setVersion (const std::string &version)
 set version
 
void setBuild (const std::string &build)
 set build
 
void setHeader (const std::string &header)
 set header
 
void addObject (const IddObject &object)
 add an object
 

Constructors

 IddFile ()
 Default constructor returns an IddFile with no version, no header, and no objects.
 
static IddFile catchallIddFile ()
 Copy constructor returns an IddFile that shares its data with other.
 

Detailed Description

IddFile provides parsing and printing of text files in Input Data Definition (IDD) format.

IDD is a schema definition format defined by the EnergyPlus team, adopted with slight modifications for the OpenStudio project. IddFile is a shared object.

Constructor & Destructor Documentation

◆ IddFile()

openstudio::IddFile::IddFile ( )

Default constructor returns an IddFile with no version, no header, and no objects.

Member Function Documentation

◆ addObject()

void openstudio::IddFile::addObject ( const IddObject & object)
protected

add an object

◆ build()

std::string openstudio::IddFile::build ( ) const

Returns the file build (as specified in the header).

◆ catchallIddFile()

static IddFile openstudio::IddFile::catchallIddFile ( )
static

Copy constructor returns an IddFile that shares its data with other.

Returns an IddFile containing a single, default constructed IddObject of Catchall type.

◆ getObject() [1/2]

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

Returns the object named objectName (case-insensitive).

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

◆ getObject() [2/2]

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

Returns the object of type objectType, if possible.

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

◆ getObjects()

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

Returns the objects whose names match objectRegex.

◆ getObjectsInGroup()

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

Returns all objects in group (e.g.

"Simulation Parameters").

◆ groups()

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

Returns all groups in the file (e.g.

"" and "Simulation Parameters").

◆ header()

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

Returns the file header.

◆ load() [1/2]

static boost::optional< IddFile > openstudio::IddFile::load ( const openstudio::path & p)
static

Load an IddFile from path p, if possible.

◆ load() [2/2]

static boost::optional< IddFile > openstudio::IddFile::load ( std::istream & is)
static

Load an IddFile from std::istream, if possible.

◆ objects()

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

Returns all the objects in the file.

◆ parseVersionBuild()

static std::pair< VersionString, std::string > openstudio::IddFile::parseVersionBuild ( const openstudio::path & p)
static

Returns the version and build SHA from the given Idd.

If build SHA is not present .second will be empty.

Exceptions
anexception with a meaningful error message if something goes wrong

◆ print()

std::ostream & openstudio::IddFile::print ( std::ostream & os) const

Prints this file to std::ostream os.

◆ requiredObjects()

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

Returns all objects 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 to be valid at StrictnessLevel::Final.

◆ save()

bool openstudio::IddFile::save ( const openstudio::path & p,
bool overwrite = false )

Saves file to path p.

Will construct the parent folder if necessary and if its parent folder already exists. Will only overwrite an existing file if overwrite==true. If no extension is provided will use 'idd'.

◆ setBuild()

void openstudio::IddFile::setBuild ( const std::string & build)
protected

set build

◆ setHeader()

void openstudio::IddFile::setHeader ( const std::string & header)
protected

set header

◆ setVersion()

void openstudio::IddFile::setVersion ( const std::string & version)
protected

set version

◆ uniqueObjects()

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

Returns all objects 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 to be valid at StrictnessLevel::Final.

◆ version()

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

Returns the file version (as specified in the header).

◆ versionObject()

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

Returns the version IddObject for this file, if possible.

Friends And Related Symbol Documentation

◆ IddFileVector

using IddFileVector = std::vector<IddFile>
related

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
const IddFile & iddFile )
related

◆ OptionalIddFile

using OptionalIddFile = boost::optional<IddFile>
related