Changeset 367

Show
Ignore:
Timestamp:
01/03/07 15:31:25 (16 years ago)
Author:
wagi
Message:

DeviceManager::saveCache: basePath construction fixed for more than one device
DeviceManager::loadCache: likewise

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libfreebob/src/devicemanager.cpp

    r366 r367  
    11 /* devicemanager.cpp 
    2  * Copyright (C) 2005,06 by Daniel Wagner 
     2 * Copyright (C) 2005,06,07 by Daniel Wagner 
    33 * 
    44 * This file is part of FreeBoB. 
     
    3434 
    3535#include <iostream> 
     36#include <sstream> 
     37 
    3638#include <unistd.h> 
    3739 
     
    369371        BeBoB::AvDevice* pBeBoBDevice = reinterpret_cast< BeBoB::AvDevice* >( pAvDevice ); 
    370372        if ( pBeBoBDevice ) { 
     373            // Let's use a very simple path to find the devices later. 
     374            // Since under hood there will an xml node name this should 
     375            // adhere the needed naming rules. Of course we could give it 
     376            // a good node name and add an attribute but that would mean 
     377            // we have to expose a bigger interface from IOSerialize/IODesialize, 
     378            // which is just not needed. KISS. 
     379            ostringstream strstrm; 
     380            strstrm << "id" << i; 
     381            Glib::ustring basePath = "BeBoB/" + strstrm.str() + "/"; 
     382 
    371383            Util::XMLSerialize ser( fileName ); 
    372             std::string idx = "id" + i
    373             Glib::ustring basePath = "BeBoB/" + idx + "/"; 
     384            pBeBoBDevice->serialize( basePath, ser )
     385 
    374386            i++; 
    375             pBeBoBDevice->serialize( basePath, ser ); 
    376387            std::cout << "a bebob device serialized" << std::endl; 
    377             return true; 
    378388        } 
    379389    } 
     
    413423 
    414424    do { 
    415         std::string idx = "id" + i; 
     425        ostringstream strstrm; 
     426        strstrm << "id" << i; 
    416427        pBeBoBDevice = BeBoB::AvDevice::deserialize( 
    417             "BeBoB/" + idx + "/", 
     428            "BeBoB/" + strstrm.str() + "/", 
    418429            *m_1394Service, 
    419430            deser );