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

#include "IddField.hpp"

Public Member Functions

 IddField ()
std::string name () const
std::string fieldId () const
const IddFieldPropertiesproperties () const
boost::optional< Unit > getUnits (bool returnIP=false) const
bool unitsBasedOnOtherField () const
boost::optional< IddKeygetKey (const std::string &keyName) const
std::vector< IddKeykeys () const
void setName (const std::string &name)
void incrementFieldId (const boost::regex &fieldType=boost::regex("A"))
bool isNameField () const
bool isObjectListField () const
bool operator== (const IddField &other) const
bool operator!= (const IddField &other) const

Related Functions

using IddFieldVector = std::vector< IddField >
using OptionalIddField = boost::optional< IddField >
bool referencesEqual (const IddField &field1, const IddField &field2)

Serialization

std::ostream & print (std::ostream &os, bool lastField) const
static boost::optional< IddFieldload (const std::string &name, const std::string &text, const std::string &objectName)

Detailed Description

IddField represents a field in an IddObject, that is, the schema for a single piece of data (alpha or numeric) in an IDF.

Constructor & Destructor Documentation

openstudio::IddField::IddField ( )

Default constructor.

Member Function Documentation

std::string openstudio::IddField::fieldId ( ) const

Returns this field's id in its parent IddObject, e.g.

A1, A2, N1, N2.

boost::optional<IddKey> openstudio::IddField::getKey ( const std::string &  keyName) const

Get the IddKey object by keyName (case insensitive).

boost::optional<Unit> openstudio::IddField::getUnits ( bool  returnIP = false) const

Returns the SI or IP units associated with this field, if they exist.

All IDF data is stored in SI. The return value with returnIP == true can be used to convert underlying data to the default IP units. If there are no particular IP units specified in the IDD, this method attempts to choose appropriate units to which one can convert.

void openstudio::IddField::incrementFieldId ( const boost::regex &  fieldType = boost::regex("A"))

Increments the field id number, that is, A1 becomes A2, etc.

Added to support IddObject::insertHandleField(). Not for general use.

bool openstudio::IddField::isNameField ( ) const

Returns true if this field defines a reference name in IDF, or can be otherwise distinguised as an IdfObject name.

Returns true if the field has a \reference property and does not have an \object-list property (if it has both, it is an example of a forwarded reference), or if the field is a plain AlphaType field named 'Name'.

bool openstudio::IddField::isObjectListField ( ) const

Returns true if this field is of object-list type and calls out one or more object-lists.

std::vector<IddKey> openstudio::IddField::keys ( ) const

Get all of the IddKeys for this field.

Only expected to be non-empty if this is a choice field (properties().type() == IddFieldType::ChoiceType).

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

Load the IddField, that is, parse its text.

Whitespace is not preserved. The string following the \field slash code, or, if that is absent, the 'A' or 'N' identifier, should be sent in as name. objectName is the IddObject.name() to which this field belongs.

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

Returns this field's name.

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

Inequality operator.

Negation of operator==.

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

Equality operator.

Returns true if this IddField and other share an impl or if all underlying data is exactly equal.

std::ostream& openstudio::IddField::print ( std::ostream &  os,
bool  lastField 
) const

Print the IddField to an output stream.

Field slash codes are indented to produce pretty output. If lastField, then the field id will be followed by a semi-colon; otherwise, a comma will be used (consistent with IDD formatting).

const IddFieldProperties& openstudio::IddField::properties ( ) const

Returns the properties of this field, that is, a list of IDD-markup information such as data type, default value, units, and numeric bounds.

void openstudio::IddField::setName ( const std::string &  name)

Set the field name.

Not for general use.

bool openstudio::IddField::unitsBasedOnOtherField ( ) const

Returns true if the units markup for this field specifies that the units are dependent on the value of another field.

Such units are not handled at the IdfFile/Workspace level. They should be explicitly handled by individual ModelObject classes.

Friends And Related Function Documentation

using IddFieldVector = std::vector<IddField>
related
using OptionalIddField = boost::optional<IddField>
related
bool referencesEqual ( const IddField field1,
const IddField field2 
)
related

Returns true if the reference lists of field1 and field2 match exactly (case insensitive).