root/branches/streaming-rework/src/ser.cpp

Revision 436, 1.2 kB (checked in by pieterpalmers, 15 years ago)

- fixed verbose level setting
- debugged DICE code, works with EVM

Line 
1 #include "devicemanager.h"
2 #include "libutil/serialize.h"
3
4 #include <iostream>
5
6 const char FileName[] = "serialize-test.xml";
7
8 static bool
9 serialize( const char* pFileName, int port )
10 {
11     DeviceManager devMgr;
12     if (!devMgr.initialize( port )) {
13         std::cerr << "could not init DeviceManager" << std::endl;
14         return false;
15     }
16    
17 //     devMgr.setVerboseLevel(DEBUG_LEVEL_VERBOSE);
18    
19     if (!devMgr.discover( )) {
20         std::cerr << "could not discover devices" << std::endl;
21         return false;
22     }
23     return devMgr.saveCache( pFileName );
24 }
25
26 static bool
27 deserialize( const char* pFileName )
28 {
29     DeviceManager devMgr;
30     if (!devMgr.initialize( 0 )) {
31         std::cerr << "could not init DeviceManager" << std::endl;
32         return false;
33     }
34     return devMgr.loadCache( pFileName );
35 }
36
37 int
38 main(  int argc,  char** argv )
39 {
40     int port=0;
41     if (argc==2) {
42         port=atoi(argv[1]);
43     }
44    
45     if ( !serialize( FileName, port ) ) {
46         std::cerr << "serializing failed" << std::endl;
47         return -1;
48     }
49     if ( !deserialize( FileName ) ) {
50         std::cerr << "deserializing failed" << std::endl;
51         return -1;
52     }
53
54     std::cout << "passed" << std::endl;
55     return 0;
56 }
Note: See TracBrowser for help on using the browser.