17 return obj.memory_size();
34 template <
typename ContainerType>
37 size_t _memory_size = 0;
48 auto container_size = _index.size();
50 for (
size_t i = 0; i < container_size; ++i) {
54 typename ContainerType::value_type v;
63 const auto container_size = _index.size();
64 dat_content.
write(
reinterpret_cast<const char*
>(&container_size),
sizeof(container_size) );
66 for (
const auto& item : _index) {
68 dat_content.
write(data.data(), data.size());
72 std::pair<typename primary_index_type::iterator, bool>
insert(
typename ContainerType::value_type obj) {
74 auto result = _index.insert(std::move(obj));
81 template<
typename Key>
82 typename primary_index_type::iterator
find(
const Key& key) {
84 return primary_idx.find(key);
87 template<
typename Key>
88 typename primary_index_type::const_iterator
find(
const Key& key)
const {
90 return primary_idx.find(key);
93 template<
typename Lam>
94 void modify(
typename primary_index_type::iterator itr, Lam lam) {
96 if (_index.modify( itr, std::move(lam))) {
101 template<
typename Key>
103 auto itr = _index.find(key);
104 if (itr == _index.end())
111 void erase(
typename primary_index_type::iterator itr) {
120 const ContainerType&
index()
const {
void write(const char *d, size_t n)
tracks the size of storage allocated to its underlying multi_index
tracked_storage()=default
ContainerType::template nth_index< 0 >::type primary_index_type
void erase(const Key &key)
size_t memory_size() const
std::pair< typename primary_index_type::iterator, bool > insert(typename ContainerType::value_type obj)
void modify(typename primary_index_type::iterator itr, Lam lam)
const ContainerType & index() const
bool read(fc::cfile_datastream &ds, size_t max_memory)
void erase(typename primary_index_type::iterator itr)
primary_index_type::iterator find(const Key &key)
void write(fc::cfile &dat_content) const
primary_index_type::const_iterator find(const Key &key) const
Defines exception's used by fc.
void unpack(Stream &s, std::deque< T > &value)
void pack(Stream &s, const std::deque< T > &value)
size_t memory_size(const T &obj)
#define T(meth, val, expected)