Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoNodeDependencies.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : T. ANDRIEU (AUG 2014)
22**=======================================================================*/
23
24
25#ifndef _SO_CACHE_OBJECT
26#define _SO_CACHE_OBJECT
27
28#include <Inventor/caches/SoCache.h>
29#include <Inventor/misc/SoRefCounter.h>
30#include <Inventor/sensors/SoFieldSensor.h>
31
32#if defined(_WIN32)
33#pragma warning(push)
34#pragma warning(disable: 4251) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
35#endif
36
51{
52public:
54
56
58 bool isValid(SoState* state) const;
59
64 void updateCache(SoState* state);
65
69 void invalidate();
70
75 template <typename SO_ELEMENT>
77 {
78 addDependency( SO_ELEMENT::getClassTypeId(), SO_ELEMENT::getClassStackIndex() );
79 }
80
84 void addDependency( SoField& field );
85
87 void addDependency(SoType type, int classStackIndex);
88
89private:
90 struct CachedElement
91 {
92 CachedElement(SoType& type_, int classStackIndex_) : type(type_), classStackIndex(classStackIndex_) {}
93 SoType type; // type of element
94 int classStackIndex; // stackIndex of element in state cache stack.
95 };
96
102 std::vector<CachedElement> m_elementsDependencies;
103
105 std::vector<SoFieldSensor*> m_fieldSensors;
106
108 bool m_fieldsValid;
109
111 static void fieldSensorCB( void* data, SoSensor* sensor );
112
113 SoRef<SoCache> m_cache;
114
115 mutable SbThreadSpinlock m_mutex;
116};
117
118#if defined(_WIN32)
119#pragma warning(pop)
120#endif
121
122#endif /* _SO_CACHE_OBJECT */
123
124
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable spinloc...
Base class for all fields.
Definition SoField.h:234
This class is a cache handler that can be used to monitor the modifications made to elements or field...
void addDependency(SoType type, int classStackIndex)
Add given element type as a dependency for the cache.
void invalidate()
Manually invalidate the cache.
void updateCache(SoState *state)
Update cache according to given state.
bool isValid(SoState *state) const
Returns true if the cache is valid for the given state.
void addDependency()
Add given element type as a dependency for the cache.
void addDependency(SoField &field)
Add given field as a dependency for the cache.
Base class for ref-counted objects.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Traversal state.
Definition SoState.h:74
Stores runtime type information.
Definition SoType.h:98