Experiments with session map template.
[metaproxy-moved-to-github.git] / src / test_ses_map.cpp
1 /* $Id: test_ses_map.cpp,v 1.1 2005-10-26 18:53:49 adam Exp $
2    Copyright (c) 2005, Index Data.
3
4 %LICENSE%
5  */
6
7 #include "config.hpp"
8 #include <iostream>
9 #include <stdexcept>
10
11 #include "router.hpp"
12 #include "session.hpp"
13 #include "package.hpp"
14
15 #include <map>
16
17 #include <boost/thread.hpp>
18 #include <boost/shared_ptr.hpp>
19 #define BOOST_AUTO_TEST_MAIN
20 #include <boost/test/auto_unit_test.hpp>
21
22 #include <yaz/zgdu.h>
23 #include <yaz/pquery.h>
24 #include <yaz/otherinfo.h>
25 using namespace boost::unit_test;
26
27
28 namespace yp2 {
29     class SesMap;
30     
31
32     class SesMap {
33         class Wrap {
34         public:
35             Wrap(const double &t) : m_t(t) { };
36             double m_t;
37             boost::mutex m_mutex;
38         };
39     private:
40         boost::mutex m_map_mutex;
41     public:
42         void create(SesMap &sm, const yp2::Session &s, double &t) {
43             boost::mutex::scoped_lock lock(m_map_mutex);
44             
45             boost::shared_ptr<Wrap> w_ptr(new Wrap(t));
46             m_map_ptr[s] = w_ptr;
47         }
48         std::map<yp2::Session,boost::shared_ptr<Wrap> >m_map_ptr;
49     };
50 }
51
52
53 BOOST_AUTO_TEST_CASE( test_ses_map_1 )
54 {
55     try 
56     {
57         yp2::SesMap ses_map;
58     }
59     catch ( ... ) {
60         BOOST_CHECK (false);
61     }
62 }
63
64
65 /*
66  * Local variables:
67  * c-basic-offset: 4
68  * indent-tabs-mode: nil
69  * c-file-style: "stroustrup"
70  * End:
71  * vim: shiftwidth=4 tabstop=8 expandtab
72  */