Swinc
SourceForge.net Logo

 

 

swinc::PtrMap Class Reference

PtrMap - A class used to initially map a HWND to a SwincWindowBase class by thread. More...

#include <ptrmap.h>

List of all members.


Public Member Functions

 PtrMap ()
 Constructs a PtrMap object.
 ~PtrMap ()
 Destroys a PtrMap object.
void Add (swinc::SwincWindowBase *pswb)
swinc::SwincWindowBaseExtract (const HWND hwnd)

Detailed Description

PtrMap - A class used to initially map a HWND to a SwincWindowBase class by thread.

The class is thread safe. It stores a pointer to a SwincWindowBase and associates it with the current thread id. Critical Sections are used during adds and extracts.

Care should be taken to minimize time and operations called between adding and extracting as well as making sure adds, and extracts are coordinated. Otherwise windows created in the same thread may overwrite unextracted pointers.

All of the Swinc windows and controls use the PtrMap for a very brief time during their creation. Typically you will not use PtrMap directly unless you are deriving a window directly from SwincWindowBase which is not recommended. Better would be to derive from any class derived from SwincWindowBase such as SwincWindow The swinc classes access PtrMap via a global variable, g_ptrmap.


Constructor & Destructor Documentation

swinc::PtrMap::PtrMap (  )  [inline]

Constructs a PtrMap object.

swinc::PtrMap::~PtrMap (  )  [inline]

Destroys a PtrMap object.


Member Function Documentation

void swinc::PtrMap::Add ( swinc::SwincWindowBase pswb  )  [inline]

Add() temporarily associates the supplied pointer with the current thread for later retrieval.

Parameters:
pswb A pointer to a SwincWindowBase derived window

swinc::SwincWindowBase* swinc::PtrMap::Extract ( const HWND  hwnd  )  [inline]

Extract() retrieves the SwincWindowBase from current thread and associates the HWND to it.

Parameters:
hwnd The Handle to the window to associaate the the class.
Returns:
SwincWindowBase* A pointer to the the base class of the SwincWindow created.


The documentation for this class was generated from the following file:
Generated on Sat Jul 7 11:45:10 2007 for SWinC by  doxygen 1.5.2