Id Class Reference

#include <Id.h>

List of all members.

Public Member Functions

 Id ()
 Id (unsigned int id)
 Id (const std::string &path, const std::string &separator="/")
 Id (const ObjId &oi)
 ~Id ()
void bindIdToElement (Element *e)
void destroy () const
std::string path (const std::string &separator="/") const
Elementelement () const
 Synonym for Id::operator()().
Eref eref () const
unsigned int value () const
bool operator== (const Id &other) const
bool operator!= (const Id &other) const
bool operator< (const Id &other) const
void zeroOut () const

Static Public Member Functions

static Id nextId ()
static unsigned int numIds ()
static Id str2Id (const std::string &s)
static std::string id2str (Id id)
static bool isValid (Id id)
static bool isValid (unsigned int id)
static void clearAllElements ()

Friends

ostream & operator<< (ostream &s, const Id &i)
istream & operator>> (istream &s, Id &i)

Detailed Description

This class manages id lookups for elements. Ids provide a uniform handle for every object, independent of which node they are located on.


Constructor & Destructor Documentation

Id::Id (  ) 

Returns the root Id

Referenced by Id(), and str2Id().

Id::Id ( unsigned int  id  ) 

Creates an id with the specified Element number

Id::Id ( const std::string &  path,
const std::string &  separator = "/" 
)

Returns an id found by traversing the specified path

References Shell::doFind(), ObjId::id, and Id().

Here is the call graph for this function:

Id::Id ( const ObjId oi  ) 

Downconverts an OjbId to an Id

Id::~Id (  )  [inline]

Destroys an Id. Doesn't do anything much.


Member Function Documentation

void Id::bindIdToElement ( Element e  ) 

The specified element is placed into current id.

void Id::clearAllElements (  )  [static]

Used to clean up all Elements when the simulation is terminated

Referenced by main().

void Id::destroy (  )  const

Cleanly deletes the associated Element, and zeroes out contents of elements vector at the location pointed to by this->id_.

Referenced by Cell::setupf(), testArith(), testFibonacci(), testLookupSetGet(), testMpiFibonacci(), testMsgSrcDestFields(), testSetGetExtField(), testSharedMsg(), and testShellParserStart().

Element * Id::element (  )  const

Synonym for Id::operator()().

Returns the Element pointed to by the id If it is off-node, returns an allocated wrapper element with postmaster and id information. Calling func has to free it. This wrapper element may also point to UNKNOWN NODE, in which case the master node IdManager has to figure out where it belongs. Returns 0 on failure. Deprecated. Element* operator()() const; Returns the Element pointed to by the Id. Perhaps cleaner to use than operator()() as it is an explicit function.

Here we work with a single big array of all ids. Off-node elements are represented by their postmasters. When we hit a postmaster we put the id into a special field on it. Note that this is horrendously thread-unsafe.

Todo:
: I need to replace the off-node case with a wrapper Element return. The object stored here will continue to be the postmaster, and when this is detected it will put the postmaster ptr and the id into the wrapper element. The wrapper's own id will be zero so it can be safely deleted. deprecated Element* Id::operator()() const { return elements()[ id_ ]; }

Referenced by Shell::adopt(), checkChildren(), SparseMsg::copy(), SingleMsg::copy(), OneToOneMsg::copy(), OneToOneDataIndexMsg::copy(), OneToAllMsg::copy(), DiagonalMsg::copy(), FieldElement::data(), Shell::doMove(), Element::dropAllMsgsFromSrc(), fillSegIndex(), NeuroMesh::filterSpines(), findMeshOfEnz(), findModelParent(), DiagonalMsg::findOtherEnd(), findParentComptOfReac(), FieldElement::getNode(), FieldElement::getNumOnNode(), Stoich::getProxyPools(), LookupField< L, A >::getVec(), innerCopyElements(), Shell::innerMove(), Stoich::installAndUnschedFunc(), Stoich::installAndUnschedFuncRate(), Stoich::installAndUnschedFuncReac(), isDoingReinit(), FieldElement::isGlobal(), Shell::isRunning(), FieldElement::localDataStart(), main(), FieldElement::numData(), FieldElement::numField(), FieldElement::numLocalData(), FieldElementFinfoBase::postCreationFunc(), FieldElement::rawIndex(), FieldElement::resizeField(), SrcFinfo2< T1, T2 >::sendTo(), SrcFinfo1< T >::sendTo(), ZombiePoolInterface::setCompartment(), Stoich::setCompartment(), Gsolve::setCompartment(), Stoich::setDsolve(), Ksolve::setDsolve(), Gsolve::setDsolve(), Stoich::setKsolve(), HSolve::setSeed(), ZombieReac::setSolver(), ZombieMMenz::setSolver(), ZombieFunction::setSolver(), ZombieEnz::setSolver(), Neuron::setSpineAndPsdMesh(), SteadyState::setStoich(), Ksolve::setStoich(), Gsolve::setStoich(), showFields(), FieldElement::startDataIndex(), test2ArgSetVec(), testAssortedMsg(), testCopy(), testCopyFieldElement(), testCreateMsg(), testFilterOffNodeTargets(), testGet(), testMsgField(), testMsgSrcDestFields(), testSendMsg(), testSendSpike(), testSetGet(), testSetGetDouble(), testSetGetVec(), testSharedMsg(), testStrGet(), testStrSet(), testTreeTraversal(), testTwoReacGetNeighbors(), tryParent(), ZombiePool::vSetSolver(), ZombieHHChannel::vSetSolver(), ZombieCompartment::vSetSolver(), and ZombieCaConc::vSetSolver().

Eref Id::eref (  )  const
string Id::id2str ( Id  id  )  [static]

Returns a string holding the ascii value of the id_ .

static bool Id::isValid ( unsigned int  id  )  [inline, static]
static bool Id::isValid ( Id  id  )  [inline, static]
Id Id::nextId (  )  [static]
unsigned int Id::numIds (  )  [static]

Returns the number of Ids in use.

bool Id::operator!= ( const Id other  )  const [inline]
bool Id::operator< ( const Id other  )  const [inline]
bool Id::operator== ( const Id other  )  const [inline]
string Id::path ( const std::string &  separator = "/"  )  const
Id Id::str2Id ( const std::string &  s  )  [static]

Returns an id whose value is string-converted from the specified string.

Static func to extract an id from a string. We need to accept ids out of the existing range, but it would be nice to have a heuristic on how outrageous the incoming value is.

References Id().

Here is the call graph for this function:

unsigned int Id::value (  )  const
void Id::zeroOut (  )  const

Used to clean out any specific Id.

Referenced by Element::~Element().


Friends And Related Function Documentation

ostream& operator<< ( ostream &  s,
const Id i 
) [friend]
istream& operator>> ( istream &  s,
Id i 
) [friend]

The documentation for this class was generated from the following files:

Generated on 1 Jul 2015 for MOOSE by  doxygen 1.6.1