#include <FieldElement.h>
Public Member Functions | |
FieldElement (Id parent, Id kid, const Cinfo *c, const string &name, const FieldElementFinfoBase *fef) | |
~FieldElement () | |
Element * | copyElement (Id newParent, Id newId, unsigned int n, bool toGlobal) const |
unsigned int | numData () const |
unsigned int | numLocalData () const |
Virtual: Returns number of data entries on current node. | |
unsigned int | localDataStart () const |
Virtual: Returns index of first data entry on this node. | |
unsigned int | numField (unsigned int rawIndex) const |
Virtual: Returns number of field entries for specified data. | |
unsigned int | totNumLocalField () const |
Virtual: Returns number of field entries on current node. | |
unsigned int | getNode (unsigned int dataId) const |
Virtual: Returns location of specified dataId. | |
unsigned int | startDataIndex (unsigned int node) const |
Virtual: Returns start DataIndex on specified node. | |
unsigned int | rawIndex (unsigned int dataId) const |
Virtual: Returns converted dataId to index on current node. | |
bool | hasFields () const |
bool | isGlobal () const |
Virtual. Returns true if global, ie, if its parent is global. | |
unsigned int | getNumOnNode (unsigned int node) const |
Inherited virtual. | |
char * | data (unsigned int rawIndex, unsigned int fieldIndex=0) const |
void | resize (unsigned int newNumData) |
void | resizeField (unsigned int rawIndex, unsigned int newNumField) |
void | zombieSwap (const Cinfo *zCinfo) |
Specialization of Element class, used to look up array fields within objects when those fields each need to have independent Element capabilies such as messaging and subfield lookup. Made automatically by Elements which have such fields.
FieldElement::FieldElement | ( | Id | parent, | |
Id | kid, | |||
const Cinfo * | c, | |||
const string & | name, | |||
const FieldElementFinfoBase * | fef | |||
) |
Referenced by copyElement().
FieldElement::~FieldElement | ( | ) |
Virtual func: leave the clearing of the messages to ElementBase, the data is cleared by the parent Element of this field.
Element * FieldElement::copyElement | ( | Id | newParent, | |
Id | newId, | |||
unsigned int | n, | |||
bool | toGlobal | |||
) | const [virtual] |
Virtual copier. Makes a copy of self.
Implements Element.
References Element::cinfo(), FieldElement(), and Element::getName().
char * FieldElement::data | ( | unsigned int | rawIndex, | |
unsigned int | fieldIndex = 0 | |||
) | const [virtual] |
virtual. Looks up specified field field entry. First it finds the appropriate data entry from the rawIndex. Then it looks up the field using the lookupField. Returns the data entry specified by the rawIndex, fieldIndex.
Note that the index is NOT a DataIndex: it is instead the raw index of the data on the current node. Index is also NOT the character offset, but the index to the data array in whatever type the data may be.
The DataIndex has to be filtered through the nodeMap to find a) if the entry is here, and b) what its raw index is.
Returns 0 if either index is out of range.
Implements Element.
References Element::data(), Id::element(), and FieldElementFinfoBase::lookupField().
Referenced by numField(), and resizeField().
unsigned int FieldElement::getNode | ( | unsigned int | dataId | ) | const [virtual] |
Virtual: Returns location of specified dataId.
Implements Element.
References Id::element(), and Element::getNode().
unsigned int FieldElement::getNumOnNode | ( | unsigned int | node | ) | const [virtual] |
Inherited virtual.
Implements Element.
References Id::element(), Element::isGlobal(), Shell::myNode(), and totNumLocalField().
bool FieldElement::hasFields | ( | ) | const [inline, virtual] |
Virtual: True if this is a FieldElement having an array of fields on each data entry. So true in this case.
Implements Element.
bool FieldElement::isGlobal | ( | ) | const [virtual] |
Virtual. Returns true if global, ie, if its parent is global.
Implements Element.
References Id::element(), and Element::isGlobal().
unsigned int FieldElement::localDataStart | ( | ) | const [virtual] |
Virtual: Returns index of first data entry on this node.
Implements Element.
References Id::element(), and Element::localDataStart().
unsigned int FieldElement::numData | ( | ) | const [virtual] |
Virtual: Returns number of data entries
Implements Element.
References Id::element(), and Element::numData().
unsigned int FieldElement::numField | ( | unsigned int | rawIndex | ) | const [virtual] |
Virtual: Returns number of field entries for specified data.
Implements Element.
References Element::data(), data(), Id::element(), and FieldElementFinfoBase::getNumField().
Referenced by totNumLocalField().
unsigned int FieldElement::numLocalData | ( | ) | const [virtual] |
Virtual: Returns number of data entries on current node.
Implements Element.
References Id::element(), and Element::numLocalData().
Referenced by totNumLocalField().
unsigned int FieldElement::rawIndex | ( | unsigned int | dataId | ) | const [virtual] |
Virtual: Returns converted dataId to index on current node.
Implements Element.
References Id::element(), and Element::rawIndex().
void FieldElement::resize | ( | unsigned int | newNumData | ) | [virtual] |
virtual Changes the number of entries in the data. Not permitted for FieldElements since they are just fields on the data.
Implements Element.
void FieldElement::resizeField | ( | unsigned int | rawIndex, | |
unsigned int | newNumField | |||
) | [virtual] |
virtual. Changes the number of fields on the specified data entry.
Implements Element.
References Element::data(), data(), Id::element(), and FieldElementFinfoBase::setNumField().
unsigned int FieldElement::startDataIndex | ( | unsigned int | node | ) | const [virtual] |
Virtual: Returns start DataIndex on specified node.
Implements Element.
References Id::element(), and Element::startDataIndex().
unsigned int FieldElement::totNumLocalField | ( | ) | const [virtual] |
Virtual: Returns number of field entries on current node.
Implements Element.
References numField(), and numLocalData().
Referenced by getNumOnNode().
void FieldElement::zombieSwap | ( | const Cinfo * | zCinfo | ) | [virtual] |
Virtual: after replacing Cinfo of parent, we need to replace Cinfo and fef here. The zCinfo is the new Cinfo for this FieldElement.
Reimplemented from Element.
References Cinfo::findFinfo(), Element::getName(), and Element::replaceCinfo().