本文整理汇总了C++中params类的典型用法代码示例。如果您正苦于以下问题:C++ params类的具体用法?C++ params怎么用?C++ params使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了params类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: copy_vector
// Copy vector from builtin backend.
static boost::shared_ptr<vector>
copy_vector(typename builtin<real>::vector const &x, const params &prm)
{
precondition(!prm.context().empty(), "Empty VexCL context!");
return boost::make_shared<vector>(prm.context(), x);
}
开发者ID:ttnghia,项目名称:amgcl,代码行数:8,代码来源:vexcl.hpp
示例2: GlyphAtlasGL
//////////////////////////////////////////////////////////////////
// fastuidraw::gl::GlyphAtlasGL methods
fastuidraw::gl::GlyphAtlasGL::
GlyphAtlasGL(const params &P):
GlyphAtlas(TexelStoreGL::create(P.texel_store_dimensions(), P.delayed()),
GeometryStoreGL::create(P.number_floats(), P.delayed(), P.alignment()))
{
m_d = FASTUIDRAWnew GlyphAtlasGLPrivate(P);
}
开发者ID:cjcappel,项目名称:fastuidraw,代码行数:9,代码来源:glyph_atlas_gl.cpp
示例3: create_vector
// Create vector of the specified size.
static boost::shared_ptr<vector>
create_vector(size_t size, const params &prm)
{
precondition(!prm.context().empty(), "Empty VexCL context!");
return boost::make_shared<vector>(prm.context(), size);
}
开发者ID:ttnghia,项目名称:amgcl,代码行数:8,代码来源:vexcl.hpp
示例4: wrapper
wrapper(size_t n, params prm = params(),
const backend_params &bprm = backend_params(),
const InnerProduct &inner_product = InnerProduct()
)
: s(prm.get("type", runtime::solver::bicgstab)), handle(0)
{
if (!prm.erase("type")) AMGCL_PARAM_MISSING("type");
switch(s) {
#define AMGCL_RUNTIME_SOLVER(type) \
case type: \
handle = static_cast<void*>(new amgcl::solver::type<Backend, InnerProduct>(n, prm, bprm, inner_product)); \
break
AMGCL_RUNTIME_SOLVER(cg);
AMGCL_RUNTIME_SOLVER(bicgstab);
AMGCL_RUNTIME_SOLVER(bicgstabl);
AMGCL_RUNTIME_SOLVER(gmres);
AMGCL_RUNTIME_SOLVER(lgmres);
AMGCL_RUNTIME_SOLVER(fgmres);
AMGCL_RUNTIME_SOLVER(idrs);
#undef AMGCL_RUNTIME_SOLVER
default:
throw std::invalid_argument("Unsupported solver type");
}
}
开发者ID:ddemidov,项目名称:amgcl,代码行数:29,代码来源:runtime.hpp
示例5: setup
int ctable_factory_base::setup(int dfd, const char * name, const params & config, dtype::ctype key_type)
{
istr base;
params base_config;
if(!config.get("base", &base) || !config.get("base_config", &base_config))
return NULL;
return setup(base, dfd, name, base_config, key_type);
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:8,代码来源:ctable_factory.cpp
示例6: loadParams
params loadParams(const std::string& filename, params& p) {
CSVInput input(filename);
CSVHeader header(filename);
p.setInput(input);
p.setHeader(header);
return p;
}
开发者ID:HanumathRao,项目名称:hyrise,代码行数:8,代码来源:shortcuts.cpp
示例7: lemon_interface
lemon_interface(const params &p) {
state_ = ::ParseAlloc(&pooled::tracked_byte_alloc);
if (p.trace()) {
#if NERVE_TRACE_PARSER
::ParseTrace(stdout, detail::parse_trace_prefix);
#endif
}
context_ = p.context();
}
开发者ID:bnkr,项目名称:nerve,代码行数:9,代码来源:lemon_interface.hpp
示例8: create
int exist_dtable::create(int dfd, const char * file, const params & config, dtable::iter * source, const ktable * shadow)
{
int e_dfd, r;
params base_config, dnebase_config;
const dtable_factory * base = dtable_factory::lookup(config, "base");
const dtable_factory * dnebase = dtable_factory::lookup(config, "dnebase");
if(!base || !dnebase)
return -ENOENT;
if(!config.get("base_config", &base_config, params()))
return -EINVAL;
if(!config.get("dnebase_config", &dnebase_config, params()))
return -EINVAL;
if(!source_shadow_ok(source, shadow))
return -EINVAL;
r = mkdirat(dfd, file, 0755);
if(r < 0)
return r;
e_dfd = openat(dfd, file, O_RDONLY);
if(e_dfd < 0)
goto fail_open;
/* just to be sure */
source->first();
{
dtable_skip_iter<dne_skip_test> base_source(source);
r = base->create(e_dfd, "base", base_config, &base_source, NULL);
if(r < 0)
goto fail_base;
}
source->first();
{
full_ktable full_shadow(source);
nonshadow_skip_test skip_test(shadow);
dtable_skip_iter<nonshadow_skip_test> dnebase_source(source, skip_test);
r = dnebase->create(e_dfd, "dnebase", dnebase_config, &dnebase_source, &full_shadow);
if(r < 0)
goto fail_dnebase;
}
close(e_dfd);
return 0;
fail_dnebase:
util::rm_r(e_dfd, "base");
fail_base:
close(e_dfd);
fail_open:
unlinkat(dfd, file, AT_REMOVEDIR);
return (r < 0) ? r : -1;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:53,代码来源:exist_dtable.cpp
示例9: deinit
int deltaint_dtable::init(int dfd, const char * file, const params & config, sys_journal * sysj)
{
const dtable_factory * base_factory;
const dtable_factory * ref_factory;
params base_config, ref_config;
int di_dfd;
if(base)
deinit();
base_factory = dtable_factory::lookup(config, "base");
ref_factory = dtable_factory::lookup(config, "ref");
if(!base_factory || !ref_factory)
return -ENOENT;
if(!config.get("base_config", &base_config, params()))
return -EINVAL;
if(!config.get("ref_config", &ref_config, params()))
return -EINVAL;
di_dfd = openat(dfd, file, O_RDONLY);
if(di_dfd < 0)
return di_dfd;
base = base_factory->open(di_dfd, "base", base_config, sysj);
if(!base)
goto fail_base;
reference = ref_factory->open(di_dfd, "ref", ref_config, sysj);
if(!reference)
goto fail_reference;
ktype = base->key_type();
cmp_name = base->get_cmp_name();
assert(ktype == reference->key_type());
scan_iter = base->iterator();
if(!scan_iter)
goto fail_scan;
ref_iter = reference->iterator();
if(!ref_iter)
goto fail_iter;
close(di_dfd);
return 0;
fail_iter:
delete scan_iter;
scan_iter = NULL;
fail_scan:
reference->destroy();
reference = NULL;
fail_reference:
base->destroy();
base = NULL;
fail_base:
close(di_dfd);
return -1;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:53,代码来源:deltaint_dtable.cpp
示例10: copy_matrix
// Copy matrix from builtin backend.
static boost::shared_ptr<matrix>
copy_matrix(boost::shared_ptr< typename builtin<real>::matrix > A, const params &prm)
{
precondition(!prm.context().empty(), "Empty VexCL context!");
const typename builtin<real>::matrix &a = *A;
BOOST_AUTO(Aptr, a.ptr_data());
BOOST_AUTO(Acol, a.col_data());
BOOST_AUTO(Aval, a.val_data());
return boost::make_shared<matrix>(prm.context(), rows(*A), cols(*A), Aptr, Acol, Aval);
}
开发者ID:ttnghia,项目名称:amgcl,代码行数:14,代码来源:vexcl.hpp
示例11: amg
amg(
const Matrix &A,
const params &prm = params(),
const backend_params &backend_prm = backend_params()
)
: coarsening(prm.get("coarsening.type", runtime::coarsening::smoothed_aggregation)),
relaxation(prm.get("relaxation.type", runtime::relaxation::spai0)),
handle(0)
{
runtime::detail::process_amg<Backend>(
coarsening, relaxation,
runtime::detail::amg_create<Backend, Matrix>(handle, A, prm, backend_prm)
);
}
开发者ID:ttnghia,项目名称:amgcl,代码行数:14,代码来源:runtime.hpp
示例12: deinit
int exception_dtable::init(int dfd, const char * file, const params & config, sys_journal * sysj)
{
const dtable_factory * base_factory;
const dtable_factory * alt_factory;
params base_config, alt_config;
int excp_dfd;
if(base || alt)
deinit();
base_factory = dtable_factory::lookup(config, "base");
alt_factory = dtable_factory::lookup(config, "alt");
if(!base_factory || !alt_factory)
return -EINVAL;
if(!config.get("base_config", &base_config, params()))
return -EINVAL;
if(!config.get("alt_config", &alt_config, params()))
return -EINVAL;
if(!config.get_blob_or_string("reject_value", &reject_value))
return -EINVAL;
/* the reject value must exist, because nonexistent values
* can get pruned out if the shadow does not require them */
if(!reject_value.exists())
return -EINVAL;
excp_dfd = openat(dfd, file, O_RDONLY);
if(excp_dfd < 0)
return excp_dfd;
base = base_factory->open(excp_dfd, "base", base_config, sysj);
if(!base)
goto fail_base;
alt = alt_factory->open(excp_dfd, "alt", alt_config, sysj);
if(!alt)
goto fail_alt;
ktype = base->key_type();
if(ktype != alt->key_type())
goto fail_ktype;
cmp_name = base->get_cmp_name();
close(excp_dfd);
return 0;
fail_ktype:
alt->destroy();
alt = NULL;
fail_alt:
base->destroy();
base = NULL;
fail_base:
close(excp_dfd);
return -1;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:49,代码来源:exception_dtable.cpp
示例13: read
inline void read(const FileNode& node, params &x, const params & default_value = params())
{
if(node.empty())
x = default_value;
else
x.read(node);
}
开发者ID:RocHCI,项目名称:ScreenReaderTracker,代码行数:7,代码来源:detect-rectangle.cpp
示例14: deinit
int btree_dtable::init(int dfd, const char * file, const params & config, sys_journal * sysj)
{
const dtable_factory * factory;
params base_config;
int r, bt_dfd;
if(base)
deinit();
factory = dtable_factory::lookup(config, "base");
if(!factory)
return -ENOENT;
if(!config.get("base_config", &base_config, params()))
return -EINVAL;
if(!factory->indexed_access(base_config))
return -ENOSYS;
bt_dfd = openat(dfd, file, O_RDONLY);
if(bt_dfd < 0)
return bt_dfd;
base = factory->open(bt_dfd, "base", base_config, sysj);
if(!base)
goto fail_base;
ktype = base->key_type();
assert(ktype == dtype::UINT32);
cmp_name = base->get_cmp_name();
/* open the btree */
btree = rofile::open<BTREE_PAGE_KB, 8>(bt_dfd, "btree");
if(!btree)
goto fail_open;
r = btree->read_type(0, &header);
if(r < 0)
goto fail_format;
/* check the header */
if(header.magic != BTREE_DTABLE_MAGIC || header.version != BTREE_DTABLE_VERSION)
goto fail_format;
if(header.page_size != BTREE_PAGE_SIZE || header.pageno_size != BTREE_PAGENO_SIZE)
goto fail_format;
if(header.key_size != BTREE_KEY_SIZE || header.index_size != BTREE_INDEX_SIZE)
goto fail_format;
/* 1 -> uint32, and even with an empty table there will be a root page */
if(header.key_type != 1 || !header.root_page)
goto fail_format;
close(bt_dfd);
return 0;
fail_format:
delete btree;
fail_open:
base->destroy();
base = NULL;
fail_base:
close(bt_dfd);
return -1;
}
开发者ID:GSathish,项目名称:casamia-datastore,代码行数:54,代码来源:btree_dtable.cpp
示例15: create
int simple_stable::create(int dfd, const char * name, const params & config, dtype::ctype key_type)
{
int md_dfd, r;
params meta_config, data_config;
const dtable_factory * meta = dtable_factory::lookup(config, "meta");
const ctable_factory * data = ctable_factory::lookup(config, "data");
if(!meta || !data)
return -ENOENT;
if(!config.get("meta_config", &meta_config, params()))
return -EINVAL;
if(!config.get("data_config", &data_config, params()))
return -EINVAL;
r = mkdirat(dfd, name, 0755);
if(r < 0)
return r;
md_dfd = openat(dfd, name, O_RDONLY);
if(md_dfd < 0)
{
r = md_dfd;
goto fail_open;
}
/* the metadata is keyed by named properties (strings) */
r = meta->create(md_dfd, "st_meta", meta_config, dtype::STRING);
if(r < 0)
goto fail_meta;
r = data->create(md_dfd, "st_data", data_config, key_type);
if(r < 0)
goto fail_data;
close(md_dfd);
return 0;
fail_data:
util::rm_r(md_dfd, "st_meta");
fail_meta:
close(md_dfd);
fail_open:
unlinkat(dfd, name, AT_REMOVEDIR);
return r;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:41,代码来源:simple_stable.cpp
示例16: deinit
int simple_stable::init(int dfd, const char * name, const params & config, sys_journal * sysj)
{
int r = -1;
params meta_config, data_config;
const dtable_factory * meta = dtable_factory::lookup(config, "meta");
const ctable_factory * data = ctable_factory::lookup(config, "data");
if(md_dfd >= 0)
deinit();
assert(column_map.empty());
if(!meta || !data)
return -ENOENT;
if(!config.get("meta_config", &meta_config, params()))
return -EINVAL;
if(!config.get("data_config", &data_config, params()))
return -EINVAL;
md_dfd = openat(dfd, name, O_RDONLY);
if(md_dfd < 0)
return md_dfd;
dt_meta = meta->open(md_dfd, "st_meta", meta_config, sysj);
if(!dt_meta)
goto fail_meta;
ct_data = data->open(md_dfd, "st_data", data_config, sysj);
if(!ct_data)
goto fail_data;
/* check sanity? */
r = load_columns();
if(r < 0)
goto fail_check;
return 0;
fail_check:
delete ct_data;
fail_data:
dt_meta->destroy();
fail_meta:
close(md_dfd);
md_dfd = -1;
return r;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:41,代码来源:simple_stable.cpp
示例17: wrapper
wrapper(const amgcl::mpi::distributed_matrix<Backend> &A,
params prm, const backend_params &bprm = backend_params())
: r(prm.get("type", runtime::relaxation::spai0)), handle(0)
{
if (!prm.erase("type")) AMGCL_PARAM_MISSING("type");
switch(r) {
#define AMGCL_RELAX_DISTR(type) \
case runtime::relaxation::type: \
handle = static_cast<void*>(new amgcl::mpi::relaxation::type<Backend>(A, prm, bprm)); \
break
#define AMGCL_RELAX_LOCAL_DISTR(type) \
case runtime::relaxation::type: \
handle = call_constructor<amgcl::relaxation::type>(A, prm, bprm); \
break;
#define AMGCL_RELAX_LOCAL_LOCAL(type) \
case runtime::relaxation::type: \
handle = call_constructor<amgcl::relaxation::type>(*A.local(), prm, bprm); \
break;
AMGCL_RELAX_DISTR(spai0);
AMGCL_RELAX_LOCAL_DISTR(chebyshev);
AMGCL_RELAX_LOCAL_LOCAL(damped_jacobi);
AMGCL_RELAX_LOCAL_LOCAL(ilu0);
AMGCL_RELAX_LOCAL_LOCAL(iluk);
AMGCL_RELAX_LOCAL_LOCAL(ilut);
AMGCL_RELAX_LOCAL_LOCAL(spai1);
AMGCL_RELAX_LOCAL_LOCAL(gauss_seidel);
#undef AMGCL_RELAX_LOCAL_LOCAL
#undef AMGCL_RELAX_LOCAL_DISTR
#undef AMGCL_RELAX_DISTR
default:
throw std::invalid_argument("Unsupported relaxation type");
}
}
开发者ID:tkoziara,项目名称:parmec,代码行数:40,代码来源:runtime.hpp
示例18: deinit
int cache_dtable::init(int dfd, const char * file, const params & config, sys_journal * sysj)
{
int r;
const dtable_factory * factory;
params base_config;
if(base)
deinit();
if(!config.get("cache_size", &r, 0) || r < 0)
return -EINVAL;
cache_size = r;
factory = dtable_factory::lookup(config, "base");
if(!factory)
return -EINVAL;
if(!config.get("base_config", &base_config, params()))
return -EINVAL;
base = factory->open(dfd, file, base_config, sysj);
if(!base)
return -1;
ktype = base->key_type();
cmp_name = base->get_cmp_name();
return 0;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:22,代码来源:cache_dtable.cpp
示例19: create
int btree_dtable::create(int dfd, const char * file, const params & config, dtable::iter * source, const ktable * shadow)
{
int bt_dfd, r;
params base_config;
dtable * base_dtable;
const dtable_factory * base = dtable_factory::lookup(config, "base");
if(!base)
return -ENOENT;
if(!config.get("base_config", &base_config, params()))
return -EINVAL;
if(!base->indexed_access(base_config))
return -ENOSYS;
if(!source_shadow_ok(source, shadow))
return -EINVAL;
r = mkdirat(dfd, file, 0755);
if(r < 0)
return r;
bt_dfd = openat(dfd, file, O_RDONLY);
if(bt_dfd < 0)
goto fail_open;
r = base->create(bt_dfd, "base", base_config, source, shadow);
if(r < 0)
goto fail_create;
base_dtable = base->open(bt_dfd, "base", base_config, NULL);
if(!base_dtable)
goto fail_reopen;
r = write_btree(bt_dfd, "btree", base_dtable);
if(r < 0)
goto fail_write;
base_dtable->destroy();
close(bt_dfd);
return 0;
fail_write:
base_dtable->destroy();
fail_reopen:
util::rm_r(bt_dfd, "base");
fail_create:
close(bt_dfd);
fail_open:
unlinkat(dfd, file, AT_REMOVEDIR);
return (r < 0) ? r : -1;
}
开发者ID:GSathish,项目名称:casamia-datastore,代码行数:50,代码来源:btree_dtable.cpp
示例20: load_dividers
int keydiv_dtable::load_dividers(const params & config, size_t dt_count, divider_list * list, bool skip_check)
{
std::vector<T> data;
if(!config.get_seq("divider_", NULL, 0, true, &data))
return -1;
/* if there are n dtables, there should be n - 1 dividers */
if(dt_count && data.size() != dt_count - 1)
return -EINVAL;
list->clear();
for(size_t i = 0; i < data.size(); i++)
list->push_back(dtype((C) data[i]));
/* dividers should be in increasing order, but we can't check blobs
* since they might need a comparator that we don't have yet */
if(!skip_check)
for(size_t i = 1; i < list->size(); i++)
if((*list)[i - 1].compare((*list)[i]) >= 0)
return -EINVAL;
return 0;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:19,代码来源:keydiv_dtable.cpp
注:本文中的params类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论