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

Method getField

src/utilities/idf/WorkspaceObject.cpp:190–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188 }
189
190 boost::optional<std::string> WorkspaceObject_Impl::getField(unsigned index, bool returnDefault) const {
191 boost::optional<std::string> result;
192
193 // IdfObject_Impl::getString won't work if this is a source field... since m_fields will be blank
194 // So we handle that case too
195
196 // If it's a source field:
197 if (canBeSource(index) && (index < numFields())) {
198 if (!initialized()) {
199 return boost::none;
200 }
201
202 if (m_sourceData) {
203 // find index and return target if handle not null
204 auto fpIt = getConstIteratorAtFieldIndex<SourceData>(m_sourceData->pointers, index);
205 if (fpIt != m_sourceData->pointers.end()) {
206 Handle th = fpIt->targetHandle;
207 if (!th.isNull()) {
208 result = openstudio::toString(th);
209 }
210 }
211 }
212 } else {
213 // If not source, then call getString
214 result = IdfObject_Impl::getString(index, returnDefault, false);
215 }
216
217 return result;
218 }
219
220 OptionalWorkspaceObject WorkspaceObject_Impl::getTarget(unsigned index) const {
221 if (!initialized()) {

Callers 6

initializeOnAddMethod · 0.45
getStringMethod · 0.45
canBeSourceMethod · 0.45
emitChangeSignalsMethod · 0.45

Calls 3

isNullMethod · 0.80
toStringFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected