Views
Prototypes Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Friends
IlvAbstractProtoLibrary Class Referenceabstract

Abstract base class of prototype libraries. More...

#include <ilviews/protos/proto.h>

Inheritance diagram for IlvAbstractProtoLibrary:
IlvProtoLibrary

Public Member Functions

 IlvAbstractProtoLibrary (IlvDisplay *display, const char *name=0)
 Creates a new and empty prototype library named name. More...
 
void addPrototype (IlvPrototype *prototype)
 Adds a prototype to the prototype library. More...
 
const char * getName () const
 Returns the name of the prototype library. More...
 
IlvPrototypegetPrototype (const char *name, IlBoolean reload=IlFalse)
 Fetches a prototype from the library. More...
 
IlvPrototype ** getPrototypes (IlUInt &count)
 Returns all the prototypes contained in the library. More...
 
virtual IlBoolean load (istream *stream=0, IlBoolean loadPrototypes=IlvAbstractProtoLibrary::LoadAll)=0
 Loads the prototype library from stream. More...
 
void removePrototype (IlvPrototype *prototype)
 Removes a prototype from the prototype library. More...
 
virtual IlBoolean save (ostream *stream=0, IlBoolean savePrototypes=IlvAbstractProtoLibrary::LoadAll)=0
 Saves the prototype library to stream. More...
 

Static Public Member Functions

static void SetAutoLoadMode (IlBoolean loadAll)
 Sets the default load mode of libraries. More...
 

Friends

class IlvGroup
 
class IlvProtoInstance
 
class IlvPrototype
 

Detailed Description

Abstract base class of prototype libraries.

Library: ilvproto

A prototype library is a package that contains a set of prototypes. Prototype libraries make it possible to load and save a set of prototype description files as a single object. A prototype contained in a prototype library can be fetched by prefixing the name of the library with the name of the prototype when calling the external functions IlvGetPrototype() or IlvLoadPrototype(). IlvAbstractProtoLibrary is an abstract class and cannot be used directly. See IlvProtoLibrary for a simple prototype library class.

See also
IlvPrototype, IlvProtoInstance, IlvProtoLibrary.

Constructor & Destructor Documentation

◆ IlvAbstractProtoLibrary()

IlvAbstractProtoLibrary::IlvAbstractProtoLibrary ( IlvDisplay display,
const char *  name = 0 
)

Creates a new and empty prototype library named name.

Parameters
displayDefault display used when loading prototypes. Prototypes are display-independent, but operate more efficiently when they are instantiated on the same display they were created.
nameName of the library.

Member Function Documentation

◆ addPrototype()

void IlvAbstractProtoLibrary::addPrototype ( IlvPrototype prototype)

Adds a prototype to the prototype library.

Parameters
prototypePrototype to add.

◆ getName()

const char* IlvAbstractProtoLibrary::getName ( ) const

Returns the name of the prototype library.

Returns
The name of the prototype library. If there is no such name, the string "Unnamed" is return. You must not delete or modify the returned string.

◆ getPrototype()

IlvPrototype* IlvAbstractProtoLibrary::getPrototype ( const char *  name,
IlBoolean  reload = IlFalse 
)

Fetches a prototype from the library.

The prototype is loaded by the method, if it is not already loaded. If the prototype is already loaded and reload is IlTrue, the prototype is reloaded.

Parameters
nameName of the prototype to be loaded.
reloadSpecifies whether the prototype should be reread from its description file if it was already loaded.

◆ getPrototypes()

IlvPrototype** IlvAbstractProtoLibrary::getPrototypes ( IlUInt count)

Returns all the prototypes contained in the library.

Parameters
countContains, on return, the number of prototypes returned.
Returns
An array of pointers to prototypes. The pointer to this array must be released using the delete[] operator when no longer needed.

◆ load()

virtual IlBoolean IlvAbstractProtoLibrary::load ( istream *  stream = 0,
IlBoolean  loadPrototypes = IlvAbstractProtoLibrary::LoadAll 
)
pure virtual

Loads the prototype library from stream.

If stream is 0 a default location may be used, depending on the subclass. The default value for loadPrototypes is the static member variable LoadAll, which is IlTrue by default (it can be changed with the SetAutoLoadMode() method). If loadPrototypes is IlFalse, it will only be loaded on demand.

Parameters
streamStream to load the library from if it is non-null. Otherwise, subclasses may implement a means of retrieving the file describing the library.
loadPrototypesIf set to IlTrue, the prototypes are loaded immediately. Otherwise they are loaded only when needed, that is, when they need to be instantiated.

◆ removePrototype()

void IlvAbstractProtoLibrary::removePrototype ( IlvPrototype prototype)

Removes a prototype from the prototype library.

Parameters
prototypePrototype to remove.

◆ save()

virtual IlBoolean IlvAbstractProtoLibrary::save ( ostream *  stream = 0,
IlBoolean  savePrototypes = IlvAbstractProtoLibrary::LoadAll 
)
pure virtual

Saves the prototype library to stream.

If stream is 0 a default location is used, depending on the subclass. The default value for savePrototypes is the static member variable LoadAll, which is IlTrue by default (it can be changed with the SetAutoLoadMode() method). If savePrototypes is IlFalse, the prototypes must be saved explicitly using the IlvGroup::save() method.

Parameters
streamIf non-null, the library is saved to the stream. Otherwise, subclasses may save the library to a known location.
savePrototypesSpecifies whether the prototype itself should be saved, in addition to the description of the library.

◆ SetAutoLoadMode()

static void IlvAbstractProtoLibrary::SetAutoLoadMode ( IlBoolean  loadAll)
static

Sets the default load mode of libraries.

Parameters
loadAllIf IlTrue, newly opened libraries will, by default, load all their prototypes.