void ReadCell::addChannelMessage( Id chan ) { /* * Get child objects of type Mstring, named addmsg1, 2, etc. * These define extra messages to be assembled at setup. * Similar to what was done with GENESIS. */ vector< Id > kids; Neutral::children( chan.eref(), kids ); Shell *shell = reinterpret_cast< Shell* >( Id().eref().data() ); Id cwe = shell->getCwe(); shell->setCwe( chan ); for ( vector< Id >::iterator i = kids.begin(); i != kids.end(); ++i ) { // Ignore kid if its name does not begin with "addmsg".. const string& name = i->element()->getName(); if ( name.find( "addmsg", 0 ) != 0 ) continue; string s = Field< string >::get( *i, "value" ); vector< string > token; tokenize( s, " ", token ); assert( token.size() == 4 ); ObjId src = shell->doFind( token[0] ); ObjId dest = shell->doFind( token[2] ); // I would like to assert, or warn here, but there are legitimate // cases where not all possible messages are actually available // to set up. So I just bail. if ( src.bad() || dest.bad()) { #ifndef NDEBUG /* cout << "ReadCell::addChannelMessage( " << chan.path() << "): " << name << " " << s << ": Bad src " << src << " or dest " << dest << endl; */ #endif continue; } ObjId mid = shell->doAddMsg( "single", src, token[1], dest, token[3] ); assert( !mid.bad()); } shell->setCwe( cwe ); }
Id::Id( const string& path, const string& separator ) { Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); assert( shell ); id_ = shell->doFind( path ).id.id_; }