FEDEM Model Database  R8.0
Source code of the FEDEM model database
FmRingStart.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FM_RING_START_H
9 #define FM_RING_START_H
10 
12 #include <vector>
13 
14 
16 {
18 
19 public:
20  FmRingStart(const std::string& uistr, const char** pixmap = NULL,
21  bool doPrintHeader = false);
22  virtual ~FmRingStart() {}
23 
24  int getRingMemberType() const { return myRingMemberType; }
25  void setRingMemberType(const int aTypeID) { myRingMemberType = aTypeID; }
26 
27  const char* getUITypeName() const { return myUIString.c_str(); }
28  void setUITypeName(const std::string& name, const char** pixmap = NULL);
29  const char* getChildrenUITypeName() const;
30 
31  void printHeader(bool doPrint) { myPrintHeader = doPrint; }
32  bool printHeader() const { return myPrintHeader; }
33  virtual int countRingMembers() const;
34  virtual bool hasRingMembers(bool noChildren = false) const;
35  virtual void displayRingMembers() const;
36  virtual bool eraseRingMembers(bool showProgress = false);
37 
38  virtual std::string getItemDescr() const { return myUIString; }
39  virtual const char** getListViewPixmap() const { return myPixmap; }
40  void setListViewPixmap(const char** pixmap) { myPixmap = pixmap; }
41 
42  void setParent(FmRingStart* parent);
43  FmRingStart* getParent() const { return myParent; }
44  const std::vector<FmRingStart*>& getChildren() const { return myChildren; }
45 
46  virtual void getModelMembers(std::vector<FmModelMemberBase*>& list) const
47  { const_cast<FmRingStart*>(this)->getMembers(list); }
48 
49  template<class T> void getMembers(std::vector<T*>& list)
50  {
51  T* member = NULL;
52  for (FmBase* pt = this->getNext(); pt != this; pt = pt->getNext())
53  if ((member = dynamic_cast<T*>(pt))) list.push_back(member);
54  }
55 
56  virtual FmRingStart* searchFuncHead(int funcUse) const;
57 
58  virtual bool connect() { return false; }
59  virtual bool disconnect() { return false; }
60 
61  int getSortNumber() const { return mySortNumber; }
62 
63 protected:
64  void addChild(FmRingStart* child);
65 
66 private:
67  std::string myUIString;
68  const char** myPixmap;
70  std::vector<FmRingStart*> myChildren;
71 
72 protected:
74 
75 private:
76  bool myPrintHeader; //<! Should myUIString be used as a model file header?
77  int mySortNumber; //<! Number used as a stable order of the head map entries
78  //<! when needed, e.g., for write to model file.
79  //<! The number is incremented for each new object.
80 };
81 
82 #endif
Base class for all model data objects.
Base parent class for the model data structure entries.
Definition: FmBase.H:37
FmBase * getNext() const
Returns the next object in the linked list.
Definition: FmBase.H:44
Base class for all model data objects.
Definition: FmModelMemberBase.H:34
Definition: FmRingStart.H:16
const char ** myPixmap
Definition: FmRingStart.H:68
FmRingStart * myParent
Definition: FmRingStart.H:69
virtual bool hasRingMembers(bool noChildren=false) const
Definition: FmRingStart.C:39
void getMembers(std::vector< T * > &list)
Definition: FmRingStart.H:49
int getSortNumber() const
Definition: FmRingStart.H:61
virtual FmRingStart * searchFuncHead(int funcUse) const
Definition: FmRingStart.C:147
FmRingStart(const std::string &uistr, const char **pixmap=NULL, bool doPrintHeader=false)
Definition: FmRingStart.C:16
std::vector< FmRingStart * > myChildren
Definition: FmRingStart.H:70
virtual bool eraseRingMembers(bool showProgress=false)
Definition: FmRingStart.C:93
virtual std::string getItemDescr() const
Returns the description of this item.
Definition: FmRingStart.H:38
FmRingStart * getParent() const
Definition: FmRingStart.H:43
const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmRingStart.H:27
virtual bool connect()
Inserts this object into the model database.
Definition: FmRingStart.H:58
void setRingMemberType(const int aTypeID)
Definition: FmRingStart.H:25
virtual bool disconnect()
Removes this object from the model database.
Definition: FmRingStart.H:59
const char * getChildrenUITypeName() const
Definition: FmRingStart.C:123
virtual ~FmRingStart()
Definition: FmRingStart.H:22
virtual int countRingMembers() const
Definition: FmRingStart.C:52
int myRingMemberType
Definition: FmRingStart.H:73
void setListViewPixmap(const char **pixmap)
Definition: FmRingStart.H:40
void setParent(FmRingStart *parent)
Definition: FmRingStart.C:140
std::string myUIString
Definition: FmRingStart.H:67
const std::vector< FmRingStart * > & getChildren() const
Definition: FmRingStart.H:44
void addChild(FmRingStart *child)
Definition: FmRingStart.C:134
bool printHeader() const
Definition: FmRingStart.H:32
virtual void getModelMembers(std::vector< FmModelMemberBase * > &list) const
Definition: FmRingStart.H:46
void printHeader(bool doPrint)
Definition: FmRingStart.H:31
void setUITypeName(const std::string &name, const char **pixmap=NULL)
Definition: FmRingStart.C:32
bool myPrintHeader
Definition: FmRingStart.H:76
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmRingStart.H:39
virtual void displayRingMembers() const
Definition: FmRingStart.C:64
int mySortNumber
Definition: FmRingStart.H:77
int getRingMemberType() const
Definition: FmRingStart.H:24