ParCompMark::XDisplay Class Reference

#include <PCMXDisplay.h>

Collaboration diagram for ParCompMark::XDisplay:

Collaboration graph
[legend]
List of all members.

Detailed Description

Class that encapsulates an X Display.

Definition at line 60 of file PCMXDisplay.h.


Getters & setters

const std::string & getDisplayName () const
 Getter of mDisplayName.
::Display * getDisplay () const
 Getter of mDisplay.
const bool & getInitialized () const
 Getter of mInitialized.
const u32getWidth () const
 Getter of mWidth.
const u32getHeight () const
 Getter of mHeight.
static const bool & getXMTInitialized ()
 Getter of mXMTInitialized.
static const bool & getXMTSupported ()
 Getter of mXMTSupported.
static const MutexgetErrorHandlerMutex ()
 Getter of mErrorHandlerMutex.
static const bool & getTolerateErrors ()
 Getter of mTolerateErrors.
static void setTolerateErrors (const bool &tolerateerrors)
 Setter of mTolerateErrors.

Methods

virtual void initialize ()
 Initialize X display.
virtual void finalize ()
 Finalize X display.
virtual void synchronize (const bool &discard=false)
 Flush the output buffer and then waits until all requests have been received and processed by the X server.
virtual s32 findBestVisual (const s32 &screenNumber, const s32 &multiSample=XDisplay::IGNOREMULTISAMPLE)
 Examine all visuals to find the so-called best one.
virtual void getVisualAttribs (XVisualInfo *vInfo, VisualAttribs &attribs)
 Get visual attributes for the specified visual info descriptor.
virtual void initializeMT ()
 Initialize X multithreading, enable Xlib support for concurrent threads.

Public Types

typedef Pointer< XDisplay,
Mutex
Pointer
 Type for pointer on this class.

Public Member Functions

Constructors & destructor
 XDisplay (const std::string &displayName="")
 Create an X display.
virtual ~XDisplay ()
 The destructor.

Static Public Attributes

Class constants
static const s32 IGNOREMULTISAMPLE = -1
 Constant for ignoring multisample.
static const s32 UNKNOWNDIMENSION = 0
 Constant for unknown display dimension.

Static Protected Member Functions

Class methods
static int errorHandler (Display *display, XErrorEvent *errorEvent)
 X error handler.

Protected Attributes

Variables
std::string mDisplayName
 X display name.
::Display * mDisplay
 Wrapped X Display.
bool mInitialized
 The display is initialized.
u32 mWidth
 Width of the display in pixels (of the default screen).
u32 mHeight
 Height of the display in pixels (of the default screen).

Static Protected Attributes

Class variables
static bool mXMTInitialized = false
 X multithreading is initialized.
static bool mXMTSupported = false
 X multithreading is supported.
static Mutex mErrorHandlerMutex
 Mutex for synchronization the class level error handling.
static bool mTolerateErrors = false
 Skip Xlib errors.

Classes

struct  VisualAttribs
 Struct for visual attributes. More...

Member Typedef Documentation

Type for pointer on this class.

Definition at line 78 of file PCMXDisplay.h.


Constructor & Destructor Documentation

ParCompMark::XDisplay::XDisplay ( const std::string &  displayName = ""  ) 

Create an X display.

Parameters:
[in] displayName X display name

Definition at line 56 of file PCMXDisplay.cpp.

References ParCompMark::Singleton< T >::getInstance(), mDisplay, mDisplayName, mHeight, mInitialized, mWidth, ParCompMark::Logger::NOTICE, and UNKNOWNDIMENSION.

Here is the call graph for this function:

ParCompMark::XDisplay::~XDisplay (  )  [virtual]

The destructor.

This class has virtual destructor.

Definition at line 79 of file PCMXDisplay.cpp.

References finalize(), ParCompMark::Singleton< T >::getInstance(), mDisplayName, mInitialized, and ParCompMark::Logger::NOTICE.

Here is the call graph for this function:


Member Function Documentation

int ParCompMark::XDisplay::errorHandler ( Display *  display,
XErrorEvent *  errorEvent 
) [static, protected]

X error handler.

Parameters:
[in] display X display
[in] errorEvent Error event
Returns:
Return code of the handler.

Definition at line 93 of file PCMXDisplay.cpp.

References Except, ParCompMark::Mutex::lock(), mErrorHandlerMutex, mTolerateErrors, ParCompMark::StringConverter::toString(), and ParCompMark::Mutex::unlock().

Referenced by initializeMT().

Here is the call graph for this function:

void ParCompMark::XDisplay::finalize (  )  [virtual]

