本文整理汇总了C++中libmaus::autoarray::AutoArray类的典型用法代码示例。如果您正苦于以下问题:C++ AutoArray类的具体用法?C++ AutoArray怎么用?C++ AutoArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AutoArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cleanup
void cleanup()
{
for ( uint64_t i = 0; i < alloclist.size(); ++i )
delete alloclist[i];
alloclist = libmaus::autoarray::AutoArray<element_type *>(0);
freelist = libmaus::autoarray::AutoArray<element_type *>(0);
freelistfill = 0;
}
示例2: get
element_type * get()
{
if ( ! freelistfill )
{
// allocate more alignment objects
libmaus::autoarray::AutoArray<element_type *> nalloclist(
std::max(
static_cast<uint64_t>(1),
static_cast<uint64_t>(2*alloclist.size())
)
,false
);
std::copy(alloclist.begin(),alloclist.end(),nalloclist.begin());
element_type * nullp = 0;
std::fill(nalloclist.begin()+alloclist.size(),nalloclist.end(),nullp);
for ( element_type ** p = nalloclist.begin()+alloclist.size();
p != nalloclist.end(); ++p )
*p = new element_type;
libmaus::autoarray::AutoArray<element_type *> nfreelist(
std::max(
static_cast<uint64_t>(1),
static_cast<uint64_t>(2*freelist.size())
)
,false
);
std::copy(freelist.begin(),freelist.end(),nfreelist.begin());
std::fill(nfreelist.begin()+freelist.size(),nfreelist.end(),nullp);
freelist = nfreelist;
for ( element_type ** p = nalloclist.begin()+alloclist.size();
p != nalloclist.end(); ++p )
freelist[freelistfill++] = *p;
alloclist = nalloclist;
}
return freelist[--freelistfill];
}
示例3: computeSymAccu
::libmaus::autoarray::AutoArray< std::pair<uint64_t,uint64_t> > computeSymAccu()
{
uint64_t numint = 0;
for ( uint64_t i = 0; i < index.size(); ++i )
numint += index[i].size();
::libmaus::autoarray::AutoArray<uint64_t> preaccu(numint+1);
uint64_t k = 0;
for ( uint64_t i = 0; i < index.size(); ++i )
for ( uint64_t j = 0; j < index[i].size(); ++j )
preaccu[k++] = index[i][j].vcnt;
preaccu.prefixSums();
::libmaus::autoarray::AutoArray< std::pair<uint64_t,uint64_t> > accu(numint);
for ( uint64_t i = 1; i < preaccu.size(); ++i )
accu[i-1] = std::pair<uint64_t,uint64_t>(
std::pair<uint64_t,uint64_t>(preaccu[i-1],preaccu[i])
);
return accu;
}
示例4: writeArray
static void writeArray(::libmaus::autoarray::AutoArray<data_type> const & A,
std::string const & outputfilename)
{
this_type out(outputfilename,64*1024);
for ( uint64_t i = 0; i < A.getN(); ++i )
out.put(A[i]);
out.flush();
}
示例5: checkSpace
void checkSpace(uint64_t const outlen)
{
// buffer overflow?
if ( freeSpace() < outlen )
{
flush();
assert ( opc == opa );
if ( outlen > outbuf.size() )
{
::libmaus::autoarray::AutoArray<uint8_t> newbuf(outlen);
std::copy( outbuf.begin(), outbuf.end(), newbuf.begin() );
outbuf = newbuf;
opa = outbuf.begin();
opc = opa;
ope = outbuf.end();
}
}
assert ( freeSpace() >= outlen );
}
示例6: atable
CharTermTable(uint8_t c)
: atable(257), table(atable.get()+1)
{
for ( unsigned int i = 0; i < 256; ++i )
table[i] = false;
table[-1] = true;
table[c] = true;
}
示例7: reset
void reset()
{
lnumsyms = 0;
minlen = std::numeric_limits<uint64_t>::max();
maxlen = 0;
pc = C.begin();
p = 0;
}
示例8: SynchronousGenericOutputPosix
SynchronousGenericOutputPosix(
std::string const & rfilename,
uint64_t const bufsize,
bool const truncate,
uint64_t const offset,
bool const rmetasync = true
)
: filename(rfilename), dirname(::libmaus::util::ArgInfo::getDirName(filename)), metasync(rmetasync),
B(bufsize), pa(B.get()), pc(pa), pe(pa+B.getN()),
fd ( -1 ),
totalwrittenbytes(0), totalwrittenwords(0)
{
while ( (fd = ::open(filename.c_str(), truncate ? (O_WRONLY|O_TRUNC|O_CREAT) : O_WRONLY , 0755 )) < 0 )
{
switch ( errno )
{
case EINTR:
{
std::cerr << "Restarting open() system call interupted by signal." << std::endl;
break;
}
default:
{
::libmaus::exception::LibMausException se;
se.getStream() << "Failed to open file "<< filename <<" in SynchronousGenericOutputPosix: " <<
strerror(errno);
se.finish();
throw se;
}
}
}
if ( lseek ( fd, offset, SEEK_SET) == static_cast<off_t>(-1) )
{
close(fd);
::libmaus::exception::LibMausException se;
se.getStream() << "Failed to seek " << filename << " in SynchronousGenericOutputPosix: " <<
strerror(errno);
se.finish();
throw se;
}
#if 0
std::cerr << "File " << filename << " opened for output in "
<< ::libmaus::util::Demangle::demangle<this_type>() << std::endl;
#endif
}
示例9: getPattern
void getPattern(pattern_type & pat, uint64_t i) const
{
GetObject G(T.begin()+(*dict)[i - dict->FI.low]);
::libmaus::fastx::CompactFastQContext C;
C.nextid = i;
::libmaus::fastx::CompactFastQDecoderBase::decodePattern<GetObject>(G,*H,C,pat);
pat.patid = i;
}
示例10: createFinalStream
uint64_t createFinalStream(stream_type & out)
{
flush();
uint64_t p = 0;
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,symbols); // n
p += root->serialize(out); // huffman code tree
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,contexts.size()); // number of bit vectors
std::vector<uint64_t> nodeposvec;
for ( uint64_t i = 0; i < contexts.size(); ++i )
{
nodeposvec.push_back(p);
uint64_t const blockswritten = contexts[i]->blockswritten;
uint64_t const datawordswritten = 6*blockswritten;
uint64_t const allwordswritten = 8*blockswritten;
contexts[i].reset();
tmpcnt.closeOutputTempFile(i);
// bits written
p += ::libmaus::serialize::Serialize<uint64_t>::serialize(out,64*datawordswritten);
// auto array header (words written)
p += ::libmaus::serialize::Serialize<uint64_t>::serialize(out,allwordswritten);
//std::string const filename = outputfilenames[i];
//::libmaus::aio::CheckedInputStream istr(filename);
std::istream & istr = tmpcnt.openInputTempFile(i);
// std::ifstream istr(filename.c_str(),std::ios::binary);
// std::cerr << "Copying " << allwordswritten << " from stream " << filename << std::endl;
::libmaus::util::GetFileSize::copy (istr, out, allwordswritten, sizeof(uint64_t));
p += allwordswritten * sizeof(uint64_t);
tmpcnt.closeInputTempFile(i);
// remove(filename.c_str());
}
uint64_t const indexpos = p;
p += ::libmaus::util::NumberSerialisation::serialiseNumberVector(out,nodeposvec);
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,indexpos);
out.flush();
return p;
}
示例11: A
BamSeqEncodeTable()
: A(256)
{
char const * s = "=ACMGRSVTWYHKDBN";
for ( uint64_t i = 0; i < A.size(); ++i )
A[i] = strlen(s);
for ( uint64_t i = 0; i < strlen(s); ++i )
A [ s[i] ] = i;
}
示例12: flush
void flush()
{
for ( uint64_t i = 0; i < contexts.size(); ++i )
{
contexts[i]->writeBit(0);
contexts[i]->flush();
// std::cerr << "Flushed context " << i << std::endl;
}
}
示例13: tTi
BgzfDeflateParallel(std::ostream & rdeflateout, uint64_t const rnumthreads, uint64_t const rnumbuffers, int const level, std::ostream * rdeflateindexostr = 0)
: deflategloblist(), deflatecontext(deflategloblist,rdeflateout,rnumbuffers,level,BgzfDeflateParallelContext::getDefaultDeflateGetCur(),rdeflateindexostr), T(rnumthreads)
{
for ( uint64_t i = 0; i < T.size(); ++i )
{
BgzfDeflateParallelThread::unique_ptr_type tTi(new BgzfDeflateParallelThread(deflatecontext));
T[i] = UNIQUE_PTR_MOVE(tTi);
T[i]->start();
}
}
示例14: ostr
SynchronousOutputBuffer8(std::string const & rfilename, uint64_t const bufsize, bool truncate = true)
: filename(rfilename), B(bufsize), pa(B.get()), pc(pa), pe(pa+B.getN())
{
if ( truncate )
{
std::ofstream ostr(filename.c_str(), std::ios::binary);
ostr.flush();
}
}
示例15: bufsize
AsynchronousBufferReader(
std::string const & filename,
uint64_t const rnumbufs,
uint64_t const rbufsize,
uint64_t const offset
)
: std::ifstream(filename.c_str()), bufsize(rnumbufs * rbufsize),
abuffer(bufsize), buffer(abuffer.get()), av(true)
{
std::ifstream::seekg(offset,std::ios::beg);
}