bool wb_recix::add_object_ctree( wb_object &o) { add( o.longName().c_str(), o.oid().oix); for ( wb_object ch = o.first(); ch; ch = ch.after()) add_object_tree( ch); return true; }
static void process( wb_session& session, wb_object& o) { pwr_sPlcNode plcnode; if ( o.cid() == pwr_cClass_csub) { printf ( "Object: %s\n", o.longName().c_str()); wb_attribute a = session.attribute( o.oid(), "DevBody", "PlcNode"); if ( !a) exit(0); a.value( &plcnode); printf( "subwindow: %d, woid: %u,%u\n", plcnode.subwindow, plcnode.subwind_oid[0].vid, plcnode.subwind_oid[0].oix); wb_object c = o.first(); if ( c && c.cid() == pwr_cClass_windowplc) { plcnode.subwind_oid[0].vid = c.oid().vid; plcnode.subwind_oid[0].oix = c.oid().oix; printf( "subwindow: %d, woid: %u,%u\n", plcnode.subwindow, plcnode.subwind_oid[0].vid, plcnode.subwind_oid[0].oix); session.writeAttribute( a, &plcnode, sizeof(plcnode)); if ( !a) cout << "** Write error" << endl; } } for ( wb_object c = o.first(); c.oddSts(); c = c.after()) { process( session, c); } }
bool wb_recix::add_object_tree( wb_object &o) { clear(); wb_object p = o.parent(); if ( p) strcpy( m_srcroot, p.longName().c_str()); add( o.longName().c_str(), o.oid().oix); for ( wb_object ch = o.first(); ch; ch = ch.after()) add_object_ctree( ch); // for ( ix_iterator it = m_ix.begin(); it != m_ix.end(); it++) { // cout << " Object: " << it->second << " " << it->first << endl; // } return true; }