OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::BCLMeasure Class Reference

#include <BCLMeasure.hpp>

Public Member Functions

Destructor
virtual ~BCLMeasure ()=default
 Virtual destructor.
 
Getters
openstudio::path directory () const
 
boost::optional< std::string > error () const
 
std::string uid () const
 
UUID uuid () const
 
std::string versionId () const
 
UUID versionUUID () const
 
boost::optional< DateTimeversionModified () const
 
std::string xmlChecksum () const
 
std::string xmlString () const
 
std::string name () const
 
std::string displayName () const
 
std::string className () const
 
std::string description () const
 
std::string modelerDescription () const
 
std::vector< BCLMeasureArgumentarguments () const
 
std::vector< BCLMeasureOutputoutputs () const
 
std::vector< std::string > tags () const
 
std::vector< Attributeattributes () const
 
std::vector< BCLFileReferencefiles () const
 
Setters
void setError (const std::string &error)
 
void resetError ()
 
void setName (const std::string &name)
 
void setDisplayName (const std::string &displayName)
 
void setClassName (const std::string &className)
 
void setDescription (const std::string &description)
 
void setModelerDescription (const std::string &modelerDescription)
 
void setArguments (const std::vector< BCLMeasureArgument > &arguments)
 
void setOutputs (const std::vector< BCLMeasureOutput > &outputs)
 

Operators

std::string taxonomyTag () const
 Returns the single taxonomy tag allowed.
 
void setTaxonomyTag (const std::string &taxonomyTag)
 Sets the single taxonomy tag allowed.
 
MeasureType measureType () const
 Returns value of the "Measure Type" attribute.
 
MeasureLanguage measureLanguage () const
 
void setMeasureType (const MeasureType &measureType)
 Sets value of the "Measure Type" attribute.
 
void setMeasureLanguage (const MeasureLanguage &measureLanguage)
 
std::vector< std::string > intendedSoftwareTools () const
 Returns values of any "Intended Software Tool" attributes.
 
std::vector< std::string > intendedUseCases () const
 Returns values of any "Intended Use Case" attributes.
 
boost::optional< openstudio::pathprimaryRubyScriptPath () const
 Returns the path of the primary Ruby script if the file exists and is a regular file.
 
boost::optional< openstudio::pathprimaryPythonScriptPath () const
 
boost::optional< openstudio::pathprimaryScriptPath () const
 Returns the path of the primary script path, based on MeasureLanguage.
 
FileReferenceType inputFileType () const
 Returns the input file type for this measure.
 
FileReferenceType outputFileType () const
 Returns the output file type for this measure.
 
void clearFiles ()
 Clears all files.
 
void addAttribute (const Attribute &attribute)
 Adds attribute to attribute list.
 
std::vector< AttributegetAttributes (const std::string &name) const
 get attributes by name
 
bool removeAttributes (const std::string &name)
 Removes attribute by name, returns true if attribute was found and removed.
 
void clearAttributes ()
 Removes all attributes.
 
bool missingRequiredFields () const
 Check for all required fields, return true if any are missing Does not update the XML.
 
bool checkForUpdatesFiles ()
 Check for updates to files, will increment versionID and return true if any files have changed, been added, or removed from the measure The measure must still be saved to disk to preserve the new versionID Typical usage is 1) checkForUpdatesFiles, 2) update content using embedded ruby interpreter, 3) checkForUpdatesXML.
 
bool checkForUpdatesXML ()
 Check for updates to the xml, will increment versionID and xmlChecksum then return true if any xml fields (other than uid, version id, or xml checksum) have changed The xml file must still be saved to disk to preserve the new versionID.
 
bool operator== (const BCLMeasure &other) const
 Equality test - Compares the uids and versionIds of two separate measures.
 
bool operator!= (const BCLMeasure &other) const
 
bool operator< (const BCLMeasure &other) const
 Less than.
 
bool save () const
 Save the measure.xml back to the directory.
 
boost::optional< BCLMeasureclone (const openstudio::path &newDir) const
 Clone the measure from the original location to the new location newDir is a directory which either does not exist or is empty If the copy is successful a new BCLMeasure is returned.
 
void changeUID ()
 Change the UID for this measure.
 
void incrementVersionId ()
 Change the Version ID for this measure.
 
