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

The base class for FFaReferenceList. More...

#include <FFaReferenceList.H>

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

Public Member Functions

void setAutoSizing (bool onOrOff)
 Sets the autoSizing flag. More...
 
bool isAutoSizing () const
 Returns the value of the autoSizing flag. More...
 
void setContextName (const char *name)
 Assigns the context name myContext for this reference. More...
 
const char * getContextName () const
 Returns the context name myContext used by this reference. More...
 
bool erase (int index)
 Erases entry index from the list, decrementing its size by one. More...
 
void clear ()
 Clears the reference list. More...
 
bool shuffle (size_t newFirst)
 Reorders the elements in the list. More...
 
void reverse ()
 Inverts the element order in the list. More...
 
void removePtr (const FFaFieldContainer *ptr)
 Removes all instances of ptr from this list. More...
 
void zeroOutPtr (const FFaFieldContainer *ptr)
 Sets all instances of ptr in this list to zero. More...
 
bool hasPtr (const FFaFieldContainer *ptr, int *index=NULL) const
 Returns true if ptr is present in the list. More...
 
void getBasePtrs (std::vector< FFaFieldContainer * > &toFill) const
 Fills provided vector with the non-NULL pointers in the list. More...
 
FFaFieldContainer * getBasePtr (int idx) const
 Returns the pointer to the idx'th member in the list. More...
 
size_t size () const
 Returns the length of myRefs,. More...
 
bool empty () const
 Returns true if myRefs is empty (zero length). More...
 
void write (std::ostream &os) const
 Writes the reference list to specified output stream. More...
 
void read (std::istream &is)
 Reads the reference list from specified input stream. More...
 

Protected Types

using FFaReferenceList = std::list< FFaReferenceBase * >
 Convenience type alias. More...
 

Protected Member Functions

 FFaReferenceListBase ()
 The default constructor initializes the members. More...
 
virtual ~FFaReferenceListBase ()
 The destructor clears the list. More...
 
void insertRefLast (FFaReferenceBase *ref)
 Appends a reference to the end of myRefs. More...
 
virtual FFaReferenceBase * createNewReference () const =0
 Virtual method for creating a FFaReference of correct type. More...
 
FFaReferenceList::const_iterator findPtr (const FFaFieldContainer *ptr) const
 Returns a const_iterator matching a FFaFieldContainer pointer. More...
 
FFaReferenceList::iterator findPtr (const FFaFieldContainer *ptr)
 Returns an iterator matching a FFaFieldContainer pointer. More...
 
FFaReferenceBase * getRefBase (int idx) const
 Returns the pointer at index idx. More...
 
void setOwnerOnRef (FFaReferenceBase *pt)
 Sets this list as the owner of the reference pt. More...
 
void copy (const FFaReferenceListBase *other, bool unresolve=false)
 Copy method used by copy constructors, etc. More...
 

Protected Attributes

FFaReferenceList myRefs
 The actual list of references. More...
 

Private Member Functions

 FFaReferenceListBase (const FFaReferenceListBase &)=delete
 Remove implicitly defined copy constructor. More...
 
FFaReferenceListBase & operator= (const FFaReferenceListBase &)=delete
 Remove implicitly defined assignment operator,. More...
 
void setOwnerFieldContainer (FFaFieldContainer *owner)
 Sets the FFaFieldContainer that this reference list is a member of. More...
 
FFaFieldContainer * getOwnerFieldContainer () const
 Returns the FFaFieldContainer this reference list is a member of. More...
 
void eraseReferenceIfNeeded (FFaReferenceBase *ref)
 Removes a reference from the list. More...
 
void resolve (FFaSearcher &findCB)
 Used after reading to translate IDs to actual pointers. 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...
 
void removePtr (const FFaFieldContainer *ptr, bool notifyContainer)
 Removes all instances of ptr from this list. More...
 
void zeroOutPtr (const FFaFieldContainer *ptr, bool notifyContainer)
 Sets all instances of ptr in this list to zero. More...
 

Private Attributes

FFaFieldContainer * myOwner
 Points to the owner object. More...
 
