Persistence
Having created a custom table class, you may want to make it persistent. Making it persistent means that it is integrated in Views Studio. It can appear in the Data Access palette of the Palettes panel and can be used in the same way as other Data Access classes. For example, you may want to make a custom data source that uses your persistent custom table.
To make your custom table class persistent, you should ensure that the following items are declared in the header file for the class:
*a copy constructor
*a stream based constructor
*the IliDeclareDTypeInfo macro in the class declaration
*a write virtual member function
*an operator==
*the IliDeclareTypeInit macro is used in the header file
#include <ilviews/dataccess/table.h>
 
class DirectoryTable : public IliTable {
public:
...
DirectoryTable(const DirectoryTable&);
DirectoryTable(IlvDisplay*, istream&);
 
IliDeclareDTypeInfo(DirectoryTable);
virtual void write (ostream&) const;
int operator == (const DirectoryTable&) const;
...
};
IliDeclareTypeInit(DirectoryTable);
In the source file, the implementation should do the following:
*Use the IliRegisterDClass macro.
*Implement all the constructors and member functions mentioned above.
Here is an outline of what the implementation may look like. The details have been left for you to fill in:
DirectoryTable::DirectoryTable(const DirectoryTable& o)
: IliTable(o)
{
...
}
 
DirectoryTable::DirectoryTable(IlvDisplay* dpy, istream& is)
: IliTable(dpy, is)
{
...
}
 
void DirectoryTable::write (ostream& os) const {
IliTable::write(os);
...
}
 
int DirectoryTable::operator == (const DirectoryTable& o) const {
if (!IliTable::operator == (o))
return 0;
...
}
 
IliRegisterDClass(DirectoryTable,IliTable);
Published date: 05/24/2022
Last modified date: 02/24/2022