bool updateMeasureScript (const MeasureType &oldMeasureType, const MeasureType &newMeasureType, const MeasureLanguage &oldMeasureLanguage, const MeasureLanguage &newMeasureLanguage, const std::string &oldClassName, const std::string &newClassName, const std::string &name, const std::string &description, const std::string &modelerDescription)
 Update's the ruby measure script to have this new information.
 
bool updateMeasureTests (const std::string &oldClassName, const std::string &newClassName)
 Update's the ruby measure tests to have this new information.
 
Json::Value toJSON () const
 
std::string toJSONString () const
 
static std::vector< BCLMeasuregetMeasuresInDir (const openstudio::path &dir)
 get all measures in an input directory
 

Constructors

 BCLMeasure (const std::string &name, const std::string &className, const openstudio::path &dir, const std::string &taxonomyTag, MeasureType measureType, const std::string &description, const std::string &modelerDescription, MeasureLanguage measureLanguage=MeasureLanguage::Ruby)
 Constructor for a new measure with required data Will throw exception unless dir is a directory that does not exist or an empty directory.
 
 BCLMeasure (const openstudio::path &dir)
 Constructor for downloaded measures, path is to directory containing "measure.xml" file Will throw exception if directory does not exist or does not represent a valid measure.
 
static std::string makeClassName (const std::string &name)
 Convert a measure name to a valid Ruby class name.
 
static boost::optional< BCLMeasureload (const openstudio::path &dir)
 Try to load a BCLMeasure from a directory containing a "measure.xml" file.
 
static std::vector< std::string > suggestedIntendedSoftwareTools ()
 Suggested values for "Intended Software Tool" attribute.
 
static std::vector< std::string > suggestedIntendedUseCases ()
 Suggested values for "Intended Use Case" attribute.
 
static std::vector< std::string > suggestedFirstLevelTaxonomyTerms ()
 Suggested values for the first level taxonomy tag.
 
static std::vector< std::string > suggestedSecondLevelTaxonomyTerms (const std::string &firstLevelTaxonomyTerm)
 Suggested values for the second level taxonomy tag.
 
static bool isIgnoredFileName (const std::string &fileName)
 
static bool isApprovedFile (const openstudio::path &absoluteFilePath, const openstudio::path &measureDir)
 

Detailed Description

BCLMeasure is a class for managing the contents of a BCL Measure directory including the xml description file.

Constructor & Destructor Documentation

◆ BCLMeasure() [1/2]

openstudio::BCLMeasure::BCLMeasure ( const std::string & name,
const std::string & className,
const openstudio::path & dir,
const std::string & taxonomyTag,
MeasureType measureType,
const std::string & description,
const std::string & modelerDescription,
MeasureLanguage measureLanguage = MeasureLanguage::Ruby )

Constructor for a new measure with required data Will throw exception unless dir is a directory that does not exist or an empty directory.

A template measure will be created, including a blank user script.

◆ BCLMeasure() [2/2]

openstudio::BCLMeasure::BCLMeasure ( const openstudio::path & dir)

Constructor for downloaded measures, path is to directory containing "measure.xml" file Will throw exception if directory does not exist or does not represent a valid measure.

◆ ~BCLMeasure()

virtual openstudio::BCLMeasure::~BCLMeasure ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ addAttribute()

void openstudio::BCLMeasure::addAttribute ( const Attribute & attribute)

Adds attribute to attribute list.

◆ arguments()

std::vector< BCLMeasureArgument > openstudio::BCLMeasure::arguments ( ) const

◆ attributes()

std::vector< Attribute > openstudio::BCLMeasure::attributes ( ) const

◆ changeUID()

void openstudio::BCLMeasure::changeUID ( )

Change the UID for this measure.

◆ checkForUpdatesFiles()

bool openstudio::BCLMeasure::checkForUpdatesFiles ( )

Check for updates to files, will increment versionID and return true if any files have changed, been added, or removed from the measure The measure must still be saved to disk to preserve the new versionID Typical usage is 1) checkForUpdatesFiles, 2) update content using embedded ruby interpreter, 3) checkForUpdatesXML.

◆ checkForUpdatesXML()

bool openstudio::BCLMeasure::checkForUpdatesXML ( )

Check for updates to the xml, will increment versionID and xmlChecksum then return true if any xml fields (other than uid, version id, or xml checksum) have changed The xml file must still be saved to disk to preserve the new versionID.

