VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simComponentNetwork.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
14 #include <vlutil/vlList.h>
15 #include <list>
19 
20 class DtSimComponent;
21 class DtLocalObject;
22 class DtString;
24 class DtPortConnection;
28 class DtLocalObject;
29 
35 {
36 private:
38 
41  DtSimComponentNetwork& operator=(const DtSimComponentNetwork& orig);
43 
44 public:
45 
46 
47  DtSimComponentNetwork(DtLocalObject* vrfObject, DtComponentSystem* parentSystem);
48  virtual ~DtSimComponentNetwork();
49 
50  virtual bool init();
51 
52  virtual void tick(bool hostDestroyed);
53 
55  virtual bool postAddComponentsInit();
56 
57  virtual bool addSensorComponent(DtSimComponent * component);
58  virtual bool addControllerComponent(DtSimComponent * component);
59  virtual bool addActuatorComponent(DtSimComponent * component);
60 
64  virtual bool removeSensorComponent(DtSimComponent * component);
68  virtual bool removeControllerComponent(DtSimComponent * component);
72  virtual bool removeActuatorComponent(DtSimComponent * component);
73 
77  virtual DtSimComponent * lookupComponent(const DtString& name) const;
78 
81  virtual std::list<DtSimComponent*> lookupComponentsByType(const DtString & typeString);
82 
84  template <typename T_ComponentType>
85  std::list<DtSimComponent*> lookupComponentsByDynamicCast() const
86  {
87  std::list<DtSimComponent*> comps =
88  mySensorComponentList->lookupComponentsByDynamicCast<T_ComponentType>();
89  std::list<DtSimComponent*> appendControllers =
90  myControllerComponentList->lookupComponentsByDynamicCast<T_ComponentType>();
91  comps.splice(comps.end(), appendControllers);
92  std::list<DtSimComponent*> appendActuators =
93  myActuatorComponentList->lookupComponentsByDynamicCast<T_ComponentType>();
94  comps.splice(comps.end(), appendActuators);
95 
96  DtComponentSystemList::const_iterator itr = this->mySystemList.begin();
97  DtComponentSystemList::const_iterator end = this->mySystemList.end();
98  for(; itr != end; ++itr)
99  {
100  std::list<DtSimComponent*> append = (*itr)->componentNetwork()->
101  lookupComponentsByDynamicCast<T_ComponentType>();
102  comps.splice(comps.end(), append);
103  }
104 
105  return comps;
106  }
107 
109  virtual DtComponentSystem* lookupComponentSystem(const DtString& name) const;
110  virtual const DtComponentSystemList* componentSystemList() const;
111 
112  virtual DtSimComponentList * sensorComponentList() const;
113  virtual DtControllerComponentList * controllerComponentList() const;
114  virtual DtSimComponentList * actuatorComponentList() const;
115 
117  virtual int createComponentsFromList(
118  const DtComponentDescriptorList& descList, DtSimComponentList* destination,
119  int& priority, bool remoteOnly);
120 
128  virtual int createSystemsFromList(const DtComponentSystemDescriptorList& descList,
129  int& priority, bool remoteOnly);
130 
140  virtual bool createComponentConnection(const DtString& source,
141  const DtString& destination, int warningLevel = 1);
142 
146  virtual void createConnectionsFromList(const DtConnectionDescriptorList&
147  descList, bool suppressErrorMsgs = false);
148 
151  virtual void disconnectComponent(DtSimComponent *component);
152 
154  virtual void removeConnection(DtPortConnection* conn);
155 
158  virtual void removeConnection(DtPortGroupConnection* conn);
159 
161 
162  virtual void enable();
163  virtual void disable();
165 
167  virtual void clear();
168 
169  virtual void updateImgui();
170 
171 protected:
175  virtual bool createComponentConnection(DtSimComponent* sourceComp, const DtString& sourcePortName,
176  DtSimComponent* destComponent, const DtString& destPortName, DtString& errorString);
177 
178  virtual bool createSensorComponentList();
179  virtual bool createControllerComponentList();
180  virtual bool createActuatorComponentList();
181 
182 protected:
183 
184 
189 
192 };
Class Description: DtControllerComponentList.
Definition: controllerComponentList.h:38
DtLocalObject * myVrfObject
Definition: simComponentNetwork.h:190
DtControllerComponentList * myControllerComponentList
Definition: simComponentNetwork.h:186
A set of DtSimComponent and DtComponentSystem instances that are connected with a set of connections...
Definition: simComponentNetwork.h:34
A DtComponentSystem is a collection of DtSimComponents that are associated with each other...
Definition: componentSystem.h:35
List of DtComponentSystemDescriptor instances.
Definition: componentSystemDescriptorList.h:20
Instances of DtComponentDescriptorList are readable/writeable lists of DtComponentDescriptor objects...
Definition: componentDescriptorList.h:22
std::list< DtComponentSystem * > DtComponentSystemList
Definition: componentSystem.h:272
Class Description: DtSimComponentList.
Definition: simComponentList.h:28
A DtPortConnection represents a connection between a DtOutputPort and a DtInputPort. PortConnections can be either active or inactive. An active connection is a connection which is supplying data, while an inactive connection is not currently supplying data. Data must be passed through connections as DtPortData.
Definition: portConnection.h:29
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
std::list< DtSimComponent * > lookupComponentsByDynamicCast() const
Returns a list of DtSimComponents that can cast to the particular component type. ...
Definition: simComponentNetwork.h:85
const char * source
Definition: lz4.h:442
Instances of DtConnectionDescriptorList are readable/writeable lists of DtConnectionDescriptor object...
Definition: connectionDescriptorList.h:22
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
DtSimComponentList * mySensorComponentList
Definition: simComponentNetwork.h:185
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtSimComponentList * myActuatorComponentList
Definition: simComponentNetwork.h:187
Definition: portGroupConnection.h:25
DtComponentSystemList mySystemList
Definition: simComponentNetwork.h:188
DtComponentSystem * myParentSystem
Definition: simComponentNetwork.h:191
A locally simulated VRF object.
Definition: localObject.h:98

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)