• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ path_t类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中path_t的典型用法代码示例。如果您正苦于以下问题:C++ path_t类的具体用法?C++ path_t怎么用?C++ path_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了path_t类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: apath_limit_ref_length

void
apath_limit_ref_length(
    const unsigned target_ref_length,
    path_t& apath)
{
    unsigned ref_length(0);

    const unsigned as(apath.size());
    for (unsigned i(0); i<as; ++i)
    {
        path_segment& ps(apath[i]);
        if (! is_segment_type_ref_length(ps.type)) continue;
        ref_length += ps.length;

        if (ref_length < target_ref_length) continue;

        if (ref_length > target_ref_length)
        {
            const unsigned extra(ref_length - target_ref_length);
            assert(ps.length > extra);
            ps.length -= extra;
        }
        apath.resize(i+1);
        break;
    }
}
开发者ID:ctb,项目名称:quast,代码行数:26,代码来源:align_path.cpp


示例2: apath_append

void
apath_append(
    path_t& apath,
    const align_t seg_type,
    const unsigned length)
{
    if (apath.size() && apath.back().type == seg_type)
    {
        apath.back().length += length;
    }
    else
    {
        apath.emplace_back(seg_type,length);
    }
}
开发者ID:ctb,项目名称:quast,代码行数:15,代码来源:align_path.cpp


示例3: make_directory

    virtual int make_directory(entry_t& entry, const path_t& path) {
        const char_t* chars = 0;
        size_t length = 0;
        int err = 1;

        if ((chars = path.directory().chars(length)) && (0 < length)) {
            const char_t* dchars = chars;
            size_t dlength = length;
            sub_directories_t sub_directories;

            EV_LOG_MESSAGE_INFO("make directory \"" << chars << "\"...");
            for (bool exists = false; !exists; ) {
                string_t directory(dchars, dlength);

                EV_LOG_MESSAGE_INFO("directory \"" << directory.chars() << "\" exists?...");
                if (!(exists = entry.exists(directory.chars()))) {
                    sub_directory_t sub_directory(dchars, dlength);

                    EV_LOG_MESSAGE_INFO("...directory \"" << directory.chars() << "\" does not exist");
                    sub_directories.push_front(sub_directory);
                    if ((dchars = parent_directory(dchars, dlength, path))) {
                        continue;
                    }
                } else {
                    EV_LOG_MESSAGE_INFO("...directory \"" << directory.chars() << "\" exists");
                }
                break;
            }
            err = make_directories(sub_directories, entry, path);
        }
        return err;
    }
开发者ID:medusade,项目名称:evelation,代码行数:32,代码来源:main.hpp


示例4: is_segment_swap_start

bool
is_segment_swap_start(const path_t& apath,
                      unsigned i)
{
    using namespace ALIGNPATH;

    bool is_insert(false);
    bool is_delete(false);

    const unsigned as(apath.size());
    for (; i<as; ++i)
    {
        if     (apath[i].type == INSERT)
        {
            is_insert=true;
        }
        else if (apath[i].type == DELETE)
        {
            is_delete=true;
        }
        else
        {
            break;
        }
    }

    return (is_insert && is_delete);
}
开发者ID:ctb,项目名称:quast,代码行数:28,代码来源:align_path.cpp


示例5: fh

  hasher::digest_rc md5_hasher::hex_digest(path_t const& fp) const {
    std::ifstream fh(fp.c_str(), std::ifstream::in | std::ifstream::binary);
    digest_rc rc(hex_digest(fh));
    fh.close();

    return rc;
  }
开发者ID:amireh,项目名称:Karazeh,代码行数:7,代码来源:md5_hasher.cpp


示例6: is_clipped_front

bool
is_clipped_front(const path_t& apath)
{
    const unsigned as(apath.size());
    if (as==0) return false;
    if ((apath[0].type == SOFT_CLIP) || (apath[0].type == HARD_CLIP)) return true;
    return false;
}
开发者ID:ctb,项目名称:quast,代码行数:8,代码来源:align_path.cpp


示例7: target_path

    virtual int copy_file_to_hash
    (const entry_t& source, const path_t& target, hash_t& hash) {
        entry_t& entry = target_entry_;
        string_t target_path(target.chars());
        const char_t* chars = 0;
        int err = 1;

        if ((append_hash_name_to_target_path_) && (chars = hash.name())) {
            target_path.append(&target.extension_separator(), 1);
            target_path.append(hash_name_prefix_);
            target_path.append(chars);
            target_path.append(hash_name_suffix_);
        }

        if ((entry.exists(chars = target_path.chars()))) {
            if ((write_overwrite != write_) && (write_append != write_)) {
                errf("target file \"%s\" already exists\n", chars);
            } else {
                fs::entry_type type = fs::entry_type_none;

                switch (type = entry.type()) {
                case fs::entry_type_file:
                    err = copy_file_to_file_hash(source, entry, hash);
                    break;
                default:
                    break;
                }
            }
        } else {
            if (!(err = make_directory(entry, target))) {
                entry.set_path(chars);
                err = copy_file_to_file_hash(source, entry, hash);
            } else {
                errf("failed to make directory \"%s\"\n", target.directory().chars());
            }
        }
        if (!(err) && (!(to_same != to_) || !(target_modified_))) {
            if ((entry.set_times_to_set(source))) {
                if ((entry.set_times_set())) {
                } else {
                }
            }
        }
        return err;
    }
开发者ID:medusade,项目名称:evelation,代码行数:45,代码来源:main.hpp


示例8: apath_limit_read_length

void
apath_limit_read_length(
    const unsigned target_read_start,
    const unsigned target_read_end,
    path_t& apath)
{
    bool isStartSet(false);

    unsigned read_length(0);
    const unsigned as(apath.size());
    unsigned startSegment(0);
    unsigned endSegment(as);
    for (unsigned i(0); i<as; ++i)
    {
        path_segment& ps(apath[i]);
        if (! is_segment_type_read_length(ps.type)) continue;
        read_length += ps.length;

        if ((! isStartSet) && (read_length > target_read_start))
        {
            {
                const unsigned extra(ps.length - (read_length - target_read_start));
                assert(ps.length > extra);
                ps.length -= extra;
            }
            startSegment=i;
            isStartSet=true;
        }

        if (read_length >= target_read_end)
        {
            if (read_length > target_read_end)
            {
                const unsigned extra(read_length - target_read_end);
                assert(ps.length > extra);
                ps.length -= extra;
            }
            endSegment=i+1;
            break;
        }
    }
    apath = path_t(apath.begin()+startSegment,apath.begin()+endSegment);
}
开发者ID:ctb,项目名称:quast,代码行数:43,代码来源:align_path.cpp


示例9: apath_push

static
void
apath_push(path_t& apath,
           path_segment& ps,
           const align_t t)
{

    if ( (0==ps.length) || (ps.type==t) ) return;
    apath.push_back(ps);
    ps.clear();
}
开发者ID:ctb,项目名称:quast,代码行数:11,代码来源:align_path_match_descriptor.cpp


示例10: read

void read(std::basic_string<CharT>& buf, path_t const& path)
{
    std::basic_string<char> buf_;
    std::basic_ifstream<char> ifs(path.string());
    ifs.imbue(std::locale(""));

    if (!ifs) {
        throw file_error("failed to open file " + path.string());
    }

    // get length
    ifs.seekg(0, std::ios::end);
    auto const len = ifs.tellg();
    ifs.seekg(0, std::ios::beg);

    buf_.resize(len);
    ifs.read(&buf_[0], len);

    buf = to<std::basic_string<CharT>>(buf_);
}
开发者ID:saki7,项目名称:saya,代码行数:20,代码来源:file.hpp


示例11: apath_to_bam_cigar

