root/trunk/libffado/src/ser.cpp

Revision 478, 1.7 kB (checked in by wagi, 15 years ago)

- save cache information to $(localstatedir)/cache/libffade
- refactoring of build and load cache function

Line 
1 /*
2  * Copyright (C) 2005-2007 by Daniel Wagner
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2
11  * as published by the Free Software Foundation.
12  *
13  * FFADO is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with FFADO; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA.
22  */
23
24 #include "devicemanager.h"
25 #include "libutil/serialize.h"
26
27 #include <iostream>
28
29 const char FileName[] = "bebob.xml";
30
31 static bool
32 serialize( const char* pFileName )
33 {
34     DeviceManager devMgr;
35     if ( !devMgr.initialize( 0 ) )
36         return false;
37     if ( !devMgr.discover() )
38         return false;
39     devMgr.setVerboseLevel( 4 );
40     return devMgr.buildCache();
41 }
42
43 static bool
44 deserialize( const char* pFileName )
45 {
46     DeviceManager devMgr;
47     if ( !devMgr.initialize( 0 ) )
48         return false;
49
50     devMgr.setVerboseLevel( 4 );
51     return devMgr.loadCache( pFileName );
52 }
53
54 int
55 main(  int argc,  char** argv )
56 {
57     if ( !serialize( FileName ) ) {
58         std::cerr << "serializing failed" << std::endl;
59         return -1;
60     }
61     if ( !deserialize( FileName ) ) {
62         std::cerr << "deserializing failed" << std::endl;
63         return -1;
64     }
65
66     std::cout << "passed" << std::endl;
67     return 0;
68 }
Note: See TracBrowser for help on using the browser.