VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sensorContactInfoList.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 #pragma once
11 
12 #include <readerWriter/rwList.h>
14 #include "vrfutil/vrfutilDefines.h"
15 #include "vrfutil/rwUUID.h"
16 
17 #include <set>
18 #include <unordered_map>
19 
21 class DtString;
23 
36 {
37 
38 public:
39 
42 
44  DtSensorContactInfoList(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL);
45  DtSensorContactInfoList(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL);
46 
48  virtual ~DtSensorContactInfoList() override;
49 
52 
54  DtReaderWriterRegistry* parentRegistry = NULL);
55 
57  DtReaderWriterRegistry* parentRegistry = NULL);
59 
64 
66 
67  virtual DtSensorContactInfoList* clone(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL) const;
68  virtual DtSensorContactInfoList* clone(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL) const;
70 
72  virtual void clear();
73 
75  virtual void removeAndDelete(DtRwSensorContactInfo* contactInfo);
76 
79  virtual DtListItem* add(DtRwSensorContactInfo* contactInfo);
80 
82  virtual void* remove(DtReaderWriter* data, DtListItem* item) override;
83 
87  virtual DtRwSensorContactInfo* findContactInfoByContact(const DtUUID& contact) const;
88 
91  virtual std::set<DtUUID> contacts() const;
92 
95  virtual const std::unordered_map<DtUUID, DtRwSensorContactInfo*>& contactsMap() const;
96 
105  virtual DtRwSensorContactInfo* createSensorContactInfo();
106 
111 
112  virtual void addModifiedCallback(DtNoArgumentCallbackList::DtCallbackFunctionType fcn, void* usr);
113  virtual void removeModifiedCallback(DtNoArgumentCallbackList::DtCallbackFunctionType fcn, void* usr);
115 
118  virtual void listModified();
119 
120  bool operator==(const DtSensorContactInfoList&) const;
121 
123  static const char* theXmlType();
124 
125  virtual const char* xmlType() const override
126  {
127  return theXmlType();
128  }
129 
130 protected:
131 
133  void copyList(const DtSensorContactInfoList& orig);
134 
137  void emptyList();
138 
141  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
142  const DtVariableBindingsList& variableBindings) override;
143 
147  virtual const char* readerWriterType() const override;
148 
150 
151 protected:
153  std::unordered_map<DtUUID, DtRwSensorContactInfo*> myContactsMap;
154 
155 };
156 
162 {
163 private:
165 
170 public:
173 
176  bool listChanged() const;
177 
180  void markUnchanged();
181 
184  bool checkAndResetListChanged();
185 
186 protected:
187  static void listChangedCallback(void* usr);
188  void processListChanged();
189 
192 };
193 
UUID is a unique ID wrapper class.
Definition: uuid.h:59
virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) override=0
This method must be overridden by a subclass. Within this method, new instances of the DtReaderWriter...
This class allows one to collect and compare strings using an index number instead of having to do st...
Definition: symbolString.h:27
A Readable, Writable version of DtList. This class cannot be used directly, but must be inherited to ...
Definition: rwList.h:26
void(* DtCallbackFunctionType)(void *)
The function signature of the callback function.
Definition: noArgumentCallbackList.h:155
DtSensorContactInfoList & myContactInfoList
Definition: sensorContactInfoList.h:190
static const char * theXmlType()
The type that is used when archiving to an XML stream.
Definition: readerWriter.h:85
Definition: readerWriterRegistry.h:39
Contains the DtUUID class declaration.
This class represents the data gathered by a sensor about a particular single sensor contact...
Definition: rwSensorContactInfo.h:68
A reader-writer list of DtRwSensorContactInfo elements. Use the DtRwList::add() and remove() methods ...
Definition: sensorContactInfoList.h:35
std::unordered_map< DtUUID, DtRwSensorContactInfo * > myContactsMap
A map for fast lookup of contacts in the list.
Definition: sensorContactInfoList.h:153
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
This class works just as DtCalllbackTable, but manages callbacks that have no arguments, and therefore don&#39;t fit in the template defined by DtCallbackList.
Definition: noArgumentCallbackList.h:151
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
virtual DtListItem * add(DtReaderWriter *data)
Add element to the end of the list. Returns the DtListItem envelope object that contains your new ele...
bool operator==(const DtRwList &rhs) const
Iterates over all items and calls the factory to compare.
This class is for monitoring a DtSensorContactInfoList for changes. When instantiated, this class registers a callback with the list, and maintains internal state as to whether the callback has been invoked since the last time listChanged() was called.
Definition: sensorContactInfoList.h:161
bool myListChanged
Definition: sensorContactInfoList.h:191
DtNoArgumentCallbackList myModifiedCallbackList
Definition: sensorContactInfoList.h:149
virtual const char * readerWriterType() const override
Used to supply a string type that this reader writer type is. This can be used in place of dynamic-ca...
const DtRwList & operator=(const DtRwList &orig)
Calls down to DtReaderWriter::operator=(). List elements are not copied.
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
virtual const char * xmlType() const override
Routines to archive/dearchive from an XML Environment.
Definition: sensorContactInfoList.h:125

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)