void
apath_to_bam_cigar(const path_t& apath,
                   uint32_t* bam_cigar) {

    const unsigned as(apath.size());
    for (unsigned i(0); i<as; ++i) {
        const path_segment& ps(apath[i]);
        assert(ps.type != NONE);
        bam_cigar[i] = (ps.length<<BAM_CIGAR_SHIFT | (static_cast<uint32_t>(ps.type)-1));
    }
}
开发者ID:BadSeby,项目名称:isaac_variant_caller,代码行数:11,代码来源:align_path_bam_util.cpp


示例12: stat_filesize

  uint64_t file_manager::stat_filesize(path_t const& p) const
  {
    std::ifstream fp(p.string().c_str(), std::ios_base::binary);
    if (!fp.is_open() || !fp.good())
      return 0;

    uint64_t size = stat_filesize(fp);

    fp.close();

    return size;
  }
开发者ID:amireh,项目名称:Karazeh,代码行数:12,代码来源:file_manager.cpp


示例13: export_md_to_apath

void
export_md_to_apath(const char* md,
                   const bool is_fwd_strand,
                   path_t& apath,
                   const bool is_edge_deletion_error)
{

    // to make best use of previous code, we parse the MD in the
    // alignment direction and then orient apath to the forward strand
    // as a second step if required
    //
    assert(NULL != md);

    apath.clear();
    export_md_to_apath_impl(md,apath);

    unsigned as(apath.size());

    if ( ((as>0) and (apath.front().type == DELETE)) or
         ((as>1) and (apath.back().type == DELETE)) )
    {
        std::ostringstream oss;
        if (is_edge_deletion_error)
        {
            oss << "ERROR: ";
        }
        else
        {
            oss << "WARNING: ";
        }
        oss << "alignment path: " << apath_to_cigar(apath) << " contains meaningless edge deletion.\n";
        if (is_edge_deletion_error)
        {
            throw blt_exception(oss.str().c_str());
        }
        else
        {
            log_os << oss.str();
            path_t apath2;
            for (unsigned i(0); i<as; ++i)
            {
                if (((i==0) or ((i+1)==as)) and
                    apath[i].type == DELETE) continue;
                apath2.push_back(apath[i]);
            }
            apath=apath2;
            as=apath.size();
        }
    }

    if ( (not is_fwd_strand) and (as>1) )
    {
        std::reverse(apath.begin(),apath.end());
    }
}
开发者ID:ctb,项目名称:quast,代码行数:55,代码来源:align_path_match_descriptor.cpp


示例14:

inline
bool operator==(path_t const &a, path_t const &b)
{
    if (!a || !b)
        return a.c_str() == b.c_str();
    return a.length() == b.length() && ::strcmp(a.c_str(), b.c_str()) == 0;
}
开发者ID:007gzs,项目名称:android-platform-ndk,代码行数:7,代码来源:path.hpp


示例15: bam_cigar_to_apath

void
bam_cigar_to_apath(const uint32_t* bam_cigar,
                   const unsigned n_cigar,
                   path_t& apath) {

    // this assertion isn't really required...
    //    assert(n_cigar>0);
    apath.resize(n_cigar);
    for (unsigned i(0); i<n_cigar; ++i) {
        apath[i].length=(bam_cigar[i]>>BAM_CIGAR_SHIFT);
        apath[i].type = static_cast<align_t>(1+(bam_cigar[i]&BAM_CIGAR_MASK));
    }
}
开发者ID:BadSeby,项目名称:isaac_variant_caller,代码行数:13,代码来源:align_path_bam_util.cpp


示例16: get_path

	    accessor get_path(path_t const& path) const {
		accessor next = *this;
		for (size_t i = 0; i < path.size() && next.is_valid; ++i) {
		    const std::string* key;
		    const int* idx;
		    if ((key = boost::get<std::string>(&path[i]))) {
			next = next[*key];
		    } else if ((idx = boost::get<int>(&path[i]))) {
			next = next[*idx];
		    }
		}
		return next;
	    }
开发者ID:ot,项目名称:semi_index,代码行数:13,代码来源:json_semi_index.hpp


示例17: is_seq_swap

bool
is_seq_swap(const path_t& apath)
{
    const unsigned as(apath.size());
    for (unsigned i(0); (i+1)<as; ++i)
    {
        if (is_segment_type_indel(apath[i].type) &&
            is_segment_type_indel(apath[i+1].type))
        {
            return true;
        }
    }
    return false;
}
开发者ID:ctb,项目名称:quast,代码行数:14,代码来源:align_path.cpp


示例18: cigar_to_apath

void
cigar_to_apath(const char* cigar,
               path_t& apath)
{
    using illumina::blt_util::parse_unsigned;

    assert(NULL != cigar);

    apath.clear();

    path_segment lps;
    const char* cptr(cigar);
    while (*cptr)
    {
        path_segment ps;
        // expect sequences of digits and cigar codes:
        if (! isdigit(*cptr)) unknown_cigar_error(cigar,cptr);
        ps.length = parse_unsigned(cptr);
        ps.type = cigar_code_to_segment_type(*cptr);
        if (ps.type == NONE) unknown_cigar_error(cigar,cptr);
        cptr++;
        if ((ps.type == PAD) || (ps.length == 0)) continue;

        if (ps.type != lps.type)
        {
            if (lps.type != NONE) apath.push_back(lps);
            lps = ps;
        }
        else
        {
            lps.length += ps.length;
        }
    }

    if (lps.type != NONE) apath.push_back(lps);
}
开发者ID:ctb,项目名称:quast,代码行数:36,代码来源:align_path.cpp


示例19: apath_clip_adder

void
apath_clip_adder(path_t& apath,
                 const unsigned hc_lead,
                 const unsigned hc_trail,
                 const unsigned sc_lead,
                 const unsigned sc_trail)
{
    path_t apath2;
    path_segment ps;
    if (hc_lead>0)
    {
        ps.type = HARD_CLIP;
        ps.length = hc_lead;
        apath2.push_back(ps);
    }
    if (sc_lead>0)
    {
        ps.type = SOFT_CLIP;
        ps.length = sc_lead;
        apath2.push_back(ps);
    }
    apath2.insert(apath2.end(),apath.begin(),apath.end());
    if (sc_trail>0)
    {
        ps.type = SOFT_CLIP;
        ps.length = sc_trail;
        apath2.push_back(ps);
    }
    if (hc_trail>0)
    {
        ps.type = HARD_CLIP;
        ps.length = hc_trail;
        apath2.push_back(ps);
    }
    apath=apath2;
}
开发者ID:ctb,项目名称:quast,代码行数:36,代码来源:align_path.cpp


示例20: copy_file

    virtual int copy_file(const entry_t& source, const path_t& target) {
        entry_t& entry = target_entry_;
        const char_t* chars = 0;
        int err = 1;

        if ((entry.exists(chars = target.chars()))) {
            if ((write_overwrite != write_) && (write_append != write_)) {
                errf("target file \"%s\" already exists\n", chars);
            } else {
                fs::entry_type type = fs::entry_type_none;

                switch (type = entry.type()) {
                case fs::entry_type_file:
                    err = copy_file_to_file(source, entry);
                    break;
                default:
                    break;
                }
            }
        } else {
            if (!(err = make_directory(entry, target))) {
                entry.set_path(chars);
                err = copy_file_to_file(source, entry);
            } else {
                errf("failed to make directory \"%s\"\n", target.directory().chars());
            }
        }
        if (!(err) && (!(to_same != to_) || !(target_modified_))) {
            if ((entry.set_times_to_set(source))) {
                if ((entry.set_times_set())) {
                } else {
                }
            }
        }
        return err;
    }
开发者ID:medusade,项目名称:evelation,代码行数:36,代码来源:main.hpp



注:本文中的path_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ path_type类代码示例发布时间:2022-05-31
下一篇:
C++ path类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap