本文整理汇总了C++中storage_type类的典型用法代码示例。如果您正苦于以下问题:C++ storage_type类的具体用法?C++ storage_type怎么用?C++ storage_type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了storage_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void serialize(storage_type& s) const
{
s.serialize(mFirstX);
s.serialize(mXW);
s.serialize(mW);
s.serialize(mXXW);
}
示例2: serialize
static void serialize(storage_type& s, const Nullable<T>& in)
{
bool is = in.isValue();
s.serialize(is);
if (is)
s.serialize(*in);
}
示例3: deserialize
void deserialize(storage_type& s)
{
s.deserialize(mFirstX);
s.deserialize(mXW);
s.deserialize(mW);
s.deserialize(mXXW);
}
示例4: serialize
static void serialize(storage_type& s, const boost::unordered_set<T>& o)
{
uint32_t sz = o.size();
s.serialize(sz);
for (auto it = o.begin(), it_end = o.end(); it != it_end; ++it)
s.serialize(*it);
}
示例5: serialize
static void serialize(storage_type& s, const Alternative<T1, T2>& in)
{
s.serialize(in.isLeft());
if (in.isLeft())
s.serialize(in.left());
else
s.serialize(in.right());
}
示例6: serialize
static void serialize(storage_type& s, const MapWithIndex<T1, T2, cmp_type_1, cmp_type_2>& o)
{
uint32_t sz = o.size();
s.serialize(sz);
for (auto it = o.getKeyToValue().begin(), it_end = o.getKeyToValue().end();
it != it_end; ++it)
{
s.serialize(it->first);
s.serialize(it->second);
}
}
示例7: deserialize
static void deserialize(storage_type& s, boost::unordered_set<T>& o)
{
o = boost::unordered_set<T>();
uint32_t sz;
s.deserialize(sz);
for (int32_t k = 0; k < sz; k++)
{
T key;
s.deserialize(key);
o.insert(key);
}
}
示例8: deserialize
static void deserialize(storage_type& s, Nullable<T>& out)
{
bool n;
s.deserialize(n);
if (n)
{
T t;
s.deserialize(t);
out = t;
}
else
out = null();
}
示例9: indexmap_storage_pair
indexmap_storage_pair (const indexmap_type & IM, const storage_type & ST):
indexmap_(IM),storage_(ST){
#ifdef TRIQS_ARRAYS_CHECK_IM_STORAGE_COMPAT
if (ST.size() != IM.domain().number_of_elements())
TRIQS_RUNTIME_ERROR<<"index_storage_pair construction : storage and indices are not compatible";
#endif
}
示例10: deserialize
static void deserialize(storage_type& s, MapWithIndex<T1, T2, cmp_type_1, cmp_type_2>& o)
{
o = MapWithIndex<T1,T2, cmp_type_1, cmp_type_2>();
uint32_t sz;
s.deserialize(sz);
for (uint32_t k = 0; k < sz; k++)
{
T1 key;
T2 val;
s.deserialize(key);
s.deserialize(val);
o.set(key,val);
}
}
示例11: deserialize
static void deserialize(storage_type& s, Alternative<T1, T2>& in)
{
bool isLeft;
s.deserialize(isLeft);
if (isLeft)
{
T1 t1;
s.deserialize(t1);
in = Alternative<T1, T2>(t1);
}
else
{
T2 t2;
s.deserialize(t2);
in = Alternative<T1, T2>(t2);
}
}
示例12: get
/**
* gets the value associated with a key.
* Returns (true, Value) if the entry is available.
* Returns (false, undefined) otherwise.
*/
std::pair<bool, ValueType> get(const KeyType &key) const {
// who owns the data?
const size_t hashvalue = hasher(key);
const size_t owningmachine = hashvalue % rpc.numprocs();
std::pair<bool, ValueType> retval;
// if it is me, we can return it
if (owningmachine == rpc.dc().procid()) {
lock.lock();
typename storage_type::const_iterator iter = storage.find(hashvalue);
retval.first = iter != storage.end();
if (retval.first) retval.second = iter->second;
lock.unlock();
} else {
retval = rpc.remote_request(owningmachine,
&dht<KeyType,ValueType>::get,
key);
}
return retval;
}
示例13: init
static void init(storage_type& storage,rvalue_source_type t)
{
storage.reset(new T(static_cast<rvalue_source_type>(t)));
}
示例14: cleanup
static void cleanup(storage_type& storage)
{
storage.reset();
}
示例15: get_pointer
static pointer get_pointer(index_type i, storage_type& stg)
{
pointer p=stg.end();
p.set_address(i);
return p;
}