Finalize X display.

Definition at line 163 of file PCMXDisplay.cpp.

References Assert, ParCompMark::Logger::DEBUG, ParCompMark::Singleton< T >::getInstance(), mDisplay, mDisplayName, mInitialized, and synchronize().

Referenced by ~XDisplay().

Here is the call graph for this function:

s32 ParCompMark::XDisplay::findBestVisual ( const s32 screenNumber,
const s32 multiSample = XDisplay::IGNOREMULTISAMPLE 
) [virtual]

inline::Display * ParCompMark::XDisplay::getDisplay (  )  const

Getter of mDisplay.

Returns value of mDisplay.

Returns:
The value of mDisplay

Definition at line 452 of file PCMXDisplay.h.

const std::string & ParCompMark::XDisplay::getDisplayName (  )  const [inline]

Getter of mDisplayName.

Returns value of mDisplayName.

Returns:
The value of mDisplayName

Definition at line 445 of file PCMXDisplay.h.

const Mutex & ParCompMark::XDisplay::getErrorHandlerMutex (  )  [inline, static]

Getter of mErrorHandlerMutex.

Returns value of mErrorHandlerMutex.

Returns:
The value of mErrorHandlerMutex

Definition at line 494 of file PCMXDisplay.h.

const u32 & ParCompMark::XDisplay::getHeight (  )  const [inline]

Getter of mHeight.

Returns value of mHeight.

Returns:
The value of mHeight

Definition at line 487 of file PCMXDisplay.h.

const bool & ParCompMark::XDisplay::getInitialized (  )  const [inline]

Getter of mInitialized.

Returns value of mInitialized.

Returns:
The value of mInitialized

Definition at line 459 of file PCMXDisplay.h.

const bool & ParCompMark::XDisplay::getTolerateErrors (  )  [inline, static]

Getter of mTolerateErrors.

Returns value of mTolerateErrors.

Returns:
The value of mTolerateErrors

Definition at line 501 of file PCMXDisplay.h.

void ParCompMark::XDisplay::getVisualAttribs ( XVisualInfo *  vInfo,
VisualAttribs attribs 
) [virtual]

Get visual attributes for the specified visual info descriptor.

Parameters:
[in] vInfo Visual info descriptor
[out] attribs Variable to hold the restrieved attributes

Definition at line 263 of file PCMXDisplay.cpp.

References ParCompMark::XDisplay::VisualAttribs::accumAlphaSize, ParCompMark::XDisplay::VisualAttribs::accumBlueSize, ParCompMark::XDisplay::VisualAttribs::accumGreenSize, ParCompMark::XDisplay::VisualAttribs::accumRedSize, ParCompMark::XDisplay::VisualAttribs::alphaSize, ParCompMark::XDisplay::VisualAttribs::auxBuffers, ParCompMark::XDisplay::VisualAttribs::bitsPerRGB, ParCompMark::XDisplay::VisualAttribs::blueMask, ParCompMark::XDisplay::VisualAttribs::blueSize, ParCompMark::XDisplay::VisualAttribs::bufferSize, ParCompMark::XDisplay::VisualAttribs::colormapSize, ParCompMark::XDisplay::VisualAttribs::depth, ParCompMark::XDisplay::VisualAttribs::depthSize, ParCompMark::XDisplay::VisualAttribs::doubleBuffer, ParCompMark::XDisplay::VisualAttribs::greenMask, ParCompMark::XDisplay::VisualAttribs::greenSize, ParCompMark::XDisplay::VisualAttribs::id, ParCompMark::XDisplay::VisualAttribs::klass, ParCompMark::XDisplay::VisualAttribs::level, mDisplay, ParCompMark::XDisplay::VisualAttribs::numMultisample, ParCompMark::XDisplay::VisualAttribs::numSamples, ParCompMark::XDisplay::VisualAttribs::redMask, ParCompMark::XDisplay::VisualAttribs::redSize, ParCompMark::XDisplay::VisualAttribs::rgba, ParCompMark::XDisplay::VisualAttribs::stencilSize, ParCompMark::XDisplay::VisualAttribs::stereo, ParCompMark::XDisplay::VisualAttribs::supportsGL, ParCompMark::XDisplay::VisualAttribs::transparentAlphaValue, ParCompMark::XDisplay::VisualAttribs::transparentBlueValue, ParCompMark::XDisplay::VisualAttribs::transparentGreenValue, ParCompMark::XDisplay::VisualAttribs::transparentIndexValue, ParCompMark::XDisplay::VisualAttribs::transparentRedValue, ParCompMark::XDisplay::VisualAttribs::transparentType, and ParCompMark::XDisplay::VisualAttribs::visualCaveat.

