本文整理汇总了C++中ObjId类的典型用法代码示例。如果您正苦于以下问题:C++ ObjId类的具体用法?C++ ObjId怎么用?C++ ObjId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buffers
/**
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;
}
}
}
示例2: warning
void Shell::doMove( Id orig, ObjId newParent )
{
if ( orig == Id() ) {
cout << "Error: Shell::doMove: Cannot move root Element\n";
return;
}
if ( newParent.element() == 0 ) {
cout << "Error: Shell::doMove: Cannot move object to null parent \n";
return;
}
if ( Neutral::isDescendant( newParent, orig ) ) {
cout << "Error: Shell::doMove: Cannot move object to descendant in tree\n";
return;
}
const string& name = orig.element()->getName();
if ( Neutral::child( newParent.eref(), name ) != Id() ) {
stringstream ss;
ss << "Shell::doMove: Object with same name already present: '"
<< newParent.path() << "/" << name << "'. Move failed.";
warning( ss.str() );
return;
}
SetGet2< Id, ObjId >::set( ObjId(), "move", orig, newParent );
// innerMove( orig, newParent );
}
示例3: remoteFieldGetVec
void remoteFieldGetVec( const Eref& e, unsigned int bindIndex,
vector< double >& getRecvBuf )
{
static ObjId oi( 3 );
static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
p->remoteFieldGetVec( e, bindIndex, getRecvBuf );
}
示例4: recvGet
void Shell::recvGet( const Eref& e, const Qinfo* q, PrepackedBuffer pb )
{
if ( myNode_ == 0 ) {
if ( gettingVector_ ) {
ObjId tgt = q->src();
// unsigned int linearIndex = q->src().eref().index().value();
unsigned int linearIndex =
tgt.element()->dataHandler()->linearIndex( tgt.dataId );
if ( linearIndex >= getBuf_.size() ) {
if ( linearIndex >= getBuf_.capacity() )
getBuf_.reserve( linearIndex * 2 );
getBuf_.resize( linearIndex + 1 );
}
assert ( linearIndex < getBuf_.size() );
double*& c = getBuf_[ linearIndex ];
c = new double[ pb.dataSize() ];
memcpy( c, pb.data(), pb.dataSize() * sizeof( double ) );
// cout << myNode_ << ":" << q->threadNum() << ": Shell::recvGet[" << linearIndex << "]= (" << pb.dataSize() << ", " << *c << ")\n";
} else {
assert ( getBuf_.size() == 1 );
double*& c = getBuf_[ 0 ];
c = new double[ pb.dataSize() ];
memcpy( c, pb.data(), pb.dataSize() * sizeof( double ) );
handleAck( 0, OkStatus );
}
++numGetVecReturns_;
}
}
示例5: remoteGetVec
void remoteGetVec( const Eref& e, unsigned int bindIndex,
vector< vector< double > >& getRecvBuf,
vector< unsigned int >& numOnNode )
{
static ObjId oi( 3 );
static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
p->remoteGetVec( e, bindIndex, getRecvBuf, numOnNode );
}
示例6: ObjId
ObjId OneToOneDataIndexMsg::findOtherEnd( ObjId f ) const
{
if ( f.element() == e1() )
return ObjId( e2()->id(), f.dataIndex );
else if ( f.element() == e2() )
return ObjId( e1()->id(), f.dataIndex );
return ObjId( 0, BADINDEX );
}
示例7: getCompt
// Utility function: return the compartment in which the specified
// object is located.
// Simply traverses the tree toward the root till it finds a
// compartment. Pools use a special msg, but this works for reacs too.
ObjId getCompt( Id id )
{
ObjId pa = Neutral::parent( id.eref() ).id;
if ( pa == ObjId() )
return pa;
else if ( pa.element()->cinfo()->isA( "ChemCompt" ) )
return pa;
return getCompt( pa );
}
示例8: setSurround
void EndoMesh::setSurround( const Eref& e, ObjId v )
{
if ( !v.element()->cinfo()->isA( "ChemCompt" ) ) {
cout << "Warning: 'surround' may only be set to an object of class 'ChemCompt'\n";
cout << v.path() << " is of class " << v.element()->cinfo()->name() << endl;
return;
}
surround_ = v;
parent_ = reinterpret_cast< const MeshCompt* >( v.data() );
}
示例9: ObjId
ObjId OneToAllMsg::findOtherEnd( ObjId f ) const
{
if ( f.element() == e1() ) {
if ( f.dataIndex == i1_ )
return ObjId( e2()->id(), 0 );
} else if ( f.element() == e2() ) {
return ObjId( e1()->id(), i1_ );
}
return ObjId( 0, BADINDEX );
}
示例10: dropMsgCallback
// static function, executed by the Synapse Element when a message is
// dropped from the Element. Contracts the parent synapse array to fit.
// Typically the SynHandler won't resize, easier to just leave an
// unused entry. Could even reuse if a synapse is added later, but all
// this policy is independent of the Synapse class.
void Synapse::dropMsgCallback(
const Eref& e, const string& finfoName,
ObjId msg, unsigned int msgLookup )
{
if ( finfoName == "addSpike" ) {
ObjId pa = Neutral::parent( e );
SynHandlerBase* sh =
reinterpret_cast< SynHandlerBase* >( pa.data() );
sh->dropSynapse( msgLookup );
}
}
示例11: ObjId
ObjId OneToAllMsg::findOtherEnd( ObjId f ) const
{
if ( f.id() == e1() ) {
if ( f.dataId == i1_ )
return ObjId( e2()->id(), 0 );
else
return ObjId( e2()->id(), DataId::bad() );
} else if ( f.id() == e2() ) {
return ObjId( e1()->id(), i1_ );
}
return ObjId::bad();
}
示例12: addMsgCallback
// static function, executed by the Synapse Element when a message is
// added to the Element. Expands the parent synapse array to fit.
void Synapse::addMsgCallback(
const Eref& e, const string& finfoName,
ObjId msg, unsigned int msgLookup )
{
if ( finfoName == "addSpike" ) {
ObjId pa = Neutral::parent( e );
SynHandlerBase* sh =
reinterpret_cast< SynHandlerBase* >( pa.data() );
unsigned int synapseNumber = sh->addSynapse();
SetGet2< unsigned int, unsigned int >::set(
msg, "fieldIndex", msgLookup, synapseNumber );
}
}
示例13: dispatchBuffers
void dispatchBuffers( const Eref& e, HopIndex hopIndex )
{
static ObjId oi( 3 );
static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
if ( Shell::numNodes() == 1 )
return;
if ( hopIndex.hopType() == MooseSetHop ||
hopIndex.hopType() == MooseGetHop ) {
p->dispatchSetBuf( e );
}
if ( hopIndex.hopType() == MooseSetVecHop ) {
p->dispatchSetBuf( e );
}
// More complicated stuff for get operations.
}
示例14:
void HDF5DataWriter::recvData(const Eref&e,
ObjId src, const double* start, unsigned int num )
{
string path = src.path();
if (nodemap_.find(path) == nodemap_.end()){
// first time call, initialize entries in map
hid_t dataid = get_dataset(path);
if (dataid < 0){
cerr << "Warning: could not create data set for " << path << endl;
}
nodemap_[path] = dataid;
datamap_[path] = vector<double>();
}
const double * end = start + num;
// append only the new data. old_size is guaranteed to be 0 on
// write and the table vecs will also be cleared.
datamap_[path].insert(datamap_[path].end(), start, end);
SetGet0::set(src, "clearVec"); //Unsure what this is for.
// #ifndef NDEBUG
// // debug leftover entries coming from table
// cout << "HDF5DataWriter::recvData: vec_size=" << vec_size << endl;
// cout << "HDF5DataWriter::recvData: dataSize=" << pb.dataSize() << endl;
// cout << "HDF5DataWriter::recvData: numEntries=" << pb.numEntries() << endl;
// cout << "HDF5DataWriter::recvData: size=" << pb.size() << endl;
// cout << "HDF5DataWriter::recvData: data()" << endl;
// for (int ii = 0; ii <= vec_size; ++ii){
// cout << ii << "\t" << pb.data()[ii] << endl;
// }
// #endif
}
示例15: parent
void Neutral::setName( const Eref& e, string name )
{
if ( e.id().value() <= 3 ) {
cout << "Warning: Neutral::setName on '" << e.id().path() <<
"'.Cannot rename core objects\n";
return;
}
ObjId pa = parent( e );
Id sibling = Neutral::child( pa.eref(), name );
if ( sibling == Id() ) { // OK, no existing object with same name.
e.element()->setName( name );
} else {
cout << "Warning: Neutral::setName: an object with the name '" <<
name << "'\n already exists on the same parent. Not changed\n";
}
}