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

Base class for the template class FFaReference for guarded pointers. More...

#include <FFaReference.H>

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

Public Member Functions

 FFaReferenceBase ()
 The default constructor initializes the members. More...
 
virtual ~FFaReferenceBase ()
 The destructor clears the cross references. More...
 
bool setRef (FFaFieldContainer *ptr)
 Sets the pointer value from a FFaFieldContainer pointer directly. More...
 
void setRef (int objId, int typeId)
 Sets the unresolved id and type of the referred object. More...
 
void setRef (int objId, int typeId, const IntVec &assemblyIDs)
 Sets the unresolved id and type of object in a subassembly. More...
 
bool setPointerToNull ()
 Clears the reference. More...
 
void copy (const FFaReferenceBase &aReference, bool unresolve=false)
 A copy method mostly used by FFaFieldContainer::copy(). More...
 
FFaFieldContainer * getRef () const
 Returns the FFaFieldContainer pointer contained. More...
 
bool isResolved () const
 Returns whether this reference has been resolved or not. More...
 
bool isNull () const
 Returns whether this reference points to an actual object. More...
 
void setContextName (const char *name)
 Assigns the context name for this reference. More...
 
const char * getContextName () const
 Returns the context name used by this reference. More...
 
virtual int getRefClassTypeID () const
 Returns the type ID that this reference is supposed to refer to. More...
 
const char * getRefTypeName () const
 Returns the type name of the referred object. More...
 
int getRefTypeID () const
 Returns the type id of the referred object. More...
 
int getRefID () const
 Returns the id number of the referred object. More...
 
bool getRefAssemblyID (IntVec &assID) const
 Returns the assembly id array of the referred object. More...
 
void setPrintIfZero (bool doPrint)
 Flags whether this reference should be printed even if NULL. More...
 
bool printMeIfZero () const
 Returns if this reference should be printed even if NULL. More...
 
void write (std::ostream &os) const
 Writes the reference to specified output stream. More...
 
void read (std::istream &is)
 Reads the reference from specified input stream. More...
 

Protected Member Functions

void resolve (FFaSearcher &findCB)
 Finds the object that has matching Type and ID as read from file. More...
 
void unresolve ()
 Does the opposite of resolve. More...
 
void updateAssemblyRef (int from, int to, size_t ind=0)
 Updates the assembly reference when moving to another assembly. More...
 
void updateAssemblyRef (const IntVec &from, const IntVec &to)
 Updates the assembly reference when moving to another assembly. More...
 
bool isEqual (const FFaReferenceBase *p) const
 Checks for equality between two references. More...
 
void bind ()
 Tells the object this reference is pointing at that it is referred. More...
 
void unbind ()
 Tells the referred object that it is not being referred anymore. More...
 
void clearResolveRef ()
 Deletes the variable used to hold temporary ID information. More...
 

Private Types

using UnResolvedID = std::vector< int >
 Type of unique identification of the unresolved references. More...
 

Private Member Functions

 FFaReferenceBase (const FFaReferenceBase &)=delete
 Remove implicitly defined copy constructor. More...
 
FFaReferenceBase & operator= (const FFaReferenceBase &)=delete
 Remove implicitly defined assignment operator. More...
 
void zeroOut ()
 Only used by the FFaReferenceListBase to clean a ToRef. More...
 
void zeroOutOrRemoveFromList ()
 Only used by FFaFieldContainer to notify that it is obsolete. More...
 
void setOwnerReferenceList (FFaReferenceListBase *)
 Sets the FFaReferenceListBase that this reference is a member of. More...
 
FFaReferenceListBase * getOwnerReferenceList () const
 Returns the FFaReferenceListBase this reference is a member of. More...
 
void setOwnerFieldContainer (FFaFieldContainer *)
 Sets the FFaFieldContainer that this reference is a member of. More...
 
FFaFieldContainer * getOwnerFieldContainer () const
 Returns the FFaFieldContainer this reference is a member of. More...
 
void setRefID (int id)
 Convenience method used when reading from file. More...
 
void setRefTypeID (int id)
 Convenience method used when reading from file. More...
 
void setRefAssemblyID (const IntVec &assemblyID)
 Convenience method used when reading from file. More...
 

Private Attributes

bool IAmResolved
 false if we have an UnResolvedID object pointed to by myUnresolvedRef More...
 
bool IAmBound
 true if myPtr is pointing to a container, and the container knows it More...
 
bool IAmInAList
 true if this reference is maintained by a FFaReferenceList More...
 
union {
   FFaFieldContainer *   myOwnerObj
 Points to the owner object. More...
 
   FFaReferenceListBase *   myOwnerList
 Points to the owner reference list. More...
 
}; 
 Shared memory segment for alternative owner types. More...
 
union {
   FFaFieldContainer *   myPtr
 Points to the referred object when resolved. More...
 
