Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlvResource Class Reference

Resource class. More...

#include <ilviews/base/resource.h>

Inheritance diagram for IlvResource:
IlvColor IlvCursor IlvFont IlvLineStyle IlvPalette IlvPattern IlvColorPattern IlvGradientPattern

Public Member Functions

IlvDisplaygetDisplay () const
 Gets the IlvDisplay instance. More...
 
const char * getName () const
 Gets the resource name. More...
 
void lock ()
 Locks the resource. More...
 
virtual void setName (const char *name)
 Sets the name of the resource. More...
 
virtual void unLock ()
 Unlocks the resource. More...
 

Detailed Description

Resource class.

Library: xviews or winviews or mviews (mutually exclusive)
Resources should be used in Rogue Wave Views in the following manner:

Resource objects are maintained by the IlvDisplay instances of your application. They are allocated and released in your display system by specific mechanisms of the IlvDisplay class.

You will notice that very few resources actually have constructors. This is because resources are managed by the IlvDisplay object used by your application, so that resource creation and destruction are performed transparently for the end user.

See also
IlvDisplay.

Member Function Documentation

§ getDisplay()

IlvDisplay* IlvResource::getDisplay ( ) const

Gets the IlvDisplay instance.

Returns
The IlvDisplay instance that has created this resource.

§ getName()

const char* IlvResource::getName ( ) const

Gets the resource name.

Returns the name of the resource. The IlvDisplay object has a set of resource-specific member functions that let you obtain a resource through its name. The IlvDisplay object also includes numerous member functions that let you start to work with predefined resources such as colors, line styles, and patterns. These predefined resources let you start your application without having to allocate resources.

Returns
The resource name.

§ lock()

void IlvResource::lock ( )

Locks the resource.

Ensures that this resource will not be destroyed before it is unlocked.

This function increments a reference count initially set to 0. When you keep a pointer on a resource (because you store it in the field of an object or it is in a variable), you should lock this resource so that it cannot be destroyed by another object using it. When you do not need the resource any more, you should release it with a call to unLock(); if the lock you just removed was the last one, Rogue Wave Views will free the resource.

§ setName()

virtual void IlvResource::setName ( const char *  name)
virtual

Sets the name of the resource.

Names your resource by means of a unique name string descriptor that is internally copied.

Reimplemented in IlvFont, and IlvColor.

§ unLock()

virtual void IlvResource::unLock ( )
virtual

Unlocks the resource.

This function decrements the reference count of the resource, and deletes it if this count becomes 0. Resource management is closely concerned with the way resources are locked and unlocked. Whenever you need a specific resource in one of your persistent objects, you should use this mechanism to make sure that it will stay safe within your IlvDisplay instance. If your application needs more than one instance of IlvDisplay, you have to create resources within each environment, since resources cannot be shared between the different IlvDisplay contexts.

Reimplemented in IlvColor, and IlvPalette.


© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.