DICT-OBJ-FILE
Usage Example: V8-0-08
----------------DICT-OBJ-FILE Usage Examples------------- 1. Creating the dictionary object file and writing it to the persistent storage file. 2. Reading the dictionary object file from the persistent storage file and accessing its objects #include "DictObjFile.h" #include "DictObjCont.h" /* ** Example 1: How to create a dictionary object file and write it to the ** persistent storage file. */ // The (absolute or relative) name of the dictionary file should be // stored in dictFileName string dictFileName; // The (absolute or relative) name of the DDL file should be // stored in ddlFileName string ddlFileName; // The (absolute or relative) name of the persistent storage file for // the dictionary object file should be stored in persStoreFileName string persStoreFileName; // Create dictionary object file DictObjFile dictObjFile(persStoreFileName, dictFileName, ddlFileName); // Build dictionary object (this will also parse and process the // dictionary) dictObjFile.Build(); // Write the dictionary object file to the persistent storage file // (with the name persStoreFileName) dictObjFile.Write(); /* ** Example 2: How to read the content of a dictionary object file from ** the persistent storage file and access its objects. */ // The (absolute or relative) name of the persistent storage file for the // dictionary object file should be stored in persStoreFileName string persStoreFileName; // The name of the dictionary (block) string dictName; // Item name string itemName; // Create dictionary object file DictObjFile dictObjFile(persStoreFileName); // Read the dictonary object file from the persistent storage file dictObjFile.Read(); // Get access to the dictonary object container with the name dictName DictObjCont& dictObjCont = dictObjFile.GetDictObjCont(dictName); // Get and print dictionary title const vector<string>& title = dictObjCont.GetAttribute(ObjContInfo::CIF_DDL_CATEGORY_DICTIONARY, ObjContInfo::CIF_DDL_ITEM_TITLE); cout << "Dictionary " << dictName << "\'s title: " << title[0] << endl; // Get access to an item object container with the name itemName ObjCont& itemCont = dictObjCont.GetObjCont(itemName, RcsbItem); // Get and print item's construct attribute values const vector<string>& construct = itemCont.GetAttribute(ObjContInfo::CIF_DDL_CATEGORY_ITEM_TYPE_LIST, ObjContInfo::CIF_DDL_ITEM_CONSTRUCT); cout << "Item: " << itemName << "\'s construct attribute values: " << endl; for (unsigned int conI = 0; conI < construct.size(); ++conI) cout << construct[conI] << endl;