Skip to content

Commit bc6e2ae

Browse files
committed
formatting
1 parent 036a0dd commit bc6e2ae

File tree

2 files changed

+399
-395
lines changed

2 files changed

+399
-395
lines changed

csi_kafka/internal/utility.h

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
#include <map>
2-
#include <functional>
3-
#include <memory>
4-
#include <boost/noncopyable.hpp>
5-
#include "spinlock.h"
6-
7-
#pragma once
8-
9-
namespace csi {
10-
namespace kafka {
11-
template<class key_type, class value_type, typename key_compare = std::less<key_type>>
12-
class table : public boost::noncopyable {
13-
public:
14-
typedef typename std::map<key_type, std::shared_ptr<value_type>, key_compare>::iterator iterator;
15-
typedef typename std::map<key_type, std::shared_ptr<value_type>, key_compare>::const_iterator const_iterator;
16-
17-
void put(const key_type& key, std::shared_ptr<value_type> v) {
18-
csi::kafka::spinlock::scoped_lock xx(_spinlock);
19-
_data[key] = v;
20-
}
21-
22-
std::shared_ptr<value_type> get(const key_type& key) const {
23-
csi::kafka::spinlock::scoped_lock xx(_spinlock);
24-
const_iterator item = _data.find(key);
25-
if(item != _data.end())
26-
return item->second;
27-
return std::shared_ptr<value_type>(NULL);
28-
}
29-
30-
size_t size() const { return _data.size(); } // skip the lock - it should be ok anyway
31-
32-
private:
33-
mutable csi::kafka::spinlock _spinlock;
34-
std::map<key_type, std::shared_ptr<value_type>, key_compare> _data;
35-
};
36-
}
37-
}
1+
//#include <map>
2+
//#include <functional>
3+
//#include <memory>
4+
//#include <boost/noncopyable.hpp>
5+
//#include "spinlock.h"
6+
//
7+
//#pragma once
8+
//
9+
//namespace csi {
10+
// namespace kafka {
11+
// template<class key_type, class value_type, typename key_compare = std::less<key_type>>
12+
// class table : public boost::noncopyable {
13+
// public:
14+
// typedef typename std::map<key_type, std::shared_ptr<value_type>, key_compare>::iterator iterator;
15+
// typedef typename std::map<key_type, std::shared_ptr<value_type>, key_compare>::const_iterator const_iterator;
16+
//
17+
// void put(const key_type& key, std::shared_ptr<value_type> v) {
18+
// csi::kafka::spinlock::scoped_lock xx(_spinlock);
19+
// _data[key] = v;
20+
// }
21+
//
22+
// std::shared_ptr<value_type> get(const key_type& key) const {
23+
// csi::kafka::spinlock::scoped_lock xx(_spinlock);
24+
// const_iterator item = _data.find(key);
25+
// if(item != _data.end())
26+
// return item->second;
27+
// return std::shared_ptr<value_type>(NULL);
28+
// }
29+
//
30+
// size_t size() const { return _data.size(); } // skip the lock - it should be ok anyway
31+
//
32+
// private:
33+
// mutable csi::kafka::spinlock _spinlock;
34+
// std::map<key_type, std::shared_ptr<value_type>, key_compare> _data;
35+
// };
36+
// }
37+
//}

0 commit comments

Comments
 (0)