   UnResolvedID *   myUnresolvedRef
 Id of referred object before resolving. More...
 
}; 
 Shared memory segment for pointers to resolved and unresolved data. More...
 
const char * myContextName
 Typically, this will be the variable name. More...
 
bool printIfZero
 If true, print the reference also when NULL. More...
 

Friends

class FFaFieldContainer
 Grants access to some private methods for resolving references. More...
 
class FFaReferenceListBase
 Grants access to some private methods for resolving references. More...
 

Detailed Description

Base class for the template class FFaReference for guarded pointers.

Requirements:

In the referred object we need a table with those who refer to it. In object that prints the connection, the connection needs to be in the field container.

Todo:
  • Find out how to do Type::getClassTypeID()
  • For each object in HeadTable
    • Set up topology references
  • Testing:
    • FFaReference
      • IO and resolving
        • With written Type
        • Without written Type
      • Destruction and pointer updating
      • Changing pointer on the fly
    • FFaReferenceList
      • IO and resolving
        • With written Type
        • Without written Type
      • Destruction and pointer updating (removal of reference)
      • List access and editing

Member Typedef Documentation

◆ UnResolvedID

using FFaReferenceBase::UnResolvedID = std::vector<int>
private

Type of unique identification of the unresolved references.

Constructor & Destructor Documentation

◆ FFaReferenceBase() [1/2]

FFaReferenceBase::FFaReferenceBase ( const FFaReferenceBase &  )
privatedelete

Remove implicitly defined copy constructor.

◆ FFaReferenceBase() [2/2]

FFaReferenceBase::FFaReferenceBase ( )

The default constructor initializes the members.

◆ ~FFaReferenceBase()

FFaReferenceBase::~FFaReferenceBase ( )
virtual

The destructor clears the cross references.

Member Function Documentation

◆ bind()

void FFaReferenceBase::bind ( )
protected

Tells the object this reference is pointing at that it is referred.

◆ clearResolveRef()

void FFaReferenceBase::clearResolveRef ( )
protected

Deletes the variable used to hold temporary ID information.

◆ copy()

void FFaReferenceBase::copy ( const FFaReferenceBase &  aReference,
bool  unresolve = false 
)

A copy method mostly used by FFaFieldContainer::copy().

◆ getContextName()

const char * FFaReferenceBase::getContextName ( ) const

Returns the context name used by this reference.

This method is used when doing topology browsing to know why a reference is referring to a certain FFaFieldContainer. Supposed to be set upon initialization when adding the reference to the book keeping in the FFaFieldContainer it is residing in. If this reference is a member of a FFaReferenceList, this method will return the context name of that FFaReferenceList.

See also
FFaReferenceListBase::setContextName
FFaReferenceListBase::getContextName

◆ getOwnerFieldContainer()

FFaFieldContainer * FFaReferenceBase::getOwnerFieldContainer ( ) const
private

Returns the FFaFieldContainer this reference is a member of.

This could also be the FFaFieldContainer of the FFaReferenceListBase that this reference is a member of.

◆ getOwnerReferenceList()

FFaReferenceListBase * FFaReferenceBase::getOwnerReferenceList ( ) const
private

Returns the FFaReferenceListBase this reference is a member of.

◆ getRef()

FFaFieldContainer * FFaReferenceBase::getRef ( ) const

Returns the FFaFieldContainer pointer contained.

◆ getRefAssemblyID()

bool FFaReferenceBase::getRefAssemblyID ( IntVec &  assID) const

Returns the assembly id array of the referred object.

If the reference is not resolved, the read assembly id returned.

◆ getRefClassTypeID()

virtual int FFaReferenceBase::getRefClassTypeID ( ) const
inlinevirtual

◆ getRefID()

int FFaReferenceBase::getRefID ( ) const

Returns the id number of the referred object.

If the reference is not resolved, the read id returned.

◆ getRefTypeID()

int FFaReferenceBase::getRefTypeID ( ) const

Returns the type id of the referred object.

◆ getRefTypeName()

const char * FFaReferenceBase::getRefTypeName ( ) const

Returns the type name of the referred object.

◆ isEqual()

bool FFaReferenceBase::isEqual ( const FFaReferenceBase *  p) const
protected

Checks for equality between two references.

◆ isNull()

bool FFaReferenceBase::isNull ( ) const
inline

Returns whether this reference points to an actual object.

◆ isResolved()

bool FFaReferenceBase::isResolved ( ) const
inline

Returns whether this reference has been resolved or not.

◆ operator=()

FFaReferenceBase& FFaReferenceBase::operator= ( const FFaReferenceBase &  )
privatedelete

Remove implicitly defined assignment operator.

◆ printMeIfZero()

bool FFaReferenceBase::printMeIfZero ( ) const
inline

Returns if this reference should be printed even if NULL.

◆ read()

void FFaReferenceBase::read ( std::istream &  is)

Reads the reference from specified input stream.

◆ resolve()

void FFaReferenceBase::resolve ( FFaSearcher &  findCB)
protected

Finds the object that has matching Type and ID as read from file.

This method sets up the pointer relation to the object with correct Type and ID compared to what was read from file.

◆ setContextName()

void FFaReferenceBase::setContextName ( const char *  name)
inline

Assigns the context name for this reference.

◆ setOwnerFieldContainer()

void FFaReferenceBase::setOwnerFieldContainer ( FFaFieldContainer *  owner)
private

Sets the FFaFieldContainer that this reference is a member of.

◆ setOwnerReferenceList()

void FFaReferenceBase::setOwnerReferenceList ( FFaReferenceListBase *  owner)
private

Sets the FFaReferenceListBase that this reference is a member of.

◆ setPointerToNull()

bool FFaReferenceBase::setPointerToNull ( )
inline

Clears the reference.

◆ setPrintIfZero()

void FFaReferenceBase::setPrintIfZero ( bool  doPrint)
inline

Flags whether this reference should be printed even if NULL.

◆ setRef() [1/3]

bool FFaReferenceBase::setRef ( FFaFieldContainer *  ptr)

Sets the pointer value from a FFaFieldContainer pointer directly.

Returns true if a new pointer value is assigned, otherwise false.

◆ setRef() [2/3]

void FFaReferenceBase::setRef ( int  objId,
int  typeId 
)

Sets the unresolved id and type of the referred object.

Must be resolved later. Can be used when reading the references in another way than through the read() method.

◆ setRef() [3/3]

void FFaReferenceBase::setRef ( int  objId,
int  typeId,
const IntVec &  assemblyIDs 
)

Sets the unresolved id and type of object in a subassembly.

◆ setRefAssemblyID()

void FFaReferenceBase::setRefAssemblyID ( const IntVec &  assemblyID)
private

Convenience method used when reading from file.

◆ setRefID()

void FFaReferenceBase::setRefID ( int  id)
private

Convenience method used when reading from file.

◆ setRefTypeID()

void FFaReferenceBase::setRefTypeID ( int  id)
private

Convenience method used when reading from file.

◆ unbind()

void FFaReferenceBase::unbind ( )
protected

Tells the referred object that it is not being referred anymore.

◆ unresolve()

void FFaReferenceBase::unresolve ( )
protected

Does the opposite of resolve.

◆ updateAssemblyRef() [1/2]

void FFaReferenceBase::updateAssemblyRef ( const IntVec &  from,
const IntVec &  to 
)
protected

Updates the assembly reference when moving to another assembly.

◆ updateAssemblyRef() [2/2]

void FFaReferenceBase::updateAssemblyRef ( int  from,
int  to,
size_t  ind = 0 
)
protected

Updates the assembly reference when moving to another assembly.

◆ write()

void FFaReferenceBase::write ( std::ostream &  os) const

Writes the reference to specified output stream.

◆ zeroOut()

void FFaReferenceBase::zeroOut ( )
private

Only used by the FFaReferenceListBase to clean a ToRef.

◆ zeroOutOrRemoveFromList()

void FFaReferenceBase::zeroOutOrRemoveFromList ( )
private

Only used by FFaFieldContainer to notify that it is obsolete.

Friends And Related Function Documentation

◆ FFaFieldContainer

friend class FFaFieldContainer
friend

Grants access to some private methods for resolving references.

◆ FFaReferenceListBase

friend class FFaReferenceListBase
friend

Grants access to some private methods for resolving references.

Member Data Documentation

◆ 

union { ... }

Shared memory segment for pointers to resolved and unresolved data.

◆ 

union { ... }

Shared memory segment for alternative owner types.

◆ IAmBound

bool FFaReferenceBase::IAmBound
private

true if myPtr is pointing to a container, and the container knows it

◆ IAmInAList

bool FFaReferenceBase::IAmInAList
private

true if this reference is maintained by a FFaReferenceList

◆ IAmResolved

bool FFaReferenceBase::IAmResolved
private

false if we have an UnResolvedID object pointed to by myUnresolvedRef

◆ myContextName

const char* FFaReferenceBase::myContextName
private

Typically, this will be the variable name.

◆ myOwnerList

FFaReferenceListBase* FFaReferenceBase::myOwnerList

Points to the owner reference list.

◆ myOwnerObj

FFaFieldContainer* FFaReferenceBase::myOwnerObj

Points to the owner object.

◆ myPtr

FFaFieldContainer* FFaReferenceBase::myPtr

Points to the referred object when resolved.

◆ myUnresolvedRef

UnResolvedID* FFaReferenceBase::myUnresolvedRef

Id of referred object before resolving.

◆ printIfZero

bool FFaReferenceBase::printIfZero
private

If true, print the reference also when NULL.


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