Defining an Entry Data Member
An entry is an instance of the Rogue Wave® Server class template IlsEntry. The class template that declares the entry must be a member of a class that directly or transitively derives from IlsObject or IlsEntity. Derivation must be public.
You declare an entry data member as follows:
class Flight:
public IlsObject
{
public:
IlsEntry<int> passengers;
Flight();
};
The class template IlsEntry takes the type of the entry as its parameter. The code declares the entry passengers of type int for the class Flight. This entry stores the number of passengers traveling on a given flight.
The type of the entry is not a real integer but a more elaborate type which behaves almost like an integer; this type contains a conversion operator to an integer. From a C++ point of view, this type of conversion is considered a user-defined conversion, and, as such, it is bound by some constraints. For example, the C++ compiler cannot automatically translate two user-defined conversions. The code below involves two user-defined conversions. IlsEntry<int> is converted to an integer which is in turn converted to A:
class A{
public:
A(int);
};
void f(A);
class B: public IlsObject{
public:
B();
IlsEntry<int> i;
};
typedef IlsSmartPointer<B> BP;
void f(){
BP bp=new B();
f(bp->i); // forbidden, too many conversions
}
In this case, you have to “help” the compiler and perform these conversions by hand in the following manner:
f(bp->i.getValue())
or
f(A(bp->i))
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.