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

#include <IddObject.hpp>

Public Member Functions

Constructors
 IddObject ()
 Default constructor returns Catchall object. More...
 
 IddObject (const IddObject &other)
 Copy constructor returns an IddObject that shares its data with other. More...
 
Getters
std::string name () const
 Get this IddObject's name. More...
 
IddObjectType type () const
 Get object type, as specified by the OPENSTUDIO_ENUM IddObjectType. More...
 
std::string group () const
 Get the name of the IDD group to which this object belongs. More...
 
const IddObjectPropertiesproperties () const
 Get the properties of this object. More...
 
const std::vector< IddField > & nonextensibleFields () const
 Get all non-extensible IddFields. More...
 
const std::vector< IddField > & extensibleGroup () const
 Get this object's extensible group, that is, the vector of extensible IddFields that may be repeated indefinitely (except as capped by properties().maxFields) at the end of an IdfObject following this schema. More...
 
boost::optional< IddFieldgetField (unsigned index) const
 Get the IddField at index, if it exists. More...
 
boost::optional< IddFieldgetField (const std::string &fieldName) const
 Get the IddField in this object named fieldName. More...
 
boost::optional< int > getFieldIndex (const std::string &fieldName) const
 Get the index of the IddField named fieldName. More...
 
Setters

Most users should not use any of the IDD setters.

void insertHandleField ()
 If not already present, inserts a field of type handle at the top of the object. More...
 
Queries
unsigned numFields () const
 Returns the number of non-extensible fields in this object. More...
 
unsigned numFieldsInDefaultObject () const
 Returns the initial number of fields with which to populate an IdfObject constructed from IddObject or IddObjectType. More...
 
bool isVersionObject () const
 Returns true if name contains some form of "Version". More...
 
bool isNonextensibleField (unsigned index) const
 Returns true if index, as used in an IdfObject following this schema, corresponds to a non-extensible field. More...
 
bool isExtensibleField (unsigned index) const
 Returns true if index, as used in an IdfObject following this schema, corresponds to a field in an extensible group. More...
 
bool hasHandleField () const
 Returns true if first IddField is of type handle. More...
 
bool hasNameField () const
 Returns true if the first IddField after the handle field, if present, is a name IddField. More...
 
boost::optional< unsigned > nameFieldIndex () const
 Returns the index containing the name field, if hasNameField(). More...
 
bool isRequiredField (unsigned index) const
 Returns true if index, as used in an IdfObject following this schema, corresponds to a required field. More...
 
bool hasURL () const
 Returns true if this object has any url fields. More...
 
std::vector< unsigned > urlFields () const
 Returns the indices of all fields of url type. More...
 
ExtensibleIndex extensibleIndex (unsigned index) const
 Returns the ExtensibleIndex(groupIndex,fieldIndex) that corresponds to field index. More...
 
unsigned index (ExtensibleIndex extensibleIndex) const
 Returns the overall IddObject index equivalent to extensibleIndex. More...
 
std::vector< std::string > references () const
 Returns the reference lists to which this object belongs. More...
 
std::set< std::string > objectLists () const
 Returns the union of all the object lists to which fields in this object can refer. More...
 
std::set< std::string > objectLists (unsigned index) const
 Returns all the object lists to which IddField index refers. More...
 
std::vector< unsigned > objectListFields () const
 Returns the indices of the IddFields in this object of object-list type. More...
 
bool operator== (const IddObject &other) const
 Returns true if all underlying data is equal (either trivially or by exhaustive comparison). More...
 
bool operator!= (const IddObject &other) const
 The negation of operator==. More...
 

Related Functions

(Note that these are not member functions.)

std::vector< std::string > getIddKeyNames (const IddObject &object, unsigned index)
 Converts the vector of IddKeys associated with object.getField(index) to a vector of std::string. More...
 
std::set< IddObjectTypegetIddObjectTypeSet (const std::vector< IddObject > &objects)
 
std::vector< IddObjectTypegetIddObjectTypeVector (const std::vector< IddObject > &objects)
 
using IddObjectVector = std::vector< IddObject >
 
std::ostream & operator<< (std::ostream &os, const IddObject &iddObject)
 
using OptionalIddObject = boost::optional< IddObject >
 

Serialization

std::ostream & print (std::ostream &os) const
 Print this object to os, in standard IDD format. More...
 
static boost::optional< IddObjectload (const std::string &name, const std::string &group, const std::string &text, IddObjectType type)
 Load from name, group, type, and text. More...
 
static boost::optional< IddObjectload (const std::string &name, const std::string &group, const std::string &text)
 

Detailed Description

IddObject represents an object in the Idd.

IddObject is a shared object.

Constructor & Destructor Documentation

openstudio::IddObject::IddObject ( )

Default constructor returns Catchall object.

This object is provided to help users correct typos in their object names.

openstudio::IddObject::IddObject ( const IddObject other)

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

Member Function Documentation

const std::vector<IddField>& openstudio::IddObject::extensibleGroup ( ) const

Get this object's extensible group, that is, the vector of extensible IddFields that may be repeated indefinitely (except as capped by properties().maxFields) at the end of an IdfObject following this schema.

ExtensibleIndex openstudio::IddObject::extensibleIndex ( unsigned  index) const

Returns the ExtensibleIndex(groupIndex,fieldIndex) that corresponds to field index.

Throws if !isExtensibleField(index).