◆ className()

std::string openstudio::BCLMeasure::className ( ) const

◆ clearAttributes()

void openstudio::BCLMeasure::clearAttributes ( )

Removes all attributes.

◆ clearFiles()

void openstudio::BCLMeasure::clearFiles ( )

Clears all files.

◆ clone()

boost::optional< BCLMeasure > openstudio::BCLMeasure::clone ( const openstudio::path & newDir) const

Clone the measure from the original location to the new location newDir is a directory which either does not exist or is empty If the copy is successful a new BCLMeasure is returned.

◆ description()

std::string openstudio::BCLMeasure::description ( ) const

◆ directory()

openstudio::path openstudio::BCLMeasure::directory ( ) const

◆ displayName()

std::string openstudio::BCLMeasure::displayName ( ) const

◆ error()

boost::optional< std::string > openstudio::BCLMeasure::error ( ) const

◆ files()

std::vector< BCLFileReference > openstudio::BCLMeasure::files ( ) const

◆ getAttributes()

std::vector< Attribute > openstudio::BCLMeasure::getAttributes ( const std::string & name) const

get attributes by name

◆ getMeasuresInDir()

static std::vector< BCLMeasure > openstudio::BCLMeasure::getMeasuresInDir ( const openstudio::path & dir)
static

get all measures in an input directory

◆ incrementVersionId()

void openstudio::BCLMeasure::incrementVersionId ( )

Change the Version ID for this measure.

◆ inputFileType()

FileReferenceType openstudio::BCLMeasure::inputFileType ( ) const

Returns the input file type for this measure.

◆ intendedSoftwareTools()

std::vector< std::string > openstudio::BCLMeasure::intendedSoftwareTools ( ) const

Returns values of any "Intended Software Tool" attributes.

◆ intendedUseCases()

std::vector< std::string > openstudio::BCLMeasure::intendedUseCases ( ) const

Returns values of any "Intended Use Case" attributes.

◆ isApprovedFile()

static bool openstudio::BCLMeasure::isApprovedFile ( const openstudio::path & absoluteFilePath,
const openstudio::path & measureDir )
static

◆ isIgnoredFileName()

static bool openstudio::BCLMeasure::isIgnoredFileName ( const std::string & fileName)
static

◆ load()

static boost::optional< BCLMeasure > openstudio::BCLMeasure::load ( const openstudio::path & dir)
static

Try to load a BCLMeasure from a directory containing a "measure.xml" file.

◆ makeClassName()

static std::string openstudio::BCLMeasure::makeClassName ( const std::string & name)
static

Convert a measure name to a valid Ruby class name.

◆ measureLanguage()

MeasureLanguage openstudio::BCLMeasure::measureLanguage ( ) const

◆ measureType()

MeasureType openstudio::BCLMeasure::measureType ( ) const

Returns value of the "Measure Type" attribute.

◆ missingRequiredFields()

bool openstudio::BCLMeasure::missingRequiredFields ( ) const

Check for all required fields, return true if any are missing Does not update the XML.

◆ modelerDescription()

std::string openstudio::BCLMeasure::modelerDescription ( ) const

◆ name()

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

◆ operator!=()

bool openstudio::BCLMeasure::operator!= ( const BCLMeasure & other) const

◆ operator<()

bool openstudio::BCLMeasure::operator< ( const BCLMeasure & other) const

Less than.

◆ operator==()

bool openstudio::BCLMeasure::operator== ( const BCLMeasure & other) const

Equality test - Compares the uids and versionIds of two separate measures.

◆ outputFileType()

FileReferenceType openstudio::BCLMeasure::outputFileType ( ) const

Returns the output file type for this measure.

◆ outputs()

std::vector< BCLMeasureOutput > openstudio::BCLMeasure::outputs ( ) const

◆ primaryPythonScriptPath()

boost::optional< openstudio::path > openstudio::BCLMeasure::primaryPythonScriptPath ( ) const

◆ primaryRubyScriptPath()

boost::optional< openstudio::path > openstudio::BCLMeasure::primaryRubyScriptPath ( ) const

Returns the path of the primary Ruby script if the file exists and is a regular file.

Otherwise returns boost::none.

◆ primaryScriptPath()

boost::optional< openstudio::path > openstudio::BCLMeasure::primaryScriptPath ( ) const

Returns the path of the primary script path, based on MeasureLanguage.

◆ removeAttributes()

bool openstudio::BCLMeasure::removeAttributes ( const std::string & name)

Removes attribute by name, returns true if attribute was found and removed.

◆ resetError()

void openstudio::BCLMeasure::resetError ( )

◆ save()

bool openstudio::BCLMeasure::save ( ) const

Save the measure.xml back to the directory.

◆ setArguments()

void openstudio::BCLMeasure::setArguments ( const std::vector< BCLMeasureArgument > & arguments)

◆ setClassName()

void openstudio::BCLMeasure::setClassName ( const std::string & className)

◆ setDescription()

void openstudio::BCLMeasure::setDescription ( const std::string & description)

◆ setDisplayName()

void openstudio::BCLMeasure::setDisplayName ( const std::string & displayName)

◆ setError()

void openstudio::BCLMeasure::setError ( const std::string & error)

◆ setMeasureLanguage()

void openstudio::BCLMeasure::setMeasureLanguage ( const MeasureLanguage & measureLanguage)

◆ setMeasureType()

void openstudio::BCLMeasure::setMeasureType ( const MeasureType & measureType)

Sets value of the "Measure Type" attribute.

◆ setModelerDescription()

void openstudio::BCLMeasure::setModelerDescription ( const std::string & modelerDescription)

◆ setName()

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

◆ setOutputs()

void openstudio::BCLMeasure::setOutputs ( const std::vector< BCLMeasureOutput > & outputs)

◆ setTaxonomyTag()

void openstudio::BCLMeasure::setTaxonomyTag ( const std::string & taxonomyTag)

Sets the single taxonomy tag allowed.

◆ suggestedFirstLevelTaxonomyTerms()

static std::vector< std::string > openstudio::BCLMeasure::suggestedFirstLevelTaxonomyTerms ( )
static

Suggested values for the first level taxonomy tag.

◆ suggestedIntendedSoftwareTools()

static std::vector< std::string > openstudio::BCLMeasure::suggestedIntendedSoftwareTools ( )
static

Suggested values for "Intended Software Tool" attribute.

◆ suggestedIntendedUseCases()

static std::vector< std::string > openstudio::BCLMeasure::suggestedIntendedUseCases ( )
static

Suggested values for "Intended Use Case" attribute.

◆ suggestedSecondLevelTaxonomyTerms()

static std::vector< std::string > openstudio::BCLMeasure::suggestedSecondLevelTaxonomyTerms ( const std::string & firstLevelTaxonomyTerm)
static

Suggested values for the second level taxonomy tag.

◆ tags()

std::vector< std::string > openstudio::BCLMeasure::tags ( ) const

◆ taxonomyTag()

std::string openstudio::BCLMeasure::taxonomyTag ( ) const

Returns the single taxonomy tag allowed.

◆ toJSON()

Json::Value openstudio::BCLMeasure::toJSON ( ) const

◆ toJSONString()

std::string openstudio::BCLMeasure::toJSONString ( ) const

◆ uid()

std::string openstudio::BCLMeasure::uid ( ) const

◆ updateMeasureScript()

bool openstudio::BCLMeasure::updateMeasureScript ( const MeasureType & oldMeasureType,
const MeasureType & newMeasureType,
const MeasureLanguage & oldMeasureLanguage,
const MeasureLanguage & newMeasureLanguage,
const std::string & oldClassName,
const std::string & newClassName,
const std::string & name,
const std::string & description,
const std::string & modelerDescription )

Update's the ruby measure script to have this new information.

◆ updateMeasureTests()

bool openstudio::BCLMeasure::updateMeasureTests ( const std::string & oldClassName,
const std::string & newClassName )

Update's the ruby measure tests to have this new information.

◆ uuid()

UUID openstudio::BCLMeasure::uuid ( ) const

◆ versionId()

std::string openstudio::BCLMeasure::versionId ( ) const

◆ versionModified()

boost::optional< DateTime > openstudio::BCLMeasure::versionModified ( ) const

◆ versionUUID()

UUID openstudio::BCLMeasure::versionUUID ( ) const

◆ xmlChecksum()

std::string openstudio::BCLMeasure::xmlChecksum ( ) const

◆ xmlString()

std::string openstudio::BCLMeasure::xmlString ( ) const