OpenStudio:utilities/idd
 AllClasses Namespaces Functions Variables Typedefs Enumerations Enumerator Pages

#include "IddFile.hpp"

Public Member Functions

std::string version () const
std::string build () const
std::string header () const
std::vector< IddObjectobjects () const
std::vector< std::string > groups () const
std::vector< IddObjectgetObjectsInGroup (const std::string &group) const
std::vector< IddObjectgetObjects (const boost::regex &objectRegex) const
boost::optional< IddObjectversionObject () const
boost::optional< IddObjectgetObject (const std::string &objectName) const
boost::optional< IddObjectgetObject (IddObjectType objectType) const
std::vector< IddObjectrequiredObjects () const
std::vector< IddObjectuniqueObjects () const

Protected Member Functions

void addObject (const IddObject &object)
void setBuild (const std::string &build)
void setHeader (const std::string &header)
void setVersion (const std::string &version)

Related Functions

typedef std::vector< IddFileIddFileVector
std::ostream & operator<< (std::ostream &os, const IddFile &iddFile)
typedef boost::optional< IddFileOptionalIddFile

Constructors

 IddFile ()
 IddFile (const IddFile &other)
static IddFile catchallIddFile ()

Serialization

std::ostream & print (std::ostream &os) const
bool save (const openstudio::path &p, bool overwrite=false)
static boost::optional< IddFileload (std::istream &is)
static boost::optional< IddFileload (const openstudio::path &p)
static std::pair
< VersionString, std::string > 
parseVersionBuild (const openstudio::path &p)

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

openstudio::IddFile::IddFile ( )

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

openstudio::IddFile::IddFile ( const IddFile other)

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

Member Function Documentation

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

add an object

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

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

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

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

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.

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.

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

Returns the objects whose names match objectRegex.

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

Returns all objects in group (e.g.

"Simulation Parameters").

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

Returns all groups in the file (e.g.

"" and "Simulation Parameters").

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

Returns the file header.

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

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

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

Load an IddFile from path p, if possible.

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

Returns all the objects in the file.

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
std::ostream& openstudio::IddFile::print ( std::ostream &  os) const

Prints this file to std::ostream os.

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.

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'.

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

set build

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

set header

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

set version

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.

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

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

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

Returns the version IddObject for this file, if possible.

Friends And Related Function Documentation

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