Esempio n. 1
0
void example_vector()
{
    // we need a threadpool, we will use all available cores
    auto scheduler = boost::asynchronous::make_shared_scheduler_proxy<boost::asynchronous::multiqueue_threadpool_scheduler<
                                                                        boost::asynchronous::lockfree_queue<>>>(boost::thread::hardware_concurrency());

    // create a vector, 1024 is a good default cutoff
    // create a vector of 100000 elements of size 100 * sizeof(int)
    boost::asynchronous::vector<long_type> v(scheduler, 1024 /* cutoff */, 100000 /* number of elements */, long_type(100));

    // push_back will force reallocation, then move all elements into a bigger buffer
    v.push_back(long_type(100));

    assert(v.size() == 100001);
    assert(v.back().data[0] == 42);

    // resize will allocate a new, bigger chunk of memory and move elements there
    v.resize(200000);

    // copy in parallel
    auto v1 = v;

    // compare also
    assert(v1 == v);

    // destructors will be called in parallel
    v.clear();
    v1.clear();
}
hdf5_oprimitive::write_hdf5_dataset
(
    unsigned long long const* t,
    std::size_t data_count,
    std::size_t object_number
)
{
    hdf5_datatype long_type(H5T_NATIVE_ULLONG);
    write_dataset_basic(t, data_count, long_type, object_number);
}
hdf5_iprimitive::read_hdf5_dataset
(
    unsigned long long* t,
    std::size_t data_count,
    std::size_t object_number
)
{
    hdf5_datatype long_type(H5T_NATIVE_ULLONG);
    read_dataset_basic(t, data_count, long_type, object_number);
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
hdf5_oprimitive::write_hdf5_dataset
(
    long long const* t,
    std::size_t data_count,
    std::size_t object_number
)
{
    hdf5_datatype long_type(H5T_NATIVE_LLONG);
    write_dataset_basic(t, data_count, long_type, object_number);
}
VerificationType VerificationType::from_tag(u1 tag) {
  switch (tag) {
    case ITEM_Top:     return bogus_type();
    case ITEM_Integer: return integer_type();
    case ITEM_Float:   return float_type();
    case ITEM_Double:  return double_type();
    case ITEM_Long:    return long_type();
    case ITEM_Null:    return null_type();
    default:
      ShouldNotReachHere();
      return bogus_type();
  }
}
Esempio n. 6
0
 static void
 call(Iterator const& first, Iterator const& last, long& attr)
 {
     Iterator first_ = first;
     qi::parse(first_, last, long_type(), attr);
 }