本文整理汇总了C++中libmaus2::autoarray::AutoArray::get方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoArray::get方法的具体用法?C++ AutoArray::get怎么用?C++ AutoArray::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libmaus2::autoarray::AutoArray
的用法示例。
在下文中一共展示了AutoArray::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: broadcastSend
void broadcastSend(
::libmaus2::network::Interface const & interface,
unsigned short const broadcastport,
::libmaus2::autoarray::AutoArray < ::libmaus2::network::ClientSocket::unique_ptr_type > & secondarysockets,
unsigned int const packsize = 508
) const
{
std::cerr << "Writing FI...";
for ( uint64_t i = 0; i < secondarysockets.size(); ++i )
secondarysockets[i]->writeString(FI.serialise());
std::cerr << "done.";
std::cerr << "Broadcasting designators...";
::libmaus2::network::UDPSocket::sendArrayBroadcast(interface,broadcastport,
secondarysockets,designators.get(),designators.size(),packsize);
std::cerr << "done.";
std::cerr << "Broadcasting shortpointers...";
::libmaus2::network::UDPSocket::sendArrayBroadcast(interface,broadcastport,
secondarysockets,shortpointers.get(),shortpointers.size(),packsize);
std::cerr << "done.";
std::cerr << "Broadcasting longpointers...";
::libmaus2::network::UDPSocket::sendArrayBroadcast(interface,broadcastport,
secondarysockets,longpointers.get(),longpointers.size(),packsize);
std::cerr << "done.";
std::cerr << "Broadcasting text...";
::libmaus2::network::UDPSocket::sendArrayBroadcast(interface,broadcastport,
secondarysockets,text.get(),text.size(),packsize);
std::cerr << "done.";
}
示例2: putTerm
/**
* put terminator num
*
* @param num terminator number
**/
void putTerm(uint64_t num)
{
uint8_t * p = termbuf.get() + termbuf.getN();
for ( unsigned int i = 0; i < expo; ++i )
{
*(--p) = (num % base) + 1;
num /= base;
}
assert ( p == termbuf.get() );
for ( unsigned int i = 0; i < expo; ++i )
put( *(p++) );
}
示例3: filename
/**
* constructor
*
* @param rfilename file name
* @param rnumbuffers number of buffers
* @param rbufsize size of each buffer
* @param roffset initial file offset
**/
AsynchronousBufferReader ( std::string const & rfilename, uint64_t rnumbuffers = 16, uint64_t rbufsize = 32, uint64_t roffset = 0 )
: filename(rfilename),
fd( open(filename.c_str(),O_RDONLY ) ),
numbuffers(rnumbuffers), bufsize(rbufsize),
bufferspace ( numbuffers * bufsize ),
buffers ( numbuffers ),
contexts(numbuffers), low(0), high(0), offset(roffset)
{
if ( fd < 0 )
{
::libmaus2::exception::LibMausException se;
se.getStream() << "::libmaus2::aio::AsynchronousBufferReader: Failed to open file " << filename << ": " << strerror(errno);
se.finish();
/*
std::cerr << se.s << std::endl;
kill ( getpid(), SIGSTOP );
*/
throw se;
}
for ( unsigned int i = 0; i < numbuffers; ++i )
buffers[i] = bufferspace.get() + i*bufsize;
while ( high < numbuffers )
enqueRead();
}
示例4: dst
SocketOutputBufferTemplate(
::libmaus2::network::SocketBase * rdst,
int const rtag,
uint64_t const bufsize)
: dst(rdst), tag(rtag), B(bufsize), pa(B.get()), pc(pa), pe(pa+B.getN())
{
}
示例5: SynchronousGenericOutput
/**
* constructor by output stream
*
* @param out output stream
* @param bufsize output buffer size
**/
SynchronousGenericOutput(std::ostream & out, uint64_t const bufsize)
: B(bufsize), pa(B.get()), pc(pa), pe(pa+B.getN()),
W(out),
datawrittentofile(0)
{
}
示例6: fillBuffer
void fillBuffer()
{
in.read( reinterpret_cast<char *>(B.get()), n * sizeof(data_type) );
assert ( in.gcount() % sizeof(data_type) == 0 );
c = 0;
f = in.gcount() / sizeof(data_type);
}
示例7: 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;
}
示例8: W
Array864(iterator a, iterator e)
{
n = e-a;
if ( n )
{
B = ::libmaus2::autoarray::AutoArray<data_type>((n+63)/64);
writer_type W(B.get());
for ( iterator i = a; i != e; ++i )
W.writeBit( *i < 256 );
W.flush();
::libmaus2::rank::ERank222B::unique_ptr_type tR(new ::libmaus2::rank::ERank222B(B.get(), B.size()*64));
R = UNIQUE_PTR_MOVE(tR);
uint64_t const n8 = R->rank1(n-1);
uint64_t const n64 = R->rank0(n-1);
A8 = ::libmaus2::autoarray::AutoArray<uint8_t>(n8,false);
A64 = ::libmaus2::autoarray::AutoArray<uint64_t>(n64,false);
uint64_t j = 0;
for ( iterator i = a; i != e; ++i,++j )
if ( *i < 256 )
A8[ R->rank1(j)-1 ] = *i;
else
A64[ R->rank0(j)-1 ] = *i;
#if 0
j = 0;
for ( iterator i = a; i != e; ++i, ++j )
assert ( (*this)[j] == *i );
#endif
#if defined(ARRAY864DEBUG)
#if defined(_OPENMP)
#pragma omp parallel for
#endif
for ( int64_t i = 0; i < static_cast<int64_t>(n); ++i )
assert ( (*this)[i] == a[i] );
#endif
}
}
示例9:
SocketFastReaderBase(::libmaus2::network::SocketBase * rsocket, uint64_t const bufsize)
:
socket(rsocket),
B(bufsize),
pa(B.get()),
pc(pa),
pe(pc),
c(0)
{
}
示例10: bufsize
/**
* constructor
*
* @param filename file name
* @param rnumbufs number of buffers
* @param rbufsize size of each buffer
* @param offset initial file offset
**/
AsynchronousBufferReader(
std::string const & filename,
uint64_t const rnumbufs,
uint64_t const rbufsize,
uint64_t const offset
)
: libmaus2::aio::InputStreamInstance(filename), bufsize(rnumbufs * rbufsize),
abuffer(bufsize), buffer(abuffer.get()), av(true)
{
libmaus2::aio::InputStreamInstance::seekg(offset,std::ios::beg);
}
示例11:
/**
* access operator
*
* @param i index of element to be accessed
* @return element at index i
**/
uint64_t operator[](uint64_t const i) const
{
if ( i >= n )
{
::libmaus2::exception::LibMausException se;
se.getStream() << "Access of element " << i << " >= " << n << " in Array864::operator[]";
se.finish();
throw se;
}
if ( ::libmaus2::bitio::getBit(B.get(),i) )
return A8[R->rank1(i)-1];
else
return A64[R->rank0(i)-1];
}
示例12: LRU
FileBunchLRU ( std::vector < std::string > const & rfilenames, uint64_t rlrusize = 1024)
: LRU(rlrusize), lrusize(rlrusize), filenames ( rfilenames ), mapping(filenames.size()), rmapping(lrusize), files(lrusize)
{
std::fill ( mapping.get(), mapping.get() + mapping.getN(), lrusize );
}
示例13: writeContents
void writeContents()
{
// std::cerr << "writing buffer of " << f << " words." << std::endl;
out.write( reinterpret_cast<char const *>(B.get()), f * sizeof(data_type) );
f = 0;
}
示例14: writeBuffer
void writeBuffer()
{
if ( pc-pa )
dst->writeMessage ( tag , B.get() , pc-pa );
pc = pa;
}
示例15: lcs
static LCSResult lcs(std::string const & a, std::string const & b)
{
/* concatenate a and b into string c */
std::string c(a.size()+b.size()+2,' ');
for ( uint64_t i = 0; i < a.size(); ++i )
c[i] = a[i]+2;
c[a.size()] = 0;
for ( uint64_t i = 0; i < b.size(); ++i )
c[a.size()+1+i] = b[i]+2;
c[c.size()-1] = 1;
// allocate suffix sorting
::libmaus2::autoarray::AutoArray<int32_t> SA(c.size(),false);
// perform suffix sorting
typedef ::libmaus2::suffixsort::DivSufSort<32,uint8_t *,uint8_t const *,int32_t *,int32_t const *,alphabet_size+2> sort_type;
sort_type::divsufsort(reinterpret_cast<uint8_t const *>(c.c_str()), SA.get(), c.size());
// compute LCP array
::libmaus2::autoarray::AutoArray<int32_t> LCP = ::libmaus2::suffixsort::SkewSuffixSort<uint8_t,int32_t>::lcpByPlcp(
reinterpret_cast<uint8_t const *>(c.c_str()), c.size(), SA.get());
// compute psv and nsv arrays for simulating parent operation on suffix tree
::libmaus2::autoarray::AutoArray<int32_t> const prev = ::libmaus2::sv::PSV::psv(LCP.get(),LCP.size());
::libmaus2::autoarray::AutoArray<int32_t> const next = ::libmaus2::sv::NSV::nsv(LCP.get(),LCP.size());
#if defined(LCS_DEBUG)
for ( uint64_t i = 0; i < c.size(); ++i )
{
std::cerr << i << "\t" << LCP[i] << "\t" << prev[i] << "\t" << next[i] << "\t";
for ( std::string::const_iterator ita = c.begin()+SA[i]; ita != c.end(); ++ita )
if ( isalnum(*ita) )
std::cerr << *ita;
else
std::cerr << "<" << static_cast<int>(*ita) << ">" ;
std::cerr << std::endl;
}
std::cerr << "---" << std::endl;
#endif
int32_t const n = c.size();
// queue all suffix tree leafs
std::deque < QNode > Q;
for ( int32_t i = 0; i < n; ++i )
Q.push_back ( QNode(i,i,0, (SA[i]< static_cast<int32_t>(a.size()+1)) ? 1:2, 1 ) );
// construct hash for tree nodes we have seen so far
typedef ::libmaus2::util::unordered_set < QNode , HashQNode >::type hash_type;
typedef hash_type::iterator hash_iterator_type;
typedef hash_type::const_iterator hash_const_iterator_type;
hash_type H(n);
// we simulate a bottom up traversal of the generalised suffix tree for a and b
while ( Q.size() )
{
// get node and compute parent
QNode const I = Q.front(); Q.pop_front();
QNode P = parent(I,LCP.get(),prev.get(),next.get(),n);
// have we seen this node before?
hash_iterator_type it = H.find(P);
// no, insert it
if ( it == H.end() )
{
it = H.insert(P).first;
}
// yes, update symbol mask and extend visited interval
else
{
it->symmask |= I.symmask;
it->fill += (I.right-I.left+1);
}
// if this is not the root and the node is full (we have seen all its children),
// then put it in the queue
if ( P.right-P.left + 1 < n && it->isFull() )
Q.push_back(P);
}
// maximum lcp value
int32_t maxlcp = 0;
uint32_t maxpos_a = 0;
uint32_t maxpos_b = 0;
// consider all finished nodes
for ( hash_const_iterator_type it = H.begin(); it != H.end(); ++it )
{
#if defined(LCS_DEBUG)
std::cerr << *it << std::endl;
#endif
// we need to have nodes from both strings a and b under this
// node (sym mask has bits for 1 and 2 set) and the lcp value must be
// larger than what we already have
if (
it->symmask == 3 && it->depth > maxlcp
)
{
//.........这里部分代码省略.........