boost::optional<IddField> openstudio::IddObject::getField ( unsigned  index) const

Get the IddField at index, if it exists.

Returns fields in extensible groups using the assumption that extensible groups repeat indefinitely.

boost::optional<IddField> openstudio::IddObject::getField ( const std::string &  fieldName) const

Get the IddField in this object named fieldName.

Extensible fields are included, but they are not named uniquely.

boost::optional<int> openstudio::IddObject::getFieldIndex ( const std::string &  fieldName) const

Get the index of the IddField named fieldName.

std::string openstudio::IddObject::group ( ) const

Get the name of the IDD group to which this object belongs.

bool openstudio::IddObject::hasHandleField ( ) const

Returns true if first IddField is of type handle.

This should be true for every OpenStudio IddObject and false for every EnergyPlus IddObject.

bool openstudio::IddObject::hasNameField ( ) const

Returns true if the first IddField after the handle field, if present, is a name IddField.

bool openstudio::IddObject::hasURL ( ) const

Returns true if this object has any url fields.

unsigned openstudio::IddObject::index ( ExtensibleIndex  extensibleIndex) const

Returns the overall IddObject index equivalent to extensibleIndex.

Throws if IddObject is not extensible or if extensibleIndex.field >= properties().numExtensible.

void openstudio::IddObject::insertHandleField ( )

If not already present, inserts a field of type handle at the top of the object.

Not for general use.

bool openstudio::IddObject::isExtensibleField ( unsigned  index) const

Returns true if index, as used in an IdfObject following this schema, corresponds to a field in an extensible group.

bool openstudio::IddObject::isNonextensibleField ( unsigned  index) const

Returns true if index, as used in an IdfObject following this schema, corresponds to a non-extensible field.

bool openstudio::IddObject::isRequiredField ( unsigned  index) const

Returns true if index, as used in an IdfObject following this schema, corresponds to a required field.

bool openstudio::IddObject::isVersionObject ( ) const

Returns true if name contains some form of "Version".

static boost::optional<IddObject> openstudio::IddObject::load ( const std::string &  name,
const std::string &  group,
const std::string &  text,
IddObjectType  type 
)
static

Load from name, group, type, and text.

The first string in the IddObject text, appearing immediately before the first comma, is the IddObject name. The group string comes from the IddFile. If not constructed by the IddFactory, or the IddObject does not otherwise come from the EnergyPlus or OpenStudio IDD files, type should be equal to UserCustom. The constructor also needs the full text of the object for parsing.

static boost::optional<IddObject> openstudio::IddObject::load ( const std::string &  name,
const std::string &  group,
const std::string &  text 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

std::string openstudio::IddObject::name ( ) const

Get this IddObject's name.

boost::optional<unsigned> openstudio::IddObject::nameFieldIndex ( ) const

Returns the index containing the name field, if hasNameField().

Otherwise, returns boost::none.

const std::vector<IddField>& openstudio::IddObject::nonextensibleFields ( ) const

Get all non-extensible IddFields.

unsigned openstudio::IddObject::numFields ( ) const

Returns the number of non-extensible fields in this object.

unsigned openstudio::IddObject::numFieldsInDefaultObject ( ) const

Returns the initial number of fields with which to populate an IdfObject constructed from IddObject or IddObjectType.

Accounts for properties().minFields, properties().numExtensibleGroupsRequired, and IddField::properties().required.

std::vector<unsigned> openstudio::IddObject::objectListFields ( ) const

Returns the indices of the IddFields in this object of object-list type.

Includes indices in the first extensible group.

std::set<std::string> openstudio::IddObject::objectLists ( ) const

Returns the union of all the object lists to which fields in this object can refer.

std::set<std::string> openstudio::IddObject::objectLists ( unsigned  index) const

Returns all the object lists to which IddField index refers.

bool openstudio::IddObject::operator!= ( const IddObject other) const

The negation of operator==.

bool openstudio::IddObject::operator== ( const IddObject other) const

Returns true if all underlying data is equal (either trivially or by exhaustive comparison).

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

Print this object to os, in standard IDD format.

const IddObjectProperties& openstudio::IddObject::properties ( ) const

Get the properties of this object.

std::vector<std::string> openstudio::IddObject::references ( ) const

Returns the reference lists to which this object belongs.

This method only returns reference lists explicitly attached the name field. (It does not include 'AllObjects', for instance.)

IddObjectType openstudio::IddObject::type ( ) const

Get object type, as specified by the OPENSTUDIO_ENUM IddObjectType.

Similar information to name() for IddObjects stored by the IddFactory , that is type() == IddObjectType(name()) and type().valueDescription() == name().

std::vector<unsigned> openstudio::IddObject::urlFields ( ) const

Returns the indices of all fields of url type.

Friends And Related Function Documentation

std::vector< std::string > getIddKeyNames ( const IddObject object,
unsigned  index 
)
related

Converts the vector of IddKeys associated with object.getField(index) to a vector of std::string.

std::set< IddObjectType > getIddObjectTypeSet ( const std::vector< IddObject > &  objects)
related
std::vector< IddObjectType > getIddObjectTypeVector ( const std::vector< IddObject > &  objects)
related
using IddObjectVector = std::vector<IddObject>
related
std::ostream & operator<< ( std::ostream &  os,
const IddObject iddObject 
)
related
using OptionalIddObject = boost::optional<IddObject>
related