const char * myContext
 Typically, this will be the variable name. More...
 
bool autoSizing
 

Friends

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

Detailed Description

The base class for FFaReferenceList.

When autoSizing is true, the entries in the list are deleted when the object pointed to is deleted. Otherwise, the reference is set to zero.

The context name of a reference list is used when doing topological browsing to know why a reference is referring to a certain FFaFieldContainer object. It is supposed to be set upon initializing when adding the list to the book-keeping in the FFaFieldContainer object it resides in.

Member Typedef Documentation

◆ FFaReferenceList

Convenience type alias.

Constructor & Destructor Documentation

◆ FFaReferenceListBase() [1/2]

FFaReferenceListBase::FFaReferenceListBase ( const FFaReferenceListBase &  )
privatedelete

Remove implicitly defined copy constructor.

◆ FFaReferenceListBase() [2/2]

FFaReferenceListBase::FFaReferenceListBase ( )
inlineprotected

The default constructor initializes the members.

◆ ~FFaReferenceListBase()

virtual FFaReferenceListBase::~FFaReferenceListBase ( )
inlineprotectedvirtual

The destructor clears the list.

Member Function Documentation

◆ clear()

void FFaReferenceListBase::clear ( )

Clears the reference list.

◆ copy()

void FFaReferenceListBase::copy ( const FFaReferenceListBase *  other,
bool  unresolve = false 
)
protected

Copy method used by copy constructors, etc.

◆ createNewReference()

virtual FFaReferenceBase* FFaReferenceListBase::createNewReference ( ) const
protectedpure virtual

◆ empty()

bool FFaReferenceListBase::empty ( ) const
inline

Returns true if myRefs is empty (zero length).

◆ erase()

bool FFaReferenceListBase::erase ( int  index)

Erases entry index from the list, decrementing its size by one.

◆ eraseReferenceIfNeeded()

void FFaReferenceListBase::eraseReferenceIfNeeded ( FFaReferenceBase *  ref)
private

Removes a reference from the list.

This method is used by FFaReferenceBase to notify this container (which the FFaReferenceBase object is a member of), that it has been zeroed out due to the death of the FFaFieldContainer object it was referring to. Takes the auto-sizing mode into account (see autoSizing), it either does nothing, or deletes the reference.

◆ findPtr() [1/2]

std::list< FFaReferenceBase * >::iterator FFaReferenceListBase::findPtr ( const FFaFieldContainer *  ptr)
protected

Returns an iterator matching a FFaFieldContainer pointer.

◆ findPtr() [2/2]

std::list< FFaReferenceBase * >::const_iterator FFaReferenceListBase::findPtr ( const FFaFieldContainer *  ptr) const
protected

Returns a const_iterator matching a FFaFieldContainer pointer.

◆ getBasePtr()

FFaFieldContainer * FFaReferenceListBase::getBasePtr ( int  idx) const

Returns the pointer to the idx'th member in the list.

◆ getBasePtrs()

void FFaReferenceListBase::getBasePtrs ( std::vector< FFaFieldContainer * > &  toFill) const

Fills provided vector with the non-NULL pointers in the list.

◆ getContextName()

const char* FFaReferenceListBase::getContextName ( ) const
inline

Returns the context name myContext used by this reference.

◆ getOwnerFieldContainer()

FFaFieldContainer* FFaReferenceListBase::getOwnerFieldContainer ( ) const
inlineprivate

Returns the FFaFieldContainer this reference list is a member of.

◆ getRefBase()

FFaReferenceBase * FFaReferenceListBase::getRefBase ( int  idx) const
protected

Returns the pointer at index idx.

If idx is out of range, NULL is returned.

◆ hasPtr()

bool FFaReferenceListBase::hasPtr ( const FFaFieldContainer *  ptr,
int *  idx = NULL 
) const

Returns true if ptr is present in the list.

If idx is not NULL, *idx is set to the index of ptr within the list.

◆ insertRefLast()

void FFaReferenceListBase::insertRefLast ( FFaReferenceBase *  ref)
protected

Appends a reference to the end of myRefs.

◆ isAutoSizing()

bool FFaReferenceListBase::isAutoSizing ( ) const
inline

Returns the value of the autoSizing flag.

◆ operator=()

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

Remove implicitly defined assignment operator,.

◆ read()

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

Reads the reference list from specified input stream.

◆ removePtr() [1/2]

void FFaReferenceListBase::removePtr ( const FFaFieldContainer *  ptr)
inline

Removes all instances of ptr from this list.

◆ removePtr() [2/2]

void FFaReferenceListBase::removePtr ( const FFaFieldContainer *  ptr,
bool  notifyContainer 
)
private

Removes all instances of ptr from this list.

If notifyContainer is false, the reference is removed without decrementing the FFaFieldContainer it points to, telling that it no longer does so. This is to be used in cleanup during destruction of an FFaFieldContainer instance.

◆ resolve()

void FFaReferenceListBase::resolve ( FFaSearcher &  findCB)
private

Used after reading to translate IDs to actual pointers.

◆ reverse()

void FFaReferenceListBase::reverse ( )
inline

Inverts the element order in the list.

◆ setAutoSizing()

void FFaReferenceListBase::setAutoSizing ( bool  onOrOff)
inline

Sets the autoSizing flag.

◆ setContextName()

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

Assigns the context name myContext for this reference.

◆ setOwnerFieldContainer()

void FFaReferenceListBase::setOwnerFieldContainer ( FFaFieldContainer *  owner)
inlineprivate

Sets the FFaFieldContainer that this reference list is a member of.

◆ setOwnerOnRef()

void FFaReferenceListBase::setOwnerOnRef ( FFaReferenceBase *  pt)
inlineprotected

Sets this list as the owner of the reference pt.

◆ shuffle()

bool FFaReferenceListBase::shuffle ( size_t  newFirst)

Reorders the elements in the list.

This method reorders the elements such that the one pointed to by newFirst becomes the first member.

◆ size()

size_t FFaReferenceListBase::size ( ) const
inline

Returns the length of myRefs,.

◆ unresolve()

void FFaReferenceListBase::unresolve ( )
private

Does the opposite of resolve.

Makes references in list remove pointer binding to object, and replace it with the ID as reference instead.

◆ updateAssemblyRef() [1/2]

void FFaReferenceListBase::updateAssemblyRef ( const IntVec &  from,
const IntVec &  to 
)
private

Updates the assembly reference when moving to another assembly.

◆ updateAssemblyRef() [2/2]

void FFaReferenceListBase::updateAssemblyRef ( int  from,
int  to,
size_t  ind = 0 
)
private

Updates the assembly reference when moving to another assembly.

◆ write()

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

Writes the reference list to specified output stream.

◆ zeroOutPtr() [1/2]

void FFaReferenceListBase::zeroOutPtr ( const FFaFieldContainer *  ptr)
inline

Sets all instances of ptr in this list to zero.

◆ zeroOutPtr() [2/2]

void FFaReferenceListBase::zeroOutPtr ( const FFaFieldContainer *  ptr,
bool  notifyContainer 
)
private

Sets all instances of ptr in this list to zero.

If notifyContainer is false the reference is set to zero without decrementing the FFaFieldContainer it points to, to say that it no longer points on it. This is to be used in cleaning during destruction of an FFaFieldContainer instance.

Friends And Related Function Documentation

◆ FFaFieldContainer

friend class FFaFieldContainer
friend

Grants access to some private methods for resolving references.

◆ FFaReferenceBase

friend class FFaReferenceBase
friend

Grants access to some private methods for resolving references.

Member Data Documentation

◆ autoSizing

bool FFaReferenceListBase::autoSizing
private

Tells whether a reference in the list is deleted or set to zero when the referred object disappears

◆ myContext

const char* FFaReferenceListBase::myContext
private

Typically, this will be the variable name.

◆ myOwner

FFaFieldContainer* FFaReferenceListBase::myOwner
private

Points to the owner object.

◆ myRefs

FFaReferenceList FFaReferenceListBase::myRefs
protected

The actual list of references.


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