MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
federateTree.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2017 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include "rtiMsConfig.h"
13 #include "federationInfo.h"
14 #include <QTreeWidget>
15 #include <vlutil/vlString.h>
16 #include <vlutil/vlTime.h>
17 #include <vector>
18 #include <map>
19 #include <set>
20 
22 
24 { Q_OBJECT;
25 public:
26 
27  DtFederateTree( QWidget* parent );
28 
29  virtual ~DtFederateTree();
30 
31 public:
32 
34  virtual QSize sizeHint() const;
35 
37  virtual void hideEvent( QHideEvent* event );
38 
41  virtual bool updateFederation( const DtAssistantFederationInfo* federation,
42  const DtAssistantForwarderInfo* forwarderInfo,
43  const std::vector<DtAssistantForwarderInfo>& peerInfos);
44 
47  virtual bool removeFederation( const QString& name );
48 
50  virtual void removeAllFederations();
51 
53  virtual void updateFederationColor( const MAKRti::DtString& federationName, const QColor& color );
54 
57  virtual bool updateFederate( const DtAssistantFederateInfo& federate,
58  const DtAssistantForwarderInfo* forwarderInfo,
59  const QString& fedexName,
60  const std::vector<DtAssistantForwarderInfo>& peerInfos);
61 
66  virtual bool removeFederate( int federateHandle, const QString& fedexName,
67  bool clearedDefunct = false );
68 
70  virtual void displayLoadingIndication();
71 
73  virtual void removeLoadingIndication();
74 
76  bool isFederateValid( int federateHandle, const QString& fedexName ) const;
77 
79  void processInvalidList();
80 
83  QMenu* columnViewMenu() { return myColViewMenu; };
84 
87  QMenu* federateMenu() { return myFederateMenu; };
88 
91 
92  QAction* statisticsAction() { return myStatisticsAction; }
93  QAction* latencyTestAction() { return myLatencyTestAction; }
94  QAction* federateRidParamAction() { return myFederateRidParametersAction; }
95  QAction* federateFomAction() { return myFederateFomAction; }
96  QAction* federateLogAction() { return myFederateLogAction; }
97  QAction* changeFederateIconAction() { return myChangeFederateIconAction; }
98  QAction* resignFederateAction() { return myResignFederateAction; }
99 
101 
104  QMenu* federationMenu() { return myFederationMenu; };
105 
108 
109  QAction* federationFomAction() { return myFederationFomAction; }
110  QAction* syncPointsAction() { return myDisplaySyncPointsAction; }
111  QAction* destroyFederationAction() { return myDestroyFederationAction; }
112 
114 
117  void setFederateRemovalTime( float newTime );
118 
120  float getFederateRemovalTime() const;
121 
123  void enableDeletion( bool enable );
124 
126  QString getTreeFederationName( const MAKRti::DtString& federationName );
127 
129  void forceFederateSelection( int federateHandle, const MAKRti::DtString& federation );
130 
132  void forceFederationSelection( const MAKRti::DtString& federation );
133 
135  void forceClearSelection();
136 
138  void saveGuiConfiguration( const MAKRti::DtFilename& configFile );
139 
141  void loadGuiConfiguration( const MAKRti::DtFilename& configFile );
142 
143  void initializeQtToolTips();
144 
145 private:
146 
148  void clearDefunctFederate(QString fedexName, QTreeWidgetItem* federate);
149 
151  bool isFederateDefunct(QTreeWidgetItem* federate);
152 
153 protected:
154 
156  virtual void updateFederateItems( const DtFederateInfoByHandleMap& federates,
157  const DtAssistantForwarderInfo* forwarderInfo,
158  QTreeWidgetItem* fedexItem,
159  const std::vector<DtAssistantForwarderInfo>& peerInfos);
160 
162  virtual void updateFederateItem( const DtAssistantFederateInfo& federate,
163  const DtAssistantForwarderInfo* forwarderInfo,
164  const QString& fedexName, QTreeWidgetItem* fedItem,
165  const std::vector<DtAssistantForwarderInfo>& peerInfos);
166 
168  virtual void updateFederateItemFromForwarderInformation(
169  const DtAssistantFederateInfo& federate,
170  const DtAssistantForwarderInfo* forwarderInfo,
171  const QString& fedexName, QTreeWidgetItem* fedItem,
172  const std::vector<DtAssistantForwarderInfo>& peerInfos);
173 
174 
176  virtual void removeAllFederateItems( QTreeWidgetItem* fedexItem );
177 
181  virtual void removeFederateItem( QTreeWidgetItem* fedItem,
182  QTreeWidgetItem* fedexItem, bool clearedDefunct = false );
183 
185  bool isFederateValid( QTreeWidgetItem* item ) const;
186 
188  bool isFederateLocal( QTreeWidgetItem* item ) const;
189 
192  bool isFederateLightweight( QTreeWidgetItem* item ) const;
193 
196  bool isFederationLightweight( QTreeWidgetItem* item ) const;
197 
198 public:
199 
201  {
202  FederationNameIndex = 0,
203  FederateTypeAndHandleIndex = 0, // Shares column with federation name
220  NumFederateTreeCols
221  };
222 
224  QString theLoadingText;
225 
239 
241 
242 public slots:
243 
245  void showColumns();
246 
248  void setAllColumns( const std::map<QString, std::pair<int,bool> >& columns );
249 
251  void allColumns( std::map<QString, std::pair<int,bool> >& columns );
252 
254  void showColCustomizeDlg();
255 
257  void deleteSelectedFed();
258 
261  void destroySelectedFederations();
262 
264  void updateEnableNetworkTestingForSelectedFederations();
265 
267  void showLatencyTest();
268 
270  void clearAllDefunctFederates();
271 
273  bool hasValidFederates() const;
274 
276  void clearCurrDefunctFederates();
277 
279  void refreshMenus();
280 
282  void signalSelectionChange();
283 
285  void showContextMenu( const QPoint& );
286 
288  void copySelectionToClipboard();
289 
290 signals:
291 
292  void fedDeleteRequest( int, const QString& );
293  void federationDeleteRequest( const QString& fedexName );
294  void enableNetworkTestingRequest( const QString& );
295  void disableNetworkTestingRequest( const QString& );
296  void showFedLatencyTest( const QString&, int );
297 
299  void federateSelected( const MAKRti::DtString& federation, int federateHandle );
300 
302  void federationSelected( const MAKRti::DtString& name );
303 
305  void nothingSelected();
306 
308  void multipleItemsSelected();
309 
311  void defunctFederateRemoved( const MAKRti::DtString& federation, int federateHandle );
312 
313 private:
314 
316  DtFederateTree( const DtFederateTree& );
317 
319  DtFederateTree& operator = ( const DtFederateTree& );
320 
321 protected:
322 
323  static const int FederateNameRole;
324  static const int FederateHandleRole;
325  static const int TestEnableRole;
326  static const int IsLocalRole;
327  static const int IsLightweightRole;
328 
331  {
332  public:
333 
335  : shortName()
336  , longName()
337  , description()
338  , defaultSize(50)
339  {
340  }
341 
342  DtFederateTreeColDescr(const QString& s, const QString& l,
343  const QString& d, unsigned sz )
344  : shortName(s)
345  , longName(l)
346  , description(d)
347  , defaultSize(sz)
348  {
349  }
350 
352  {
353  }
354 
355  QString shortName;
356  QString longName;
357  QString description;
358  unsigned defaultSize;
359 
360  };
361 
363  std::vector<DtFederateTreeColDescr> myColumnDescrs;
364 
367 
369  std::vector<QAction*> myColDispActions;
371 
376 
388 
397 
400  QIcon myCheckIcon;
407  QIcon myTestIcon;
410 
412  std::map<QString,QString> myFederationNamesToItemNames;
413 
415  std::map<QString,QString> myItemNamesToFederationNames;
416 
422  std::map<QTreeWidgetItem*, std::pair<MAKRti::DtTime, std::pair<QString,int> > > myDefunctFederateTreeWidgets;
423 
425  std::map<QTreeWidgetItem*, std::pair<QString,int> > myReconnectingFederates;
426 
428  std::map<QTreeWidgetItem*, std::pair<QString,int> > myReconnectedFederates;
429 
431  std::set< std::pair<QString,int> > myClearedDefunctFederates;
432 
434  std::set<QTreeWidgetItem*> myTestDisabledFederations;
435 
437  std::map<MAKRti::DtString,QColor> myFederationColors;
438 
441 
444 
447 
448  MAKRti::DtClock myTimer;
449 
452 
455  static const int theLastColDefaultedOn;
456 
460 
461 };

Document ID: Generated on Fri Sep 27 00:57:56 EDT 2019 from SVN revision 201708
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)