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

#include <IddFile.hpp>

Public Member Functions

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

Protected Member Functions

void addObject (const IddObject &object)
 add an object More...
 
void setBuild (const std::string &build)
 set build More...
 
void setHeader (const std::string &header)
 set header More...
 
void setVersion (const std::string &version)
 set version More...
 

Related Functions

(Note that these are not member functions.)

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

Constructors

 IddFile ()
 Default constructor returns an IddFile with no version, no header, and no objects. More...
 
 IddFile (const IddFile &other)
 Copy constructor returns an IddFile that shares its data with other. More...
 
static IddFile catchallIddFile ()
 Returns an IddFile containing a single, default constructed IddObject of Catchall type. More...
 

Serialization

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

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