/* Return number of bytes read. Return -1 on errors and EOF. */ PUBLIC ssize sslRead(Webs *wp, void *buf, ssize len) { Ms *ms; ssize bytes; if (len <= 0) { return -1; } bytes = innerRead(wp, buf, len); ms = (Ms*) wp->ssl; if (ms->more) { wp->flags |= SOCKET_BUFFERED_READ; socketReservice(wp->sid); } return bytes; }
/** * The readcell function implements the old GENESIS cellreader * functionality. */ Id ReadCell::read( const string& fileName, const string& cellName, Id parent ) { fileName_ = fileName; ifstream fin( fileName.c_str() ); if ( !fin ) { cerr << "ReadCell::read -- could not open file " << fileName << ".\n"; return Id(); } /* // Search for file in list of paths. PathUtility pathUtil( Property::getProperty( Property::SIMPATH ) ); ifstream fin( filename.c_str() ); for (unsigned int i = 0; i < pathUtil.size() && !fin; ++i ) { string path = pathUtil.makeFilePath(filename, i); fin.clear( ); fin.open( path.c_str() ); } if ( !fin ) { cerr << "ReadCell::read -- could not open file " << filename << endl; return Id(); } */ unsigned int size = 1; if ( parent.element()->cinfo()->isA( "Neuron" ) ) { cell_ = parent; currCell_ = cell_; } else { cell_ = shell_->doCreate( "Neuron", parent, cellName, size, MooseGlobal ); currCell_ = cell_; } if ( innerRead( fin ) ) { return cell_; } else { cerr << "Readcell failed.\n"; return Id(); } }
/** * The readcell function implements the old GENESIS cellreader * functionality. Although it is really a parser operation, I * put it here in Kinetics because the cell format is independent * of parser and is likely to remain a legacy for a while. */ Id ReadKkit::read( const string& filename, const string& modelname, Id pa, const string& methodArg ) { string method = methodArg; ifstream fin( filename.c_str() ); if (!fin){ cerr << "ReadKkit::read: could not open file " << filename << endl; return Id(); } if ( method.substr(0, 4) == "old_" ) { moveOntoCompartment_ = false; method = method.substr( 4 ); } Shell* s = reinterpret_cast< Shell* >( ObjId().data() ); Id mgr = makeStandardElements( pa, modelname ); assert( mgr != Id() ); baseId_ = mgr; basePath_ = mgr.path(); enzCplxMols_.resize( 0 ); innerRead( fin ); assignPoolCompartments(); assignReacCompartments(); assignEnzCompartments(); assignMMenzCompartments(); convertParametersToConcUnits(); s->doSetClock( 8, plotdt_ ); string plotpath = basePath_ + "/graphs/##[TYPE=Table]," + basePath_ + "/moregraphs/##[TYPE=Table]"; s->doUseClock( plotpath, "process", 8 ); setMethod( s, mgr, simdt_, plotdt_, method ); s->doReinit(); return mgr; }
/* Return number of bytes read. Return -1 on errors and EOF. */ PUBLIC ssize sslRead(Webs *wp, void *buf, ssize len) { Ms *ms; WebsSocket *sp; ssize bytes; if (len <= 0) { return -1; } bytes = innerRead(wp, buf, len); ms = (Ms*) wp->ssl; if (ms->more) { if ((sp = socketPtr(wp->sid)) != 0) { socketHiddenData(sp, ms->more, SOCKET_READABLE); } } return bytes; }