本文整理汇总了C++中Eref::objId方法的典型用法代码示例。如果您正苦于以下问题:C++ Eref::objId方法的具体用法?C++ Eref::objId怎么用?C++ Eref::objId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eref
的用法示例。
在下文中一共展示了Eref::objId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: child
// static function
Id Neutral::child( const Eref& e, const string& name )
{
static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
static const FuncId pafid = pf2->getFid();
static const Finfo* cf = neutralCinfo->findFinfo( "childOut" );
static const SrcFinfo* cf2 = dynamic_cast< const SrcFinfo* >( cf );
static const BindIndex bi = cf2->getBindIndex();
const vector< MsgFuncBinding >* bvec = e.element()->getMsgAndFunc( bi );
vector< Id > ret;
for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin();
i != bvec->end(); ++i ) {
if ( i->fid == pafid ) {
const Msg* m = Msg::getMsg( i->mid );
assert( m );
Element* e2 = m->e2();
if ( e2->getName() == name ) {
if ( e.dataIndex() == ALLDATA ) {// Child of any index is OK
return e2->id();
} else {
ObjId parent = m->findOtherEnd( m->getE2() );
// If child is a fieldElement, then all parent indices
// are permitted. Otherwise insist parent dataIndex OK.
if ( e2->hasFields() || parent == e.objId() )
return e2->id();
}
}
}
}
return Id();
}
示例2: openEventData
/**
Populates the vector of event data buffers (vectors), vector of
event source objects, vector of event source fields and the vector
of event datasets by querying the messages on InputVariables.
*/
void NSDFWriter::openEventData(const Eref &eref)
{
if (filehandle_ <= 0){
return;
}
for (unsigned int ii = 0; ii < eventInputs_.size(); ++ii){
stringstream path;
path << eref.objId().path() << "/" << "eventInput[" << ii << "]";
ObjId inputObj = ObjId(path.str());
Element * el = inputObj.element();
const DestFinfo * dest = static_cast<const DestFinfo*>(el->cinfo()->findFinfo("input"));
vector < ObjId > src;
vector < string > srcFields;
el->getMsgSourceAndSender(dest->getFid(), src, srcFields);
if (src.size() > 1){
cerr << "NSDFWriter::openEventData - only one source can be connected to an eventInput" <<endl;
} else if (src.size() == 1){
eventSrcFields_.push_back(srcFields[0]);
eventSrc_.push_back(src[0].path());
events_.resize(eventSrc_.size());
stringstream path;
path << src[0].path() << "." << srcFields[0];
hid_t dataSet = getEventDataset(src[0].path(), srcFields[0]);
eventDatasets_.push_back(dataSet);
} else {
cerr <<"NSDFWriter::openEventData - cannot handle multiple connections at single input." <<endl;
}
}
}
示例3: getExpr
string Function::getExpr( const Eref& e ) const
{
if (!_valid){
cout << "Error: " << e.objId().path() << "::getExpr() - invalid parser state" << endl;
return "";
}
return _parser.GetExpr();
}
示例4: path
// Static function
string Neutral::path( const Eref& e )
{
static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
static const FuncId pafid = pf2->getFid();
vector< ObjId > pathVec;
ObjId curr = e.objId();
stringstream ss;
pathVec.push_back( curr );
while ( curr.id != Id() ) {
ObjId mid = curr.eref().element()->findCaller( pafid );
if ( mid == ObjId() ) {
cout << "Error: Neutral::path:Cannot follow msg of ObjId: " <<
e.objId() << " for func: " << pafid << endl;
break;
}
curr = Msg::getMsg( mid )->findOtherEnd( curr );
pathVec.push_back( curr );
}
if ( pathVec.size() <= 1 )
return "/";
for ( unsigned int i = 1; i < pathVec.size(); ++i ) {
ss << "/";
ObjId& oid = pathVec[ pathVec.size() - i - 1 ];
ss << oid.element()->getName();
if ( !oid.element()->hasFields() )
ss << "[" << oid.dataIndex << "]";
/*
if ( !oid.element()->hasFields() )
ss << "[" << oid.dataIndex << "]";
if ( oid.element()->numData() > 1 )
ss << "[" << oid.dataIndex << "]";
*/
}
// Append braces if Eref was for a fieldElement. This should
// work even if it is off-node.
if ( e.element()->hasFields() ) {
ss << "[" << e.fieldIndex() << "]";
}
return ss.str();
}
示例5: isDescendant
// static function
bool Neutral::isDescendant( Id me, Id ancestor )
{
static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
static const FuncId pafid = pf2->getFid();
Eref e = me.eref();
while ( e.element()->id() != Id() && e.element()->id() != ancestor ) {
ObjId mid = e.element()->findCaller( pafid );
assert( mid != ObjId() );
ObjId fid = Msg::getMsg( mid )->findOtherEnd( e.objId() );
e = fid.eref();
}
return ( e.element()->id() == ancestor );
}
示例6: destroy
//
// Stage 0: Check if it is a Msg. This is deleted by Msg::deleteMsg( ObjId )
// Stage 1: mark for deletion. This is done by setting cinfo = 0
// Stage 2: Clear out outside-going msgs
// Stage 3: delete self and attached msgs,
void Neutral::destroy( const Eref& e, int stage )
{
if ( e.element()->cinfo()->isA( "Msg" ) ) {
Msg::deleteMsg( e.objId() );
return;
}
vector< Id > tree;
Eref er( e.element(), ALLDATA );
unsigned int numDescendants = buildTree( er, tree );
/*
cout << "Neutral::destroy: id = " << e.id() <<
", name = " << e.element()->getName() <<
", numDescendants = " << numDescendants << endl;
*/
assert( numDescendants == tree.size() );
Element::destroyElementTree( tree );
}
示例7: setExpr
void Function::setExpr(const Eref& eref, string expr)
{
_valid = false;
_clearBuffer();
_varbuf.resize(_numVar);
// _pullbuf.resize(_num
mu::varmap_type vars;
try{
_parser.SetExpr(expr);
} catch (mu::Parser::exception_type &e) {
cerr << "Error setting expression on: " << eref.objId().path() << endl;
_showError(e);
_clearBuffer();
return;
}
// Force variable creation right away. Otherwise numVar does not
// get set properly
try{
_parser.Eval();
_valid = true;
} catch (mu::Parser::exception_type &e){
_showError(e);
}
}
示例8: parent
// Static function.
ObjId Neutral::parent( const Eref& e )
{
return Neutral::parent( e.objId() );
}
示例9: getObjId
ObjId Neutral::getObjId( const Eref& e ) const
{
return e.objId();
}