VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simObjectListActivityCallbackInfo.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
6 #pragma once
7 
10 #include <tbb/mutex.h>
11 
12 #include <boost/shared_ptr.hpp>
13 
14 class DtLocalObject;
15 
17 typedef void(*DtSimObjectListActivityCallbackFcn)(const DtLocalObject* simObject,
18  void* usr);
19 
27 
29 {
30 public:
32  {
34  {
35  if (!a || !b)
36  {
38  return a < b;
39  }
40 
41  return (a->func() < b->func() ||
42  (a->func() == b->func() && a->usrData() < b->usrData()) ||
43  (a->func() == b->func() && a->usrData() == b->usrData() && a->filter() < b->filter()));
44  }
45  };
46 
49  DtSimObjectListActivityCallbackFcn func, void * usrData,
50  const DtObjectType & filter, bool invertFilter = false);
51 
54 
58 
62 
64  virtual DtSimObjectListActivityCallbackFcn func() const;
65 
67  virtual void * usrData() const;
68 
70  virtual const DtObjectType & filter() const;
71 
74  //filter
75  virtual bool invertFilter() const;
76 
77  virtual void setDeletedFlag(bool v);
78  virtual bool deletedFlag() const;
79 
81  {
82  return (myFunc == rhs.myFunc &&
83  myUsrData == rhs.myUsrData &&
84  myFilter == rhs.myFilter &&
85  myInvertFilter == rhs.myInvertFilter);
86  }
87 
89  {
90  return !(*this == rhs);
91  }
92 
94  {
95  if (myFunc < rhs.myFunc)
96  {
97  return true;
98  }
99  else if (myFunc == rhs.myFunc)
100  {
101  if (myUsrData < rhs.myUsrData)
102  {
103  return true;
104  }
105  else if (myUsrData == rhs.myUsrData)
106  {
107  if (myFilter < rhs.myFilter)
108  {
109  return true;
110  }
111  else if (myFilter == rhs.myFilter)
112  {
113  if (myInvertFilter < rhs.myInvertFilter)
114  {
115  return true;
116  }
117  }
118  }
119  }
120  return false;
121  }
122 
124  {
125  return !(*this < rhs);
126  }
127 
128  tbb::mutex& mutex() const
129  {
130  return *myMutex;
131  }
132 
133 protected:
134 
136  void * myUsrData;
137  DtObjectType myFilter;
139 
141  boost::shared_ptr<bool> myDeletedFlag;
142  boost::shared_ptr<tbb::mutex> myMutex;
143 };
144 
Definition: simObjectListActivityCallbackInfo.h:31
bool operator<(const DtSimObjectListActivityCallbackInfo &rhs) const
Definition: simObjectListActivityCallbackInfo.h:93
void(* DtSimObjectListActivityCallbackFcn)(const DtLocalObject *simObject, void *usr)
Callback function definition.
Definition: simObjectListActivityCallbackInfo.h:17
DtObjectType myFilter
Definition: simObjectListActivityCallbackInfo.h:137
void * myUsrData
Definition: simObjectListActivityCallbackInfo.h:136
virtual const DtObjectType & filter() const
Get the sim object type filter.
bool operator==(const DtSimObjectListActivityCallbackInfo &rhs) const
Definition: simObjectListActivityCallbackInfo.h:80
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
boost::shared_ptr< tbb::mutex > myMutex
Definition: simObjectListActivityCallbackInfo.h:142
virtual DtSimObjectListActivityCallbackFcn func() const
Get the callback function.
tbb::mutex & mutex() const
Definition: simObjectListActivityCallbackInfo.h:128
bool operator!=(const DtSimObjectListActivityCallbackInfo &rhs) const
Definition: simObjectListActivityCallbackInfo.h:88
virtual void * usrData() const
Get the user data.
class DtSimObjectListActivityCallbackInfo:
Definition: simObjectListActivityCallbackInfo.h:28
DtSimObjectListActivityCallbackFcn myFunc
Definition: simObjectListActivityCallbackInfo.h:135
bool myInvertFilter
Definition: simObjectListActivityCallbackInfo.h:138
bool operator>=(const DtSimObjectListActivityCallbackInfo &rhs) const
Definition: simObjectListActivityCallbackInfo.h:123
boost::shared_ptr< bool > myDeletedFlag
This is shared amongst representations such that when something is deleted, all copies of this get no...
Definition: simObjectListActivityCallbackInfo.h:141
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)