Referenced by findBestVisual().

const u32 & ParCompMark::XDisplay::getWidth (  )  const [inline]

Getter of mWidth.

Returns value of mWidth.

Returns:
The value of mWidth

Definition at line 480 of file PCMXDisplay.h.

const bool & ParCompMark::XDisplay::getXMTInitialized (  )  [inline, static]

Getter of mXMTInitialized.

Returns value of mXMTInitialized.

Returns:
The value of mXMTInitialized

Definition at line 466 of file PCMXDisplay.h.

const bool & ParCompMark::XDisplay::getXMTSupported (  )  [inline, static]

Getter of mXMTSupported.

Returns value of mXMTSupported.

Returns:
The value of mXMTSupported

Definition at line 473 of file PCMXDisplay.h.

void ParCompMark::XDisplay::initialize (  )  [virtual]

void ParCompMark::XDisplay::initializeMT (  )  [protected, virtual]

Initialize X multithreading, enable Xlib support for concurrent threads.

This function must be the first Xlib function a multi-threaded program calls, and it must complete before any other Xlib call is made. (Internally called at the first XDisplay initialization.)

Definition at line 333 of file PCMXDisplay.cpp.

References errorHandler(), ParCompMark::Singleton< T >::getInstance(), mXMTInitialized, mXMTSupported, ParCompMark::Logger::NOTICE, and ParCompMark::Logger::WARNING.

Referenced by initialize().

Here is the call graph for this function:

void ParCompMark::XDisplay::setTolerateErrors ( const bool &  tolerateerrors  )  [inline, static]

Setter of mTolerateErrors.

Sets value of mTolerateErrors.

Parameters:
[in] tolerateerrors The value of mTolerateErrors

Definition at line 508 of file PCMXDisplay.h.

void ParCompMark::XDisplay::synchronize ( const bool &  discard = false  )  [virtual]

Flush the output buffer and then waits until all requests have been received and processed by the X server.

Parameters:
[in] discard Indicates whether synchronize() discards all events on the event queue

Definition at line 181 of file PCMXDisplay.cpp.

References mDisplay.

Referenced by finalize().


Member Data Documentation

Constant for ignoring multisample.

Remarks:
This is own attribute of this class.

Definition at line 135 of file PCMXDisplay.h.

::Display* ParCompMark::XDisplay::mDisplay [protected]

Wrapped X Display.

Remarks:
This attribute references an attribute.

Definition at line 206 of file PCMXDisplay.h.

Referenced by finalize(), findBestVisual(), getVisualAttribs(), initialize(), synchronize(), and XDisplay().

std::string ParCompMark::XDisplay::mDisplayName [protected]

X display name.

Remarks:
This is own attribute of this class.

Definition at line 199 of file PCMXDisplay.h.

Referenced by finalize(), initialize(), XDisplay(), and ~XDisplay().

Mutex for synchronization the class level error handling.

Remarks:
This is own attribute of this class.

Definition at line 174 of file PCMXDisplay.h.

Referenced by errorHandler().

Height of the display in pixels (of the default screen).

Remarks:
This is own attribute of this class.

Definition at line 227 of file PCMXDisplay.h.

Referenced by initialize(), and XDisplay().

The display is initialized.

Remarks:
This is own attribute of this class.

Definition at line 213 of file PCMXDisplay.h.

Referenced by finalize(), initialize(), XDisplay(), and ~XDisplay().

bool ParCompMark::XDisplay::mTolerateErrors = false [static, protected]

Skip Xlib errors.

Do not use it.

Remarks:
This is own attribute of this class.

Definition at line 181 of file PCMXDisplay.h.

Referenced by errorHandler().

Width of the display in pixels (of the default screen).

Remarks:
This is own attribute of this class.

Definition at line 220 of file PCMXDisplay.h.

Referenced by initialize(), and XDisplay().

bool ParCompMark::XDisplay::mXMTInitialized = false [static, protected]

X multithreading is initialized.

Remarks:
This is own attribute of this class.

Definition at line 160 of file PCMXDisplay.h.

Referenced by initialize(), and initializeMT().

bool ParCompMark::XDisplay::mXMTSupported = false [static, protected]

X multithreading is supported.

Remarks:
This is own attribute of this class.

Definition at line 167 of file PCMXDisplay.h.

Referenced by initializeMT().

Constant for unknown display dimension.

Remarks:
This is own attribute of this class.

Definition at line 142 of file PCMXDisplay.h.

Referenced by XDisplay().


The documentation for this class was generated from the following files: