|
FEDEM Model Database
R8.0
Source code of the FEDEM model database
|
Base class for the FEDEM model database structure. More...
#include <FFaFieldContainer.H>

Classes | |
| struct | FDictLess |
| Functor for comparison of dictionary entries. More... | |
Public Types | |
| using | FindCB = FFaDynCB4< FFaFieldContainer *&, int, int, const IntVec & > |
| Convenience alias for resolve call-backs. More... | |
Public Member Functions | |
| FFaFieldContainer () | |
| The default constructor does nothing. More... | |
| virtual | ~FFaFieldContainer () |
| The destructor clears the references to *this in myRefBy. More... | |
| bool | erase () |
| Deletes *this assuming it is heap-allocated. More... | |
| void | getFields (FieldMap &mapToFill) const |
| Builds a map of all fields in this FFaFieldContainer. More... | |
| FFaFieldBase * | getField (const std::string &fieldName) const |
| Returns the named field in this FFaFieldContainer. More... | |
| void | getReferredObjs (ObjectMap &mapToFill) const |
| Builds a map of all other objects referred to by *this. More... | |
| void | getReferringObjs (ObjectMap &mapToFill) const |
| Builds a map of all other objects referring to *this. More... | |
| void | getReferringObjs (ObjectVec &vecToFill, const std::string &contextName, bool sortOnId=false) const |
| Builds a list of FFaFieldContainer objects referring to *this. More... | |
| template<class T > | |
| void | getReferringObjs (std::vector< T * > &vecToFill, const std::string &context="", bool sortOnId=false) const |
| Builds a list of class T objects referring to *this. More... | |
| template<class T > | |
| bool | hasReferringObjs (T *&ptr, const std::string &context="") const |
| Checks if there are any references of type T to this object. More... | |
| void | releaseReferencesToMe (const std::string &contextName="", FFaFieldContainer *replacement=NULL) |
| Directly removes all references to this object. More... | |
| void | resolve (FindCB &findCB) |
| Resolves all FFaReferences and FFaReferenceLists in this object. More... | |
| void | unresolve () |
| Unresolves all FFaReferences and FFaReferenceLists in this object. More... | |
| virtual void | initAfterResolve () |
| Initializes the fields after resolve. More... | |
| virtual int | getResolvedID () const |
| Returns the user Id of *this, for use in I/O and resolving. More... | |
| virtual void | getResolvedAssemblyID (IntVec &) const |
| Gets the assembly path of *this, for use in I/O and resolving. More... | |
| void | updateReferences (int oldAssId, int newAssId) |
| Updates the assembly ID in the references in this object. More... | |
| void | updateReferences (const IntVec &oldAssId, const IntVec &newAssID) |
| Updates the assembly ID in the references in this object. More... | |
| bool | readField (const std::string &key, std::istream &is, bool datafieldsOnly=false) |
| Reads the value of a field named key from an input stream. More... | |
| bool | copy (const FFaFieldContainer *other, bool fieldsOnly=false, bool unresolve=false) |
| Copies all fields and references from another object into *this. More... | |
| bool | copyFields (const FFaFieldContainer *obj) |
| Copies all field values from another object into *this. More... | |
| bool | resetFields (const FFaFieldContainer *obj) |
| Resets fields to their default value. More... | |
Static Public Member Functions | |
| static void | removeDictInstance () |
| Removes the heap-allocated field name dictionary. More... | |
Protected Types | |
| using | FDict = std::set< std::string > |
| Convenience type alias, a set of text strings used as a dictionary. More... | |
| using | FDictIt = FDict::const_iterator |
| Convenience type alias, a const_iterator pointing into a dictionary. More... | |
| using | FieldContainerMap = std::map< FDictIt, FFaFieldBase *, FDictLess > |
| Convenience type alias, a field container map. More... | |
| using | FieldContainerDict = FFaSingelton< FDict, FFaFieldContainer > |
| Convenience type alias, a heap-allocated dictionary singelton. More... | |
Protected Member Functions | |
| virtual bool | eraseOptions () |
| Hook for class-specific tasks before deleting *this in erase(). More... | |
| void | addRef (FFaReferenceBase *ref) |
| Adds a reference to the internal book keeping of this object. More... | |
| void | addRefList (FFaReferenceListBase *list) |
| Adds a reference list to the internal book keeping of this object. More... | |
| void | addField (const std::string &identifier, FFaFieldBase *field) |
| Adds a field to the internal book keeping of this object. More... | |
| void | removeField (const std::string &identifier) |
| Removes the field from the internal book keeping of this object. More... | |
Protected Attributes | |
| FieldContainerMap | myFields |
| All data fields of this object. More... | |
Private Types | |
| using | IntVec = std::vector< int > |
| Convenience type alias. More... | |
| using | FieldMap = std::map< std::string, FFaFieldBase * > |
| Convenience type alias. More... | |
| using | ObjectMap = std::multimap< std::string, FFaFieldContainer * > |
| Convenience type alias. More... | |
| using | ObjectVec = std::vector< FFaFieldContainer * > |
| Convenience type alias. More... | |
| using | ReferenceSet = std::vector< FFaReferenceBase * > |
| Convenience type alias. More... | |
Private Member Functions | |
| void | insertInRefBy (FFaReferenceBase *ref) |
| Marks this object as referred to by another object. More... | |
| void | deleteFromRefBy (FFaReferenceBase *ref) |
| Unmarks this object as no longer referred to by another object. More... | |
| FFaFieldContainer * | getNext (const std::string &context, bool getFirst=false) const |
| Helper for template functions to loop over all objects in myRefBy. More... | |
Private Attributes | |
| ReferenceSet | myRefBy |
| List of all objects referring to *this. More... | |
| std::list< FFaReferenceBase * > | myRefTo |
| List of all objects *this is referring to. More... | |
| std::list< FFaReferenceListBase * > | myRefLists |
| List of all listed objects *this is referring to. More... | |
Friends | |
| class | FFaReferenceBase |
| Grants access to some private methods for resolving references. More... | |
Base class for the FEDEM model database structure.
This class contains the core of the model database structure. It manages FFaField, FFaReference and FFaReferenceList members in derived subclasses, and provides automated I/O, single and multiple guarded pointers.
|
protected |
Convenience type alias, a set of text strings used as a dictionary.
|
protected |
Convenience type alias, a const_iterator pointing into a dictionary.
|
protected |
Convenience type alias, a heap-allocated dictionary singelton.
|
protected |
Convenience type alias, a field container map.
|
private |
Convenience type alias.
| using FFaFieldContainer::FindCB = FFaDynCB4<FFaFieldContainer*&,int,int,const IntVec&> |
Convenience alias for resolve call-backs.
|
private |
Convenience type alias.
|
private |
Convenience type alias.
|
private |
Convenience type alias.
|
private |
Convenience type alias.
| FFaFieldContainer::FFaFieldContainer | ( | ) |
The default constructor does nothing.
|
virtual |
The destructor clears the references to *this in myRefBy.
|
protected |
Adds a field to the internal book keeping of this object.
|
protected |
Adds a reference to the internal book keeping of this object.
|
protected |
Adds a reference list to the internal book keeping of this object.
| bool FFaFieldContainer::copy | ( | const FFaFieldContainer * | other, |
| bool | fieldsOnly = false, |
||
| bool | unresolve = false |
||
| ) |
Copies all fields and references from another object into *this.
This method copies all fields, references and reference lists from the supplied FFaFieldContainer object *other into *this.
The big assumption is that the field containers are of the same type, and thus has the same number of references and in the same order.
If fieldsOnly is true only the current field values are copied, whereas the default values, references and reference list are not copied.
If unresolve is true, the references are copied but left unresolved, unless the ID is -1.
|
inline |
Copies all field values from another object into *this.
|
private |
Unmarks this object as no longer referred to by another object.
Used by FFaReferenceBase only.
This method removes the supplied reference from book keeping to notify this object that it is no longer pointed to by the reference. A part of the core of the FFaReference system.
| bool FFaFieldContainer::erase | ( | ) |
Deletes *this assuming it is heap-allocated.
|
inlineprotectedvirtual |
Hook for class-specific tasks before deleting *this in erase().
Reimplemented in FmTriad, FmSubAssembly, FmModelMemberBase, FmTurbine, FmSMJointBase, FmSimpleSensor, FmMMJointBase, FmIsPlottedBase, and Fm1DMaster.
| FFaFieldBase * FFaFieldContainer::getField | ( | const std::string & | fieldName | ) | const |
Returns the named field in this FFaFieldContainer.
| void FFaFieldContainer::getFields | ( | FieldMap & | mapToFill | ) | const |
Builds a map of all fields in this FFaFieldContainer.
The field identifier, which also is the keyword used in the model file, is used as key in the mapToFill.
|
private |
Helper for template functions to loop over all objects in myRefBy.
| void FFaFieldContainer::getReferredObjs | ( | ObjectMap & | mapToFill | ) | const |
Builds a map of all other objects referred to by *this.
The object pointers are accompanied by the context name the references have for the referred objects. The context names are used as key in mapToFill.
| void FFaFieldContainer::getReferringObjs | ( | ObjectMap & | mapToFill | ) | const |
Builds a map of all other objects referring to *this.
The object pointers are accompanied by the context name the references have for the referring objects. The context names are used as key in mapToFill.
| void FFaFieldContainer::getReferringObjs | ( | ObjectVec & | vecToFill, |
| const std::string & | contextName, | ||
| bool | sortOnId = false |
||
| ) | const |
Builds a list of FFaFieldContainer objects referring to *this.
This method gets the list of objects referring to this object with the context contextName. The list is sorted w.r.t. the ID if sortOnId is true. This is needed when the execution order is of importance. If the list is not sorted, the order might be different in two consecutive runs of the same model.
|
inline |
Builds a list of class T objects referring to *this.
|
inlinevirtual |
Gets the assembly path of *this, for use in I/O and resolving.
Reimplemented in FmBase.
|
inlinevirtual |
Returns the user Id of *this, for use in I/O and resolving.
Reimplemented in FmBase.
|
inline |
Checks if there are any references of type T to this object.
The pointer to the first object, if any, is returned in ptr.
|
inlinevirtual |
Initializes the fields after resolve.
Reimplemented in FmTriad, FmPart, FmVesselMotion, FmStraightMaster, FmSMJointBase, FmSimulationModelBase, FmSimulationEvent, FmSimpleSensor, FmRelativeSensor, FmMechanism, FmJointMotion, FmJointBase, FmHasDOFsBase, FmEngine, FmDofMotion, FmCurveSet, FmCtrlLine, FmcOutput, FmCamJoint, FmBeam, FmAxialSpring, FmAxialDamper, FmArcSegmentMaster, FmAnalysis, and Fm1DMaster.
|
private |
Marks this object as referred to by another object.
Used by FFaReferenceBase only.
This method inserts the supplied reference into the book keeping to notify this object that it is pointed to by the reference. A part of the core of the FFaReference system.
| bool FFaFieldContainer::readField | ( | const std::string & | key, |
| std::istream & | is, | ||
| bool | datafieldsOnly = false |
||
| ) |
Reads the value of a field named key from an input stream.
| void FFaFieldContainer::releaseReferencesToMe | ( | const std::string & | contextName = "", |
| FFaFieldContainer * | replacement = NULL |
||
| ) |
Directly removes all references to this object.
This method is used to make some (or all) of the references pointing to this object, point to the object replacement instead, if specified.
Only the references with the supplied contextName are changed, unless contextName is empty (then all references to the object will be changed).
|
inlinestatic |
Removes the heap-allocated field name dictionary.
|
protected |
Removes the field from the internal book keeping of this object.
| bool FFaFieldContainer::resetFields | ( | const FFaFieldContainer * | other | ) |
Resets fields to their default value.
Only the fields that are present in the supplied container *other are reset. This method therefore inverts the effect of the copy() method (with fieldsOnly = true).
| void FFaFieldContainer::resolve | ( | FindCB & | findCB | ) |
Resolves all FFaReferences and FFaReferenceLists in this object.
| void FFaFieldContainer::unresolve | ( | ) |
Unresolves all FFaReferences and FFaReferenceLists in this object.
Updates the assembly ID in the references in this object.
| void FFaFieldContainer::updateReferences | ( | int | oldAssId, |
| int | newAssId | ||
| ) |
Updates the assembly ID in the references in this object.
|
friend |
Grants access to some private methods for resolving references.
|
protected |
All data fields of this object.
|
private |
List of all objects referring to *this.
|
private |
List of all listed objects *this is referring to.
|
private |
List of all objects *this is referring to.