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

#include <IddField.hpp>

Public Member Functions

Constructors
 IddField ()
 Default constructor. More...
 
Getters
std::string name () const
 Returns this field's name. More...
 
std::string fieldId () const
 Returns this field's id in its parent IddObject, e.g. More...
 
const IddFieldPropertiesproperties () 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. More...
 
boost::optional< Unit > getUnits (bool returnIP=false) const
 Returns the SI or IP units associated with this field, if they exist. More...
 
bool unitsBasedOnOtherField () const
 Returns true if the units markup for this field specifies that the units are dependent on the value of another field. More...
 
boost::optional< IddKeygetKey (const std::string &keyName) const
 Get the IddKey object by keyName (case insensitive). More...
 
std::vector< IddKeykeys () const
 Get all of the IddKeys for this field. More...
 
Setters

Most users should not use any of the IDD setters.

void setName (const std::string &name)
 Set the field name. More...
 
void incrementFieldId (const boost::regex &fieldType=boost::regex("A"))
 Increments the field id number, that is, A1 becomes A2, etc. More...
 
Queries
bool isNameField () const
 Returns true if this field defines a reference name in IDF, or can be otherwise distinguised as an IdfObject name. More...
 
bool isObjectListField () const
 Returns true if this field is of object-list type and calls out one or more object-lists. More...
 
bool operator== (const IddField &other) const
 Equality operator. More...
 
bool operator!= (const IddField &other) const
 Inequality operator. More...
 

Related Functions

(Note that these are not member functions.)

typedef std::vector< IddFieldIddFieldVector
 
typedef boost::optional< IddFieldOptionalIddField
 
bool referencesEqual (const IddField &field1, const IddField &field2)
 Returns true if the reference lists of field1 and field2 match exactly (case insensitive). More...
 

Serialization

std::ostream & print (std::ostream &os, bool lastField) const
 Print the IddField to an output stream. More...
 
static boost::optional< IddFieldload (const std::string &name, const std::string &text, const std::string &objectName)
 Load the IddField, that is, parse its text. More...
 

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

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

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