Ignore:
Timestamp:
Aug 28, 2009, 5:54:24 AM (15 years ago)
Author:
dkearney
Message:

updates to the object system, fixed up tree and xml parser objects, added some basic tests for them and adopted number object to accept xml text and configure itself from the parsed xml. added fermi3.cc example program which contains suggested interface from apps meeting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/objects/RpHistogram.cc

    r1528 r1560  
    315315
    316316const char *
    317 Histogram::xml()
    318 {
     317Histogram::xml(size_t indent, size_t tabstop)
     318{
     319    size_t l1width = indent + tabstop;
     320    size_t l2width = indent + (2*tabstop);
     321    const char *sp = "";
     322
    319323    Path p(path());
    320324
     
    327331
    328332    _tmpBuf.appendf(
    329 "<histogram id=\"%s\">\n\
    330     <about>\n\
    331         <group>%s</group>\n\
    332         <label>%s</label>\n\
    333         <description>%s</description>\n\
    334     </about>\n", p.id(),group(),label(),desc());
     333"%8$*5$s<histogram id=\"%1$s\">\n\
     334%8$*6$s<about>\n\
     335%8$*7$s<group>%2$s</group>\n\
     336%8$*7$s<label>%3$s</label>\n\
     337%8$*7$s<description>%4$s</description>\n\
     338%8$*6$s</about>\n",
     339        p.id(),group(),label(),desc(),indent,l1width,l2width,sp);
    335340
    336341    for (size_t dim=0; dim < dims(); dim++) {
     
    342347        }
    343348        _tmpBuf.appendf(
    344 "    <%s>\n\
    345         <label>%s</label>\n\
    346         <description>%s</description>\n\
    347         <units>%s</units>\n\
    348         <scale>%s</scale>\n",
     349"%8$*6$s<%1$s>\n\
     350%8$*7$s<label>%2$s</label>\n\
     351%8$*7$s<description>%3$s</description>\n\
     352%8$*7$s<units>%4$s</units>\n\
     353%8$*7$s<scale>%5$s</scale>\n",
    349354        tmpAxis->name(), tmpAxis->label(), tmpAxis->desc(),
    350         tmpAxis->units(), tmpAxis->scale());
     355        tmpAxis->units(), tmpAxis->scale(),l1width,l2width,sp);
    351356
    352357        if (_markerList != NULL) {
     
    355360                AxisMarker *m = (AxisMarker *) Rp_ChainGetValue(l);
    356361                if (strcmp(tmpAxis->name(),m->axisName()) == 0) {
    357                     _tmpBuf.append(m->xml());
     362                    _tmpBuf.append(m->xml(indent+tabstop,tabstop));
    358363                }
    359364                l = Rp_ChainNextLink(l);
    360365            }
    361366        }
    362         _tmpBuf.appendf("    </%s>\n",tmpAxis->name());
    363     }
    364 
    365     _tmpBuf.append("    <component>\n        <xhw>\n");
     367        _tmpBuf.appendf("%3$*2$s</%1$s>\n",tmpAxis->name(),l1width,sp);
     368    }
     369
     370    _tmpBuf.appendf("%3$*1$s<component>\n%3$*2$s<xhw>\n",l1width,l2width,sp);
    366371    for (size_t idx=0; idx < nmemb; idx++) {
    367372        for (size_t dim=0; dim < dims(); dim++) {
     
    370375        _tmpBuf.append("\n",1);
    371376    }
    372     _tmpBuf.append("        </xhw>\n    </component>\n</curve>");
    373     _tmpBuf.append("\0",1);
     377    _tmpBuf.appendf("%4$*3$s</xhw>\n%4$*2$s</component>\n%4$*1$s</curve>",
     378        indent,l1width,l2width,sp);
    374379
    375380    return _tmpBuf.bytes();
Note: See TracChangeset for help on using the changeset viewer.