本文整理汇总了C++中group类的典型用法代码示例。如果您正苦于以下问题:C++ group类的具体用法?C++ group怎么用?C++ group使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: to_string
std::string to_string(const group& x) {
if (x == invalid_group)
return "<invalid-group>";
std::string result = x.get()->module().name();
result += ":";
result += x.get()->identifier();
return result;
}
示例2: CAF_LOG_TRACE
void local_actor::leave(const group& what) {
CAF_LOG_TRACE(CAF_TSARG(what));
if (what == invalid_group) {
return;
}
if (detach(abstract_group::subscription_token{what.ptr()}) > 0) {
what->unsubscribe(address());
}
}
示例3: search_reqs
bool search_reqs( group gp, const std::string &txt )
{
return std::any_of( gp.begin(), gp.end(), [&]( const typename group::value_type & opts ) {
return std::any_of( opts.begin(),
opts.end(), [&]( const typename group::value_type::value_type & e ) {
return lcmatch( e.to_string(), txt );
} );
} );
}
示例4: join
/// Causes this actor to subscribe to the group `what`.
/// The group will be unsubscribed if the actor finishes execution.
void join(const group& what) {
CAF_LOG_TRACE(CAF_ARG(what));
if (what == invalid_group)
return;
if (what->subscribe(dptr()->ctrl()))
subscriptions_.emplace(what);
}
示例5: CPPA_LOG_TRACE
void local_actor::join(const group& what) {
CPPA_LOG_TRACE(CPPA_TSARG(what));
if (what && m_subscriptions.count(what) == 0) {
CPPA_LOG_DEBUG("join group: " << to_string(what));
m_subscriptions.insert(std::make_pair(what, what->subscribe(this)));
}
}
示例6: inspect
error inspect(serializer& f, group& x) {
std::string mod_name;
auto ptr = x.get();
if (!ptr)
return f(mod_name);
mod_name = ptr->module().name();
auto e = f(mod_name);
return e ? e : ptr->save(f);
}
示例7: error
inline void group::open(group const& other, std::string const& name)
{
if (hid_ >= 0) {
throw error("h5xx::group object is already in use");
}
if (exists_group(other, name)) {
hid_ = H5Gopen(other.hid(), name.c_str(), H5P_DEFAULT);
}
else {
hid_t lcpl_id = H5Pcreate(H5P_LINK_CREATE); // create group creation property list
H5Pset_create_intermediate_group(lcpl_id, 1); // set intermediate link creation
hid_ = H5Gcreate(other.hid(), name.c_str(), lcpl_id, H5P_DEFAULT, H5P_DEFAULT);
}
if (hid_ < 0){
throw error("creating or opening group \"" + name + "\"");
}
}
示例8: exists_group
/**
* return true if group "name" exists in group "grp"
*/
inline bool exists_group(group const& grp, std::string const& name)
{
hid_t hid = grp.hid();
H5E_BEGIN_TRY {
hid = H5Gopen(hid, name.c_str(), H5P_DEFAULT);
if (hid > 0) {
H5Gclose(hid);
}
} H5E_END_TRY
return (hid > 0);
}
示例9: h5_write
void h5_write(group g, std::string const& name, std::string const& value) {
datatype strdatatype = H5Tcopy(H5T_C_S1);
// auto status = H5Tset_size (strdatatype, H5T_VARIABLE);
//auto status = H5Tset_size(strdatatype, value.size() + 1);
H5Tset_size(strdatatype, value.size() + 1);
dataspace space = H5Screate(H5S_SCALAR);
dataset ds = g.create_dataset(name, strdatatype, space);
auto err = H5Dwrite(ds, strdatatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)(value.c_str()));
if (err < 0) TRIQS_RUNTIME_ERROR << "Error writing the string named" << name << " in the group" << g.name();
}
示例10: parallel_for_workitem
void parallel_for_workitem(const group<Dimensions> &g,
ParallelForFunctor f) {
#if defined(_OPENMP) && (!defined(TRISYCL_NO_BARRIER) && !defined(_MSC_VER))
/* To implement barriers With OpenMP, one thread is created for each
work-item in the group and thus an OpenMP barrier has the same effect
of an OpenCL barrier executed by the work-items in a workgroup
The issue is that the parallel_for_workitem() execution is slow even
when nd_item::barrier() is not used
*/
range<Dimensions> l_r = g.get_nd_range().get_local_range();
id<Dimensions> id_l_r { l_r };
auto tot = l_r.size();
if constexpr (Dimensions == 1) {
#pragma omp parallel for collapse(1) schedule(static) num_threads(tot)
for (size_t i = 0; i < l_r.get(0); ++i) {
T_Item index{g.get_nd_range()};
index.set_local(i);
index.set_global(index.get_local_id() + id_l_r * g.get_id());
f(index);
}
} else if constexpr (Dimensions == 2) {
示例11: h5_read
void h5_read(group g, std::string const& name, std::string& value) {
dataset ds = g.open_dataset(name);
h5::dataspace d_space = H5Dget_space(ds);
int rank = H5Sget_simple_extent_ndims(d_space);
if (rank != 0) TRIQS_RUNTIME_ERROR << "Reading a string and got rank !=0";
size_t size = H5Dget_storage_size(ds);
datatype strdatatype = H5Tcopy(H5T_C_S1);
H5Tset_size(strdatatype, size);
//auto status = H5Tset_size(strdatatype, size);
// auto status = H5Tset_size (strdatatype, H5T_VARIABLE);
std::vector<char> buf(size + 1, 0x00);
auto err = H5Dread(ds, strdatatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf[0]);
if (err < 0) TRIQS_RUNTIME_ERROR << "Error reading the string named" << name << " in the group" << g.name();
value = "";
value.append(&(buf.front()));
}
示例12: object_handle_
object::object(const group& object_) : object_handle_(object_.native_handle())
{
}
示例13: assert
~node_graph()
{
assert(root_group_.child_count() == 0);
}
示例14: group_ptr_
data_callback::data_callback( group& grp )
: group_ptr_( grp.item_mgt() )
, owner_(grp)
{
}
示例15: node_graph
/** \brief ctor
*
* - initialize root node */
node_graph(void):
node_set(node_set_type::bucket_traits(node_buckets, node_set_bucket_count))
{
node_set.insert(root_group_);
root_group_.add_ref();
}