MARC Toolkit for Libraries |
Introduction | Documentation | FAQ | Downloads | Licence | Contact |
MARC Template Library FAQ
Why use C++ Templates?
C++ templates provide a number of advantages over the similar APIs that use inheritance and dynamic polymorphism. It is easier to support different MARC record formats. Normal approaches would use complicated inheritance hierarchies as differences in MARC records occur at a low level.
And there are also disadvantages. Developing an api that successfully combines both OOP and Generic programming isn't easy especially in regards to polymorphism (static vs dynamic).
MTL provides excellent performance and an easy to use API. Using the MARCRecord template I have on my computer (AMD K3 450, 320 MB) been able to convert 6550 MARC records to XML in under 1.6 seconds (approx. 4090/second or 245,400/minute; time does not include loading and writing from and to file) and the MARCEventRecord can do the same in little over half a second.
Do I have to distribute the source code with a program I have written using MTL?
No. MTL is licenced under a BSD style licence, which places very few restrictions on its use and distribution. You are free to distribute software without the source code however you must place MTL's copyright notice on the software.
I encourage you to make any improvements that you make to MTL publically avaliable.
Using MTL to build programs using VC++ 6.0
Make sure you link with the right runtime libraries. MFC programs require the multithreaded libraries. Console programs will crash if the wrong runtime library is used (usually with functions such as getch()).
MTL doesn't suport a particular MARC format, how do I add support for it?
To add support for a different MARC format with MTL you:
eg. MARCRecord<MARC21_Leader, MARC21_Dir> MARC21Record;
- Derive a MARC Leader class from the virtual base class MARCLeader.
- Derive a MARC Directory class from the virtual base class MARCDir.
- Using either the MARCRecord or the MARCEventRecord templates create a new record type.
How do I load records using Z39.50?
After experimenting with the idea of adding Z39.50 support to MTL I have decided against it. Why dupplicate the work already done by others.
It is recommended that you use Index Data's YAZ toolkit. The new ZOOM api makes using the Z39.50 Protocol in your programs very easy. Use the ZOOM_record_get function to access the raw record data.
ZOOM_record rec; const char *syntax, *raw; int len; MARC21Record marcRec; syntax = ZOOM_record_get (rec, "syntax", &len); if(strcmp(syntax, "usmarc")) { raw = ZOOM_record_get (rec, "raw", &len); marcRec.Parse((unsigned char *)raw, len); }What software uses the MARC Template Library?