VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simComponentList.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vlutil/vlString.h>
12 #include <vlutil/vlList.h>
13 #include <map>
14 #include <list>
15 #include <vector>
17 
18 class DtSimComponent;
20 
29 {
30 public:
32  DtSimComponentList(const DtString & name,
33  DtReaderWriterRegistry * const parentRegistry = 0);
34 
36  virtual ~DtSimComponentList();
37 
38  typedef std::vector<DtSimComponent*> ComponentListType;
39 
40  typedef ComponentListType::iterator iterator;
41  typedef ComponentListType::const_iterator const_iterator;
42 
46  virtual void tick(bool hostEntityDestroyed);
47 
48  virtual DtSimComponent * lookupComponent(const DtString & name);
49  virtual std::list<DtSimComponent*> lookupComponentsByType(const DtString & typeString);
50 
52  template <typename T_ComponentType>
53  std::list<DtSimComponent*> lookupComponentsByDynamicCast() const
54  {
55  std::list<DtSimComponent*> comps;
56 
57  DtSimComponentMap::const_iterator itr = this->myIndex.begin();
58  DtSimComponentMap::const_iterator mapEnd = this->myIndex.end();
59  while(itr != mapEnd)
60  {
61  if(dynamic_cast<T_ComponentType*>(itr->second) != nullptr)
62  {
63  comps.push_back(itr->second);
64  }
65  ++itr;
66  }
67 
68  return comps;
69  }
70 
71  virtual void addComponent(DtSimComponent * component);
72  virtual void removeComponent(DtSimComponent * component);
73 
74  virtual iterator begin();
75  virtual iterator end();
76  virtual size_t count() const;
77 
78 protected:
81 
84  virtual void emptyList();
85 
86 protected:
87 
88  typedef std::map<DtString, DtSimComponent*> DtSimComponentMap;
91 };
ComponentListType::const_iterator const_iterator
Definition: simComponentList.h:41
Definition: readerWriterRegistry.h:39
std::map< DtString, DtSimComponent * > DtSimComponentMap
Definition: simComponentList.h:88
Class Description: DtSimComponentList.
Definition: simComponentList.h:28
std::list< DtSimComponent * > lookupComponentsByDynamicCast() const
Returns a list of DtSimComponents that can cast to the particular component type. ...
Definition: simComponentList.h:53
DtSimComponentMap myIndex
Definition: simComponentList.h:90
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
std::vector< DtSimComponent * > ComponentListType
Definition: simComponentList.h:38
ComponentListType myComponentList
Definition: simComponentList.h:89
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
ComponentListType::iterator iterator
Definition: simComponentList.h:40

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)