MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / BCLMeasure

Method BCLMeasure

src/utilities/bcl/BCLMeasure.cpp:155–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155BCLMeasure::BCLMeasure(const std::string& name, const std::string& className, const openstudio::path& dir, const std::string& taxonomyTag,
156 MeasureType measureType, const std::string& description, const std::string& modelerDescription,
157 MeasureLanguage measureLanguage)
158 : m_directory(openstudio::filesystem::system_complete(dir)), m_bclXML(BCLXMLType::MeasureXML) {
159
160 // Avoid potential problems, since toPath("/path/to/dir/") != toPath("/path/to/dir")
161 m_directory.remove_trailing_separator();
162
163 openstudio::path measureDocRelativeDir = toPath("docs");
164 openstudio::path measureTestRelativeDir = toPath("tests");
165 std::string lowerClassName = toUnderscoreCase(className);
166
167 createDirectory(m_directory);
168 createDirectory(m_directory / measureDocRelativeDir);
169 createDirectory(m_directory / measureTestRelativeDir);
170
171 // read in template files
172 std::string measureTemplate;
173 std::string licenseTemplate = ":/templates/common/LICENSE.md";
174 std::string readmeTemplate;
175 if (measureLanguage == MeasureLanguage::Ruby) {
176 readmeTemplate = ":/templates/common/README.md.erb";
177 }
178 std::string docTemplate = ":/templates/common/docs/.gitkeep";
179 std::string testTemplate;
180
181 std::string templateClassName;
182 std::vector<BCLMeasureArgument> arguments;
183 std::vector<BCLMeasureOutput> outputs;
184 std::string testOSM;
185 std::string testEPW;
186 std::string resourceFile;
187
188 openstudio::path testOSMRelativePath;
189 openstudio::path testEPWRelativePath;
190 openstudio::path resourceFileRelativePath;
191 if (measureType == MeasureType::ModelMeasure) {
192 if (measureLanguage == MeasureLanguage::Ruby) {
193 measureTemplate = ":/templates/ModelMeasure/measure.rb";
194 testTemplate = ":/templates/ModelMeasure/tests/model_measure_test.rb";
195 } else if (measureLanguage == MeasureLanguage::Python) {
196 measureTemplate = ":/templates/ModelMeasure/measure.py";
197 testTemplate = ":/templates/ModelMeasure/tests/test_model_measure.py";
198 }
199 testOSM = ":/templates/ModelMeasure/tests/example_model.osm";
200 templateClassName = "ModelMeasureName";
201
202 testOSMRelativePath = toPath("tests/example_model.osm");
203
204 std::string argName("space_name");
205 std::string argDisplayName("New space name");
206 std::string argDescription("This name will be used as the name of the new space.");
207 std::string argType("String");
208 BCLMeasureArgument arg(argName, argDisplayName, argDescription, argType, boost::none, true, false, boost::none, std::vector<std::string>(),
209 std::vector<std::string>(), boost::none, boost::none);
210 arguments.push_back(arg);
211
212 } else if (measureType == MeasureType::EnergyPlusMeasure) {

Callers

nothing calls this directly

Calls 15

setMeasureTypeMethod · 0.95
setMeasureLanguageMethod · 0.95
toUnderscoreCaseFunction · 0.85
replaceFunction · 0.85
setUsageTypeMethod · 0.80
addTagMethod · 0.80
resetXMLChecksumMethod · 0.80
valueTypeMethod · 0.80
hasFileMethod · 0.80
valueNameMethod · 0.80
toPathFunction · 0.50

Tested by

no test coverage detected