#include <GlContextData.h>
Inheritance diagram for vrj::GlContextData:


Public Methods | |
| GlContextData () | |
| ContextDataType & | operator * () |
| Returns reference to user data for the current context. More... | |
| ContextDataType * | operator-> () |
| Returns reference to user data for the current context. More... | |
| std::vector< ContextDataType * > * | getDataVector () |
| This function gives exclusive access to ALL copies of the context-specific data. More... | |
Protected Methods | |
| ContextDataType * | getPtrToCur () |
| Returns a pointer to the correct data element in the current context. More... | |
This class allows the user to specify a data type that contains data that needs to have a context specific copy. This means that there is a unique copy of the data structure for each openGL context in the current environment. Juggler will take care of the data copies transparently for the user so the user never has to know about the current configuration.
An example use would be a struct full of display list id's. The user passes their user-defined data structure as the template parameter. The resulting object will be a "smart" pointer to the context specific data to use.
Ex:
GlContextData<myStruct> myData;
myData->dlSphere = 0;
Definition at line 85 of file GlContextData.h.
|
|||||||||
|
Definition at line 88 of file GlContextData.h.
00089 {;}
|
|
|||||||||
|
Returns reference to user data for the current context.
Definition at line 98 of file GlContextData.h.
00099 { return (*getPtrToCur()); }
|
|
|||||||||
|
Returns reference to user data for the current context.
Definition at line 108 of file GlContextData.h.
00109 { return getPtrToCur(); }
|
|
|||||||||
|
This function gives exclusive access to ALL copies of the context-specific data.
Definition at line 120 of file GlContextData.h.
00121 {
00122 return &(mThreadSpecificContextData->mContextDataVector);
00123 }
|
|
|||||||||
|
Returns a pointer to the correct data element in the current context.
Definition at line 158 of file GlContextData.h. Referenced by vrj::GlContextData< context_data >::operator *, and vrj::GlContextData< context_data >::operator->.
00159 {
00160 // Get current context
00161 int context_id = getCurContext();
00162 ThreadContextData<ContextDataType>* thread_specific_context_data = &(*mThreadSpecificContextData); // Cache ref for better performance
00163
00164 thread_specific_context_data->checkSize(context_id+1); // Make sure we are large enough (+1 since we have index)
00165
00166 return thread_specific_context_data->mContextDataVector[context_id];
00167 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002