Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

void Impala::Application::TagsLife::Tag::readTag ( string  xmlFile  )  [inline, private]

Definition at line 109 of file Tag.h.

References Impala::atoi(), firstUse, Impala::Util::XmlDoc::GetAttributeValue(), Impala::Util::XmlDoc::GetChildNode(), Impala::Util::XmlDoc::GetChildNodes(), ILOG_INFO, lastUse, lastWeek, mostPopularPhotos, mostUsedCount, mostUsedWeek, mostViewedCount, mostViewedWeek, nrOfPhotos, Impala::Persistency::XmlFileReader::Read(), and weekStats.

Referenced by Tag().

00109                                  {
00110         Persistency::XmlFileReader reader;
00111         ILOG_INFO("reading XML file: " + xmlFile);
00112                 DOMDocument* doc = reader.Read(xmlFile);
00113                 DOMNode* root = GetChildNode(doc, "tagdata", true);
00114 
00115                 //<tagdata firstusedate="1100909103" lastusedate="1229559285" nrofphotos="4742"
00116                 //tag="amywinehouse" version="0.99">
00117 
00118                 nrOfPhotos = atoi(GetAttributeValue(root, "nrofphotos"));
00119                 firstUse = atoi(GetAttributeValue(root, "firstusedate"));
00120                 lastUse = atoi(GetAttributeValue(root, "lastusedate"));
00121 
00122                 string s = ctime(&firstUse);
00123 
00124                 vector<DOMNode*> mostpopularphotos = GetChildNodes(root, "mostpopularphoto");
00125                 ILOG_INFO("mostpopularphotos.size = " << mostpopularphotos.size());
00126                 for(uint i=0; i < mostpopularphotos.size(); i++) {
00127                         //<mostpopularphoto rank="1">
00128                         DOMNode* photo = GetChildNode(mostpopularphotos[i], "photo", true);
00129                         Photo* p = new Photo(photo);
00130                         mostPopularPhotos[i] = p;
00131                 }
00132                 vector<DOMNode*> weekstats = GetChildNodes(root, "weekstats");
00133                 ILOG_INFO("weekstats.size = " << weekstats.size());
00134                 for(uint i=0; i < weekstats.size(); i++) {
00135                         uint flickrWeek = atoi(GetAttributeValue(weekstats[i], "flickrweek"));
00136                         uint usage = atoi(GetAttributeValue(weekstats[i], "usage"));
00137                         uint views = atoi(GetAttributeValue(weekstats[i], "views"));
00138                         // <weekstats flickrweek="84" usage="1" views="43340">
00139                         if(views > mostViewedCount) {
00140                                 mostViewedWeek = flickrWeek;
00141                                 mostViewedCount = views;
00142                         }
00143                         if(usage > mostUsedCount) {
00144                                 mostUsedWeek = flickrWeek;
00145                                 mostUsedCount = usage;
00146                         }
00147 
00148                         DOMNode* photo = GetChildNode(weekstats[i], "mostpopularphoto", true);
00149                         Photo* p = new Photo(photo);
00150                         Week* w = new Week(flickrWeek, usage, views, p);
00151                         weekStats[flickrWeek] = w;
00152                         lastWeek = flickrWeek;
00153                 }
00154     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:16:23 2011 for ImpalaSrc by  doxygen 1.5.1