本文整理汇总了C++中id_type类的典型用法代码示例。如果您正苦于以下问题:C++ id_type类的具体用法?C++ id_type怎么用?C++ id_type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了id_type类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: hkdf
FileBase::FileBase(int data_fd, int meta_fd, const key_type& key_, const id_type& id_, bool check)
: m_lock()
, m_refcount(1)
, m_header()
, m_id(id_)
, m_data_fd(data_fd)
, m_meta_fd(meta_fd)
, m_dirty(false)
, m_check(check)
, m_stream()
, m_removed(false)
{
auto data_stream = std::make_shared<POSIXFileStream>(data_fd);
auto meta_stream = std::make_shared<POSIXFileStream>(meta_fd);
key_type data_key, meta_key;
byte generated_keys[KEY_LENGTH * 3];
hkdf(key_.data(),
key_.size(),
nullptr,
0,
id_.data(),
id_.size(),
generated_keys,
sizeof(generated_keys));
memcpy(data_key.data(), generated_keys, KEY_LENGTH);
memcpy(meta_key.data(), generated_keys + KEY_LENGTH, KEY_LENGTH);
memcpy(m_key.data(), generated_keys + 2 * KEY_LENGTH, KEY_LENGTH);
auto crypt = make_cryptstream_aes_gcm(
std::move(data_stream), std::move(meta_stream), data_key, meta_key, id_, check);
m_stream = crypt.first;
m_header = crypt.second;
read_header();
}
开发者ID:NextGenIntelligence,项目名称:securefs,代码行数:35,代码来源:files.cpp
示例2: get_converter
/***********************************************************************
* The converter functions
**********************************************************************/
convert::function_type convert::get_converter(
const id_type &id,
const priority_type prio
){
if (not get_table().has_key(id)) throw uhd::key_error(
"Cannot find a conversion routine for " + id.to_pp_string());
//find a matching priority
priority_type best_prio = -1;
for(priority_type prio_i: get_table()[id].keys()){
if (prio_i == prio) {
//----------------------------------------------------------------//
UHD_LOGGER_DEBUG("CONVERT") << "get_converter: For converter ID: " << id.to_pp_string()
<< " Using prio: " << prio;
;
//----------------------------------------------------------------//
return get_table()[id][prio];
}
best_prio = std::max(best_prio, prio_i);
}
//wanted a specific prio, didnt find
if (prio != -1) throw uhd::key_error(
"Cannot find a conversion routine [with prio] for " + id.to_pp_string());
//----------------------------------------------------------------//
UHD_LOGGER_DEBUG("CONVERT") << "get_converter: For converter ID: " << id.to_pp_string()
<< " Using prio: " << best_prio;
//----------------------------------------------------------------//
//otherwise, return best prio
return get_table()[id][best_prio];
}
开发者ID:EttusResearch,项目名称:uhd,代码行数:36,代码来源:convert_impl.cpp
示例3: get_entry
bool SimpleDirectory::get_entry(const std::string& name, id_type& id, int& type)
{
auto it = m_table.find(name);
if (it == m_table.end())
return false;
memcpy(id.data(), it->second.first.data(), id.size());
type = it->second.second;
return true;
}
开发者ID:NextGenIntelligence,项目名称:securefs,代码行数:9,代码来源:files.cpp
示例4: split
void split(
id_type const& from
, id_type const& target
, boost::uint16_t old_credit
)
{
cout << "[" << find_here() << "/" << target << "]: "
<< old_credit << ", " << get_credit(target) << ", "
<< get_management_type_name(target.get_management_type())
<< "\n" << flush;
// If we have more credits than the sender, then we're done.
if (old_credit < get_credit(target))
return;
id_type const here = find_here();
if (get_locality_id_from_id(from) == get_locality_id_from_id(here))
throw std::logic_error("infinite recursion detected, split was "
"invoked locally");
// Recursively call split on the sender locality.
async<split_action>(from, here, target, get_credit(target)).get();
cout << " after split: " << get_credit(target) << "\n" << flush;
}
开发者ID:,项目名称:,代码行数:26,代码来源:
示例5: putToFront
void SlotModel::putToFront(
const id_type<LayerModel>& layerId)
{
if(!layerId.val())
return;
if(layerId != m_frontLayerModelId)
{
m_frontLayerModelId = layerId;
emit layerModelPutToFront(layerId);
}
}
开发者ID:gitter-badger,项目名称:i-score,代码行数:12,代码来源:SlotModel.cpp
示例6: showRack
void AbstractConstraintViewModel::showRack(const id_type<RackModel>& rackId)
{
if(rackId.val().is_initialized())
{
m_shownRack = rackId;
emit rackShown(m_shownRack);
}
else
{
hideRack();
}
}
开发者ID:gitter-badger,项目名称:i-score,代码行数:13,代码来源:AbstractConstraintViewModel.cpp
示例7:
/***********************************************************************
* The registry functions
**********************************************************************/
void shd::convert::register_converter(
const id_type &id,
const function_type &fcn,
const priority_type prio
){
//get a reference to the function table
fcn_table_type &table = get_table();
//register the function if higher priority
if (not table.has_key(id) or table[id].prio < prio){
table[id].fcn = fcn;
table[id].prio = prio;
}
//----------------------------------------------------------------//
SHD_LOGV(always) << "register_converter: " << id.to_pp_string() << std::endl
<< " prio: " << prio << std::endl
<< std::endl
;
//----------------------------------------------------------------//
}
开发者ID:symplex,项目名称:SHD,代码行数:24,代码来源:convert_impl.cpp
示例8: get_credit
///////////////////////////////////////////////////////////////////////////////
// Helper functions.
inline boost::uint32_t get_credit(id_type const& id)
{
return get_credit_from_gid(id.get_gid());
}
开发者ID:,项目名称:,代码行数:6,代码来源:
示例9: TEST_CASE
#include <errno.h>
#include <vector>
#include <algorithm>
#include <set>
#include <fcntl.h>
#include <unistd.h>
TEST_CASE("File table")
{
using namespace securefs;
char dir_template[] = "/tmp/securefs_file_table.XXXXXXX";
mkdtemp(dir_template);
key_type master_key;
id_type null_id, file_id;
memset(master_key.data(), 0xFF, master_key.size());
memset(null_id.data(), 0, null_id.size());
memset(file_id.data(), 0xEE, file_id.size());
const char* xattr_name = "com.apple.FinderInfo...";
const securefs::PODArray<char, 32> xattr_value(0x11);
{
int tmp_fd = ::open(dir_template, O_RDONLY);
REQUIRE(tmp_fd >= 0);
FileTable table(tmp_fd, master_key, 0);
auto dir = dynamic_cast<Directory*>(table.create_as(null_id, FileBase::DIRECTORY));
dir->add_entry(".", null_id, FileBase::DIRECTORY);
dir->add_entry("..", null_id, FileBase::DIRECTORY);
dir->add_entry("hello", file_id, FileBase::REGULAR_FILE);
try
开发者ID:NextGenIntelligence,项目名称:securefs,代码行数:31,代码来源:test_files.cpp
示例10:
bool operator == (unsigned long lhs, id_type rhs)
{
return lhs == rhs.get_id();
}
开发者ID:mempko,项目名称:ncc,代码行数:4,代码来源:id.cpp
示例11: get_credit
///////////////////////////////////////////////////////////////////////////////
// helper functions
inline boost::int64_t get_credit(id_type const& id)
{
return hpx::naming::detail::get_credit_from_gid(id.get_gid());
}
开发者ID:7ev3n,项目名称:hpx,代码行数:6,代码来源:split_credit.cpp
示例12: exists
/// Checks if item with id exists
inline bool exists(const id_type& _id) const
{
return map_type::count(_id) != 0 && _id.valid();
}
开发者ID:WilstonOreo,项目名称:Tomo,代码行数:5,代码来源:Storage.hpp
示例13: hash_value
std::size_t hash_value(const id_type<model>& id)
{
Q_ASSERT(bool(id));
return *id.val();
}
开发者ID:gitter-badger,项目名称:i-score,代码行数:6,代码来源:IdentifiedObject.hpp
示例14: get_converter
/***********************************************************************
* The converter functions
**********************************************************************/
convert::function_type convert::get_converter(const id_type &id){
if (get_table().has_key(id)) return get_table()[id].fcn;
throw shd::key_error("Cannot find a conversion routine for " + id.to_pp_string());
}
开发者ID:symplex,项目名称:SHD,代码行数:7,代码来源:convert_impl.cpp
注:本文中的id_type类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论