Views
Data Access Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Protected Member Functions
IliPointerTypeClass Class Reference

User interface class. More...

#include <ilviews/dataccess/datatype.h>

Inheritance diagram for IliPointerTypeClass:
IliDatatype IliRefCounted

Protected Member Functions

 IliPointerTypeClass (const char *name)
 Constructs an IliPointerTypeClass data type. More...
 
virtual IlAny lockAny (IlAny any) const
 Increments a reference count related to an object. More...
 
virtual void unLockAny (IlAny any) const
 Decrements a reference count related to an object. More...
 
- Protected Member Functions inherited from IliDatatype
void doRegister ()
 This protected member function can be called in the constructor of subclasses of IliDatatype to make the object visible to the GetDatatypeByName() and GetDatatypeByPrettyName() static member functions. More...
 
- Protected Member Functions inherited from IliRefCounted
virtual ~IliRefCounted ()
 This is the virtual destructor of the IliRefCounted class. More...
 

Additional Inherited Members

- Public Member Functions inherited from IliDatatype
const char * getName () const
 Returns the name of a data type object. More...
 
virtual IliSchemagetNestedSchema () const
 Returns the schema of the manager IliTable objects if this is a structured data type. More...
 
const char * getPrettyName (IlvDisplay *display) const
 Returns pretty name. More...
 
virtual IlBoolean isAnonymous () const
 Returns IlTrue if the name of the data type is not an identifier. More...
 
virtual IlBoolean isBinaryType () const
 Returns IlTrue if the native format of the data type is binary. More...
 
virtual IlBoolean isDateTimeType () const
 Returns IlTrue if the native format of the data type is a date or a time. More...
 
virtual IlBoolean isDecimalType () const
 Returns IlTrue if the native format of the data type is IliDecimal. More...
 
virtual IlBoolean isFractionalType () const
 Returns IlTrue if the native format of the data type is a real (for example, float, double, or IliDecimal). More...
 
virtual IlBoolean isIntegralType () const
 Returns IlTrue if the native format of the data type is not a real (for example, Boolean, byte, or integer). More...
 
virtual IlBoolean isLargeObjectType () const
 Returns IlTrue if the native format of the data type corresponds to a large type in the database (for example, long string). More...
 
virtual IlBoolean isNumericType () const
 Returns IlTrue if the native format of the data type is numeric (for example, Boolean, byte, integer, float, double, or IliDecimal). More...
 
virtual IlBoolean isObjectType () const
 Returns IlTrue if the the data type is an object. More...
 
IlBoolean isRegistered () const
 Returns IlTrue if the data type is registered. More...
 
virtual IlBoolean isStringType () const
 Returns IlTrue if the native format of the data type is a character string (for example, string or long string). More...
 
virtual IlBoolean isStructuredType () const
 Returns IlTrue if the data type is a structured type (for example, table or object). More...
 
virtual IlBoolean isTableType () const
 Returns IlTrue if the the data type is a table. More...
 
virtual IliTablemakeTable () const
 Returns a created IliMemoryTable having the same schema as the data type if this is a structured data type. More...
 
void writeType (std::ostream &output) const
 Writes the name of the data type to an output stream. More...
 
- Public Member Functions inherited from IliRefCounted
IlInt getRefCount () const
 Returns the reference count of the object. Initially, this property is set to 0. More...
 
void lock () const
 Increments the reference count of the object.
 
void unLock () const
 Decrements the reference count of the object. More...
 
- Static Public Member Functions inherited from IliDatatype
static const IliDatatypeGetDatatypeByName (const char *name)
 Returns the data type from a name. More...
 
static const IliDatatypeGetDatatypeByPrettyName (IlvDisplay *disp, const char *name)
 Returns a data type whose localized name is prettyName or 0 if no such data type exists. More...
 
static const IliDatatypeReadType (std::istream &input)
 Reads a data type name from an input stream. More...
 

Detailed Description

User interface class.

Library: dataccess

The IliPointerTypeClass class can serve as a base class to implement custom data types. It works in conjunction with the IliValue::asAny() and IliValue::importAny() member functions. A custom data type manages objects of a given C++ type through IliValue objects. Internally, the managed objects are represented as void pointers by way of IlAny. The lockAny() and unLockAny() member functions provide the conversion between IlAny and the appropriate type and manage the object lifetime. A data type can specify what happens when an IliValue object is copied into another object. One of the following can occur:

The following example shows how the sharing policy can be implemented:

class BitmapTypeClass
{
public:
BitmapTypeClass() : IliPointerTypeClass("MyBitmapType") {
}
virtual IlAny lockAny(IlAny any) const {
IlvBitmap* bmp = (IlvBitmap*)any;
if (bmp) {
bmp->lock();
|
return bmp;
}
virtual void unLockAny(IlAny any) const {
IlvBitmap* bmp = (IlvBitmap*)any;
if (bmp) {
bmp->unLock();
}
}
};
BitmapTypeClass* BitmapType = new BitmapTypeClass();
IliValue toIliValue(IlvBitmap* bmp)
{
IliValue value(BitmapType);
value.importAny(bmp);
}
IlvBitmap* toIlvBitmap(const IliValue& value)
{
if (value.getType() == BitmapType) {
return (IlvBitmap*)value.asAny();
}
return 0;
}

The following example shows how the copy policy can be implemented:

class RectTypeClass
{
public:
RectTypeClass() : IliPointerTypeClass("MyRectType") {
}
virtual IlAny lockAny(IlAny any) const {
IlvRect* pRect = (IlvRect*)any;
if (pRect) {
return new IlvRect(*pRect);
}
return 0;
}
virtual void unLockAny(IlAny any) const {
IlvRect* pRect = (IlvRect*)any;
}
};
RectTypeClass* RectType = new RectTypeClass();
IliValue toIliValue(const IlvRect& rect)
{
IliValue value(RectType);
value.importAny(&rect);
return value;
}
IlvRect toIlvRect(const IliValue& value)
{
if (value.getType() == RectType) {
return (IlvRect*)value.asAny();
}
return 0;
}

Constructor & Destructor Documentation

◆ IliPointerTypeClass()

IliPointerTypeClass::IliPointerTypeClass ( const char *  name)
protected

Constructs an IliPointerTypeClass data type.

Parameters
nameIf the name is unique among all registered data types, it is possible to call IliDatatype::doRegister() during construction to make the data type instance visible through IliDatatype::GetDatatypeByName() and IliDatatype::GetDatatypeByPrettyName().

Member Function Documentation

◆ lockAny()

virtual IlAny IliPointerTypeClass::lockAny ( IlAny  any) const
protectedvirtual

Increments a reference count related to an object.

Depending on the sharing policy of the data type, this virtual member function should do one of the following:

  • Increment a reference count related to the object and return any itself.
  • Return a copy of any.

If the object is 0, this member function should return 0.

Parameters
anyA pointer to an object managed by this data type or 0.
Returns
The object or 0.

◆ unLockAny()

virtual void IliPointerTypeClass::unLockAny ( IlAny  any) const
protectedvirtual

Decrements a reference count related to an object.

Depending on the sharing policy of this data type, this virtual member function should do one of the following:

  • Decrement a reference count related to the object.
  • Delete the object.
Parameters
anyA pointer to an object managed by this data type.
IliDatatype::doRegister
void doRegister()
This protected member function can be called in the constructor of subclasses of IliDatatype to make ...
IliValue
User interface class.
Definition: value.h:93
IliPointerTypeClass::unLockAny
virtual void unLockAny(IlAny any) const
Decrements a reference count related to an object.
IlvRect
IliValue::getType
const IliDatatype * getType() const
Returns data type.
Definition: value.h:1146
IliPointerTypeClass::lockAny
virtual IlAny lockAny(IlAny any) const
Increments a reference count related to an object.
IlvBitmap::lock
void lock()
IlvBitmap::unLock
void unLock()
IliValue::importAny
IlBoolean importAny(IlAny val)
Imports an any value.
Definition: value.h:1232
IliPointerTypeClass
User interface class.
Definition: datatype.h:736
IlAny
void * IlAny
IlvBitmap
IliValue::asAny
IlAny asAny(IlAny nvl=0) const
Returns an any value.