<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi All,<div class=""><br class=""></div><div class="">In the new design for Views I had failed to take into consideration the fact that Views might be defined within a C++ piece of code and not just through XML. In order to avoid developers having to create XML document strings in their code to create a View I modified the proposed View class to no longer just contain a XML string. Instead it now looks like the following structure which can capture the information in the XML description without forcing XML to spread in the code base. I also included examples as to how Views could be constructed in C++.</div><div class=""><br class=""></div><div class="">Let me know what you think.</div><div class=""><br class=""></div><div class="">Bob</div><div class=""><br class=""></div><div class=""><div class="">#include <map></div><div class="">#include <vector></div><div class="">#include <string></div><div class=""><br class=""></div><div class="">class View</div><div class="">{</div><div class="">public:</div><div class=""> class Component</div><div class=""> {</div><div class=""> public:</div><div class=""> Component(const std::string &myName) : m_name(myName)</div><div class=""> {}</div><div class=""><br class=""></div><div class=""> ~Component()</div><div class=""> {</div><div class=""> for(std::size_t i = 0; i < this->m_children.size(); ++i)</div><div class=""> {</div><div class=""> delete this->m_children[i];</div><div class=""> }</div><div class=""> }</div><div class=""> </div><div class=""> const std::string &name() const</div><div class=""> {return this->m_name;}</div><div class=""> </div><div class=""> const std::string &contents() const</div><div class=""> {return this->m_contents;}</div><div class=""> void setContents(const std::string &c)</div><div class=""> {this->m_contents = c;}</div><div class=""><br class=""></div><div class=""> void setAttribute(const std::string &name, const std::string &value)</div><div class=""> {this->m_attributes[name] = value;}</div><div class=""><br class=""></div><div class=""> const std::string &attribute(const std::string &name)</div><div class=""> {return this->m_attributes[name];} // YES I know we need to see if the name is there first</div><div class=""> </div><div class=""> Component *addChild(const std::string &childName)</div><div class=""> {</div><div class=""> Component *c = new Component(childName);</div><div class=""> this->m_children.push_back(c);</div><div class=""> return c;</div><div class=""> }</div><div class=""> std::size_t numberOfChildren() const</div><div class=""> { return this->m_children.size();}</div><div class=""> Component *child(std::size_t i) const</div><div class=""> {return this->m_children[i];}</div><div class=""> </div><div class=""> protected:</div><div class=""> std::string m_name;</div><div class=""> std::string m_contents;</div><div class=""> std::map<std::string, std::string> m_attributes;</div><div class=""> std::vector<Component *> m_children;</div><div class=""> };</div><div class=""><br class=""></div><div class=""> View(const std::string &myType, const std::string &myTitle) : m_type(myType), m_title(myTitle)</div><div class=""> { this->m_details = new Component("Details");}</div><div class=""><br class=""></div><div class=""> ~View()</div><div class=""> {delete this->m_details;}</div><div class=""><br class=""></div><div class=""> const std::string &title() const</div><div class=""> {return this->m_title;}</div><div class=""><br class=""></div><div class=""> const std::string &type() const</div><div class=""> {return this->m_type;}</div><div class=""><br class=""></div><div class=""> Component *details() const</div><div class=""> {return this->m_details;}</div><div class=""> </div><div class="">protected:</div><div class=""> std::string m_title;</div><div class=""> std::string m_type;</div><div class=""> Component *m_details;</div><div class="">};</div><div class=""><br class=""></div><div class="">int main()</div><div class="">{</div><div class=""> View::Component *c;</div><div class=""> View sview("SimpleExpression", "Functions");</div><div class=""> sview.details()->setContents("PolyLinearFunction");</div><div class=""><br class=""></div><div class=""> View aview("Attribute", "BoundaryConditions");</div><div class=""> aview.details()->setAttribute("ModelEntityFilter", "f");</div><div class=""> aview.details()->addChild("SpecifiedHead");</div><div class=""> aview.details()->addChild("SpecifiedFlux");</div><div class=""> aview.details()->addChild("FlowInjectionWell");</div><div class=""> aview.details()->addChild("METData");</div><div class=""> aview.details()->addChild("GroundSurfaceHeatFlux");</div><div class=""> aview.details()->addChild("UseMETData");</div><div class=""> aview.details()->addChild("RayCaster");</div><div class=""> aview.details()->addChild("BottomBoundaryTemp");</div><div class=""><br class=""></div><div class=""> View iview("Instanced", "Time");</div><div class=""> c = iview.details()->addChild("Instance");</div><div class=""> c->setAttribute("Type", "Time");</div><div class=""> c->setContents("Time");</div><div class=""><br class=""></div><div class=""> View rview("Root", "SimBuilder");</div><div class=""> c = rview.details()->addChild("DefaultColor");</div><div class=""> c->setContents("1., 1., 0.5, 1.");</div><div class=""> c = rview.details()->addChild("InvalidColor");</div><div class=""> c->setContents("1., 0.5, 0.5, 1.");</div><div class=""> c = rview.details()->addChild("Views");</div><div class=""> c->addChild("Functions");</div><div class=""> c->addChild("BoundaryConditions");</div><div class=""> c->addChild("Time");</div><div class="">}</div></div><div class=""><br class=""></div><div class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Robert M. O'Bara, MEng.<br class="">Assistant Director of Scientific Computing<br class=""><br class="">Kitware Inc.<br class="">28 Corporate Drive<br class="">Suite 101<br class="">Clifton Park, NY 12065<br class=""><br class="">Phone: (518) 881- 4931</div><div class=""><br class=""></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""></div></body></html>