FEDEM Model Database  R8.0
Source code of the FEDEM model database
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes | List of all members
FmBase Class Reference

Base parent class for the model data structure entries. More...

#include <FmBase.H>

Inheritance diagram for FmBase:
Inheritance graph
[legend]
Collaboration diagram for FmBase:
Collaboration graph
[legend]

Public Types

enum  CopyMode {
  NOTHING , SHALLOW , DEEP_UNRESOLVED , DEEP_APPEND ,
  DEEP_REPLACE
}
 Enumerator for the different copying modes. More...
 
- Public Types inherited from FFaFieldContainer
using FindCB = FFaDynCB4< FFaFieldContainer *&, int, int, const IntVec & >
 Convenience alias for resolve call-backs. More...
 

Public Member Functions

FmBase * getNext () const
 Returns the next object in the linked list. More...
 
FmBase * getPrev () const
 Returns the previous object in the linked list. More...
 
virtual std::string getUserDescription (size_t maxLength=0) const
 Returns the user-defined description of this object. More...
 
virtual bool setUserDescription (const std::string &descr)
 Sets the user-defined description of this object. More...
 
bool makeCopyDescr ()
 Prepends "Copy of " to the user description. More...
 
virtual std::string getInfoString () const
 Returns a composed string describing this object. More...
 
virtual std::string getIdPath (bool withBrackets=true) const
 Returns the user ID including the sub-assembly path. More...
 
std::string getIdString (bool withDescription=false) const
 Returns a composed string describing this object. More...
 
int getID () const
 Returns the user ID of this object. More...
 
void setID (int Id)
 Sets the user ID of this object. More...
 
void getAssemblyID (IntVec &assID) const
 Retrieves the assembly ID of this object. More...
 
FmBase * getParentAssembly () const
 Returns the sub-assembly this object is part of, if any. More...
 
FmBase * getCommonAncestor (const FmBase *other) const
 Returns the sub-assembly both *this and *other descent from. More...
 
void setParentAssembly (FmBase *subAss)
 Sets the parent sub-assembly for this object. More...
 
void setParentAssembly (int Id, int classType=-1)
 Sets the parent sub-assembly for this object. More...
 
int getResolvedID () const final
 Returns the user Id of *this, for use in I/O and resolving. More...
 
void getResolvedAssemblyID (IntVec &assID) const final
 Gets the assembly path of *this, for use in I/O and resolving. More...
 
bool cloneOrConnect ()
 Inserts or copies this object into the model database. More...
 
virtual bool connect ()
 Inserts this object into the model database. More...
 
virtual bool disconnect ()
 Removes this object from the model database. More...
 
virtual void drawObject ()
 Visualization interface for objects that can be rendered. More...
 
bool isPartOf (const FmSubAssembly *subAss) const
 Returns true if *this is part of the specified sub-assembly. More...
 
std::ostream & writeFields (std::ostream &os) const
 Writes all data fields of this object to the given output stream. More...
 
virtual std::ostream & writeFMF (std::ostream &os)
 Writes out this object in the model database file format. More...
 
virtual bool clone (FmBase *, int)
 Copies the fields of another object into *this. More...
 
virtual FmBase * clone (int) const
 Returns an unconnected copy of this object. More...
 
virtual const char * getUITypeName () const
 Returns the type name of this object for use in the GUI. More...
 
virtual void onMainConnected ()
 Invokes call-backs after this object is inserted into the database. More...
 
virtual void onMainDisconnected ()
 Invokes call-backs after this object is removed from the database. More...
 
virtual void onMainAboutToDisconnect ()
 Invokes call-backs before this object is removed from the database. More...
 
- Public Member Functions inherited from FFaFieldContainer
 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...
 
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...
 

Protected Member Functions

 FmBase (bool isDummy=false)
 Default constructor. More...
 
virtual ~FmBase ()
 Empty destructor. More...
 
bool eraseOrConnect ()
 Conditionally inserts this object into the model database. More...
 
bool mainConnect (bool allowNonUniqueIDs=false)
 Inserts this object into the model database, unless aready present. More...
 
bool mainDisconnect ()
 Removes this object from the model database, if present. More...
 
void insertAfter (FmBase *afterPt)
 Inserts *this after *afterPt in the database ring. More...
 
virtual bool cloneLocal (FmBase *obj, int depth)
 Clones the data fields of *obj into *this. More...
 
- Protected Member Functions inherited from FFaFieldContainer
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...
 

Static Protected Member Functions

static bool localParse (const char *keyWord, std::istream &activeStatement, FmBase *obj)
 Parses the keyWord field for *obj, if it is a defined field. More...
 

Private Attributes

FFaField< std::string > myDescription
 User-defined description text. More...
 
FFaNoCopyField< int > myID
 User ID, unique only within one type. More...
 
FFaReference< FmBase > myParentAssembly
 Reference to the parent sub-assembly of this object, if any. More...
 
FFaField< FFaReferenceBase * > myParentAssemblyField
 Data field for the reference to the parent sub-assembly. More...
 
FmBase * itsNextRingPt
 Pointer to the next entry in the main ring. More...
 
FmBase * itsPrevRingPt
 Pointer to the previous entry in the main ring. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from FFaFieldContainer
static void removeDictInstance ()
 Removes the heap-allocated field name dictionary. More...
 
- Protected Types inherited from FFaFieldContainer
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 Attributes inherited from FFaFieldContainer
FieldContainerMap myFields
 All data fields of this object. More...
 

Detailed Description

Base parent class for the model data structure entries.

Very little functionality is included in this class. It is mostly concerned with the user ID and description, and pointers used for storing objects in the linked lists which constitute the model database.

Author
Jens LIEN

Member Enumeration Documentation

◆ CopyMode

Enumerator for the different copying modes.

Enumerator
NOTHING 

Don't copy any data fields.

SHALLOW 

Copy all data fields, but not the references.

DEEP_UNRESOLVED 

Also copy references, but leave them unresolved.

DEEP_APPEND 

Also copy and resolve references.

DEEP_REPLACE 

Also copy references, replacing existing ones.

Constructor & Destructor Documentation

◆ FmBase()

FmBase::FmBase ( bool  isDummy = false)
explicitprotected

Default constructor.

◆ ~FmBase()

FmBase::~FmBase ( )
protectedvirtual

Empty destructor.

Member Function Documentation

◆ clone() [1/2]

virtual bool FmBase::clone ( FmBase *  ,
int   
)
inlinevirtual

◆ clone() [2/2]

virtual FmBase* FmBase::clone ( int  ) const
inlinevirtual

Returns an unconnected copy of this object.

Reimplemented in FmSimulationModelBase, and FmResultBase.

◆ cloneLocal()

bool FmBase::cloneLocal ( FmBase *  obj,
int  depth 
)
protectedvirtual

Clones the data fields of *obj into *this.

This method tries to copy all fields of the cloned object into this object.

Returns
true if all of them have a matching field in this and false otherwise.

Reimplemented in FmTriad, FmSubAssembly, FmSimulationModelBase, FmResultBase, FmPart, FmModelMemberBase, FmLink, FmVesselMotion, FmUserDefinedElement, FmTransFriction, FmTire, FmStrainRosette, FmStraightMaster, FmSticker, FmSpringChar, FmSpringBase, FmSMJointBase, FmSimpleSensor, FmSensorBase, FmSeaState, FmRotFriction, FmRoad, FmRigidJoint, FmRevJoint, FmRelativeSensor, FmRefPlane, FmRackPinion, FmPrismJoint, FmPipeSurface, FmModesOptions, FmModelExpOptions, FmMMJointBase, FmMechanism, FmMathFuncBase, FmMaterialProperty, FmLoad, FmJointSpring, FmJointMotion, FmJointDamper, FmJointBase, FmIsRenderedBase, FmIsPositionedBase, FmIsPlottedBase, FmIsMeasuredBase, FmIsControlledBase, FmHPBase, FmHasDOFsBase, FmGraph, FmGlobalViewSettings, FmGenericDBObject, FmGear, FmGageOptions, FmfWaveSpectrum, FmfWaveSinus, FmfUserDefined, FmfStep, FmfSquarePuls, FmfSpline, FmfSmoothTraj, FmfSinusoidal, FmfScale, FmFrictionBase, FmFreeJoint, FmfRamp, FmFppOptions, FmfMultiVarBase, FmfMultiArgBase, FmfMathExpr, FmfLinVelVar, FmfLinVar, FmfLimRamp, FmFileReference, FmfExternalFunction, FmfDiracPuls, FmfDeviceFunction, FmfDelayedComplSinus, FmfConstant, FmfComplSinus, FmExternalCtrlSys, FmEngine, FmDofMotion, FmDofLoad, FmDamperBase, FmCylJoint, FmCurveSet, FmCtrlOutputElementBase, FmCtrlLine, FmCtrlInputElementBase, FmCtrlElementBase, FmcOutput, FmcInput, FmcTimeDelay, FmcSampleHold, FmcRealPole, FmcPower, FmcPlimIlimD, FmcPlimI, FmcPlimD, FmcPid, FmcPi, FmcPd, FmcPIlimD, FmcMultiplier, FmcLogicalSwitch, FmcLimitation, FmcLimDerivator, FmcIntegrator, FmcHysteresis, FmcDeadZone, FmcComparator, FmcCompConjPole, FmcAmplifier, FmcAdder, Fmc2ordTF, Fmc1ordTF, FmCamJoint, FmBladeProperty, FmBeamProperty, FmBeam, FmBallJoint, FmAxialSpring, FmAxialDamper, FmArcSegmentMaster, FmAnimation, FmAnalysis, FmAirState, and Fm1DMaster.

◆ cloneOrConnect()

bool FmBase::cloneOrConnect ( )

Inserts or copies this object into the model database.

This method is used from model file reading, but only for objects that might have been created before reading the model file. If the object to be connected (*this) already exists in the database, all data is copied (cloned) from this object into the found object. This object is then deleted.

◆ connect()

virtual bool FmBase::connect ( )
inlinevirtual

Inserts this object into the model database.

Reimplemented in FmResultBase, FmCurveSet, FmTimeSensor, FmSimulationEvent, and FmRingStart.

◆ disconnect()

virtual bool FmBase::disconnect ( )
inlinevirtual

Removes this object from the model database.

Reimplemented in FmTriad, FmSticker, FmRingStart, FmLoad, FmJointSpring, FmJointDamper, FmEngine, FmElementGroupProxy, FmDofMotion, FmDofLoad, FmCurveSet, and FmCtrlLine.

◆ drawObject()

virtual void FmBase::drawObject ( )
inlinevirtual

Visualization interface for objects that can be rendered.

Reimplemented in FmIsRenderedBase.

◆ eraseOrConnect()

bool FmBase::eraseOrConnect ( )
protected

Conditionally inserts this object into the model database.

This method should be used in place of connect(bool) for all objects that should be ignored when importing an existing model as a sub-assembly. Returns true if the object is successfully connected and false if it is erased or the connection failed.

◆ getAssemblyID()

void FmBase::getAssemblyID ( IntVec &  assID) const

Retrieves the assembly ID of this object.

The "live" path is returned if the model is resolved, and the read path if not.

The assembly path vector is ordered from top to bottom. <Root, sub,... , leaf>

◆ getCommonAncestor()

FmBase * FmBase::getCommonAncestor ( const FmBase *  other) const

Returns the sub-assembly both *this and *other descent from.

◆ getID()

int FmBase::getID ( ) const
inline

Returns the user ID of this object.

◆ getIdPath()

std::string FmBase::getIdPath ( bool  withBrackets = true) const
virtual

Returns the user ID including the sub-assembly path.

Reimplemented in FmElementGroupProxy.

◆ getIdString()

std::string FmBase::getIdString ( bool  withDescription = false) const

Returns a composed string describing this object.

Mainly used to refer to this object in Output List error messages, etc.

◆ getInfoString()

std::string FmBase::getInfoString ( ) const
virtual

Returns a composed string describing this object.

Mainly used to refer to this object in pulldown menus, etc.

Reimplemented in FmTimeSensor, FmSimpleSensor, FmRelativeSensor, FmMathFuncBase, FmEngine, and FmElementGroupProxy.

◆ getNext()

FmBase* FmBase::getNext ( ) const
inline

Returns the next object in the linked list.

◆ getParentAssembly()

FmBase* FmBase::getParentAssembly ( ) const
inline

Returns the sub-assembly this object is part of, if any.

◆ getPrev()

FmBase* FmBase::getPrev ( ) const
inline

Returns the previous object in the linked list.

◆ getResolvedAssemblyID()

void FmBase::getResolvedAssemblyID ( IntVec &  assID) const
finalvirtual

Gets the assembly path of *this, for use in I/O and resolving.

This method returns a vector of the ID's of the hierarchy of sub-assemblies containing this object. The input vector must be empty. It gets the resolved "live" assembly ID and returns nothing if the model is not resolved.

The "path" to this object: MainModel.SubAss.SubAss...SubAss

Reimplemented from FFaFieldContainer.

◆ getResolvedID()

int FmBase::getResolvedID ( ) const
inlinefinalvirtual

Returns the user Id of *this, for use in I/O and resolving.

Reimplemented from FFaFieldContainer.

◆ getUITypeName()

const char * FmBase::getUITypeName ( ) const
virtual

◆ getUserDescription()

std::string FmBase::getUserDescription ( size_t  maxLength = 0) const
virtual

Returns the user-defined description of this object.

If maxLength is non-zero, only the first maxLength characters are returned, or only the first line if that is shorter than maxLength.

Reimplemented in FmElementGroupProxy.

◆ insertAfter()

void FmBase::insertAfter ( FmBase *  afterPt)
protected

Inserts *this after *afterPt in the database ring.

◆ isPartOf()

bool FmBase::isPartOf ( const FmSubAssembly *  subAss) const

Returns true if *this is part of the specified sub-assembly.

◆ localParse()

bool FmBase::localParse ( const char *  keyWord,
std::istream &  activeStatement,
FmBase *  obj 
)
staticprotected

Parses the keyWord field for *obj, if it is a defined field.

◆ mainConnect()

bool FmBase::mainConnect ( bool  allowNonUniqueIDs = false)
protected

Inserts this object into the model database, unless aready present.

◆ mainDisconnect()

bool FmBase::mainDisconnect ( )
protected

Removes this object from the model database, if present.

◆ makeCopyDescr()

bool FmBase::makeCopyDescr ( )

Prepends "Copy of " to the user description.

◆ onMainAboutToDisconnect()

virtual void FmBase::onMainAboutToDisconnect ( )
inlinevirtual

Invokes call-backs before this object is removed from the database.

Reimplemented in FmModelMemberBase.

◆ onMainConnected()

virtual void FmBase::onMainConnected ( )
inlinevirtual

Invokes call-backs after this object is inserted into the database.

Reimplemented in FmModelMemberBase.

◆ onMainDisconnected()

virtual void FmBase::onMainDisconnected ( )
inlinevirtual

Invokes call-backs after this object is removed from the database.

Reimplemented in FmModelMemberBase.

◆ setID()

void FmBase::setID ( int  Id)
inline

Sets the user ID of this object.

◆ setParentAssembly() [1/2]

void FmBase::setParentAssembly ( FmBase *  subAss)

Sets the parent sub-assembly for this object.

◆ setParentAssembly() [2/2]

void FmBase::setParentAssembly ( int  Id,
int  classType = -1 
)

Sets the parent sub-assembly for this object.

◆ setUserDescription()

bool FmBase::setUserDescription ( const std::string &  descr)
virtual

Sets the user-defined description of this object.

Reimplemented in FmElementGroupProxy.

◆ writeFields()

std::ostream & FmBase::writeFields ( std::ostream &  os) const

Writes all data fields of this object to the given output stream.

◆ writeFMF()

virtual std::ostream& FmBase::writeFMF ( std::ostream &  os)
inlinevirtual

Writes out this object in the model database file format.

Reimplemented in FmTriad, FmSubAssembly, FmPart, FmVesselMotion, FmUserDefinedElement, FmBlade, FmRotor, FmShaft, FmGearBox, FmGenerator, FmNacelle, FmTower, FmTurbine, FmTransFriction, FmTire, FmStructAssembly, FmStrainRosette, FmStraightMaster, FmSticker, FmSpringChar, FmSoilPile, FmSimulationEvent, FmSimpleSensor, FmSeaState, FmRotFriction, FmRoad, FmRiser, FmRigidJoint, FmRevJoint, FmRelativeSensor, FmRefPlane, FmRackPinion, FmPrismJoint, FmPrismaticFriction, FmPipeSurface, FmPipeStringDataExporter, FmModesOptions, FmModelExpOptions, FmMechanism, FmMaterialProperty, FmLoad, FmJointSpring, FmJointMotion, FmJointDamper, FmJacket, FmGraph, FmGlobalViewSettings, FmGenericDBObject, FmGear, FmGageOptions, FmfWaveSpectrum, FmfWaveSinus, FmfUserDefined, FmfStep, FmfSquarePuls, FmfSpline, FmfSmoothTraj, FmfSinusoidal, FmfScale, FmFreeJoint, FmfRamp, FmFppOptions, FmfMathExpr, FmfLinVelVar, FmfLinVar, FmfLimRamp, FmFileReference, FmfExternalFunction, FmfDiracPuls, FmfDeviceFunction, FmfDelayedComplSinus, FmfConstant, FmfComplSinus, FmExternalCtrlSys, FmEngine, FmElementGroupProxy, FmDofMotion, FmDofLoad, FmCylJoint, FmCurveSet, FmCtrlLine, FmcOutput, FmcInput, FmcTimeDelay, FmcSampleHold, FmcRealPole, FmcPower, FmcPlimIlimD, FmcPlimI, FmcPlimD, FmcPid, FmcPi, FmcPd, FmcPIlimD, FmcMultiplier, FmcLogicalSwitch, FmcLimitation, FmcLimDerivator, FmcIntegrator, FmcHysteresis, FmcDeadZone, FmcComparator, FmcCompConjPole, FmcAmplifier, FmcAdder, Fmc2ordTF, Fmc1ordTF, FmCamJoint, FmCamFriction, FmBladeDesign, FmBladeProperty, FmBearingFriction, FmBeamProperty, FmBeam, FmBallJoint, FmAxialSpring, FmAxialDamper, FmArcSegmentMaster, FmAnimation, FmAnalysis, and FmAirState.

Member Data Documentation

◆ itsNextRingPt

FmBase* FmBase::itsNextRingPt
private

Pointer to the next entry in the main ring.

◆ itsPrevRingPt

FmBase* FmBase::itsPrevRingPt
private

Pointer to the previous entry in the main ring.

◆ myDescription

FFaField<std::string> FmBase::myDescription
private

User-defined description text.

◆ myID

FFaNoCopyField<int> FmBase::myID
private

User ID, unique only within one type.

◆ myParentAssembly

FFaReference<FmBase> FmBase::myParentAssembly
private

Reference to the parent sub-assembly of this object, if any.

◆ myParentAssemblyField

FFaField<FFaReferenceBase*> FmBase::myParentAssemblyField
private

Data field for the reference to the parent sub-assembly.


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