// file: $isip/class/mmedia/AnnotationGraph/angr_03.cc // version: $Id: angr_03.cc 8934 2002-12-23 05:38:02Z parihar $ // // isip include files // #include "AnnotationGraph.h" // method: read // // arguments: // Sof& sof: (input) sof file object // int32 tag: (input) sof object instance tag // const String& name: (input) sof object instance name // // return: a bool8 value indicating status // // this method has the object read itself from an Sof file // bool8 AnnotationGraph::read(Sof& sof_a, int32 tag_a, const String& name_a) { // read the instance of the object from the Sof file // if (!sof_a.find(name_a, tag_a)) { return false; } // read the actual data from the sof file // if (!readData(sof_a)) { return false; } // exit gracefully // return true; } // method: readData // // arguments: // Sof& sof: (input) sof file object // const String& pname: (input) parameter name // int32 size: (input) size in bytes of object (or full_size) // bool8 param: (input) is the parameter name in the file? // bool8 nested: (input) are we nested? // // return: a bool8 value indicating status // // this method has the object read itself from an Sof file. it assumes // that the Sof file is already positioned correctly. // bool8 AnnotationGraph::readData(Sof& sof_a, const String& pname_a, int32 size_a, bool8 param_a, bool8 nested_a) { // declare local variables // String anchor(DEF_ANCHOR); String annotation(DEF_ANNOTATION); DoubleLinkedList > anchors; DoubleLinkedList > annotations; // set i/o parameters // Integral::DEBUG debug_level = Integral::NONE; SofParser parser; parser.setDebug(debug_level); // ignore implicit parameter setting // // clear the current contents of the graph // this->clear(); // are we nested? // if (nested_a) { parser.setNest(); } // load the parse // if (!parser.load(sof_a, size_a)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the id // if (!id_d.readData(sof_a, PARAM_ID, parser.getEntry(sof_a, PARAM_ID), false, false)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the type // if (!type_d.readData(sof_a, PARAM_TYPE, parser.getEntry(sof_a, PARAM_TYPE), false, false)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // initialize the identifiers if needed // if (anchorids_d == (Identifier*)NULL) { anchorids_d = new Identifier(id_d, anchor); } if (annotationids_d == (Identifier*)NULL) { annotationids_d = new Identifier(id_d, annotation); } // get the list of anchors // if (!anchors.readData(sof_a, PARAM_ANCHORS, parser.getEntry(sof_a, PARAM_ANCHORS), false, false)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the list of annotations // if (!annotations.readData(sof_a, PARAM_ANNOTATIONS, parser.getEntry(sof_a, PARAM_ANNOTATIONS), false, false)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // initialize the annotation graph using the lists // set(anchors, annotations); // exit gracefully // return true; }