((
value+ (blocksize - 1)) / blocksize);
67 #ifdef NCBI_OS_SOLARIS 89 template<
intALLOCSIZE>
121 if((back->size() + length + 1) > back->capacity()) {
126 const char* rv = back->data() + back->size();
127back->append(
data, length);
128back->append(&
m_Zero[0], 1);
140 string* pstr = *iter;
163 intblksz = ALLOCSIZE;
187 template<
intALLOCSIZE>
199vector<const char *>
tmp;
204 void Insert(
const char* x,
intlength)
253 template<
intSTR_SIZE>
259memset(
m_Data, 0, STR_SIZE);
283 for(
int i= 0;
i<STR_SIZE;
i++) {
303 return Cmp(other) < 0;
311 return Cmp(other) == 0;
334 for(
i= 0;
i<STR_SIZE;
i++) {
395 void Insert(
const char* x,
intL);
454 return! ((*this) == other);
Fixed-buffer string type.
CArrayString(const char *x, int L)
Construct from a string in a memory location.
bool operator<(const CArrayString< STR_SIZE > &other) const
Return true if this string is less than 'other'.
char m_Data[STR_SIZE]
Data for this string, NUL terminated iff less than STR_SIZE bytes.
const char * Data() const
Get a pointer to the start of this string's data.
int Cmp(const CArrayString< STR_SIZE > &other) const
Compare two strings (lexicographically).
CArrayString(const CArrayString< STR_SIZE > &other)
Copy constructor.
bool operator==(const CArrayString< STR_SIZE > &other) const
Return true if this string is less than 'other'.
CArrayString< STR_SIZE > & operator=(const CArrayString< STR_SIZE > &other)
Assign this string from another.
int Size() const
Get this string's length.
CArrayString()
Constructor.
Sortable packed array of null terminated strings.
CWriteDB_PackedBuffer< ALLOCSIZE > TThis
This object type.
CWriteDB_PackedBuffer()
Constructor.
void x_AddBlock()
Add an block of ALLOCSIZE bytes to the sorted string vector.
void Clear()
Free all held memory.
~CWriteDB_PackedBuffer()
Destructor.
char m_Zero[1]
Array containing NUL byte for convenience.
CWriteDB_PackedBuffer(const TThis &other)
Prevent copy constructor.
TThis & operator=(const TThis &other)
Prevent copy operator.
const char * Insert(const char *data, int length)
Insert a new string plus a NUL terminator.
vector< string * > m_Packed
Array of pointers to the start of the strings stored here.
Class providing iteration over string data.
Iterator(TPackedMap &pile, TPackedMap::iterator i)
Create an iterator.
TPackedMap::iterator m_Pos1
The iterator for the current TPacked object.
TPackedMap & m_Packed
The CWriteDB_PackedString container.
int m_Pos2
An integer to iterate within the TPacked object.
bool operator!=(Iterator &other)
Compare two iterators for inequality.
void Get(string &data)
Get the string pointed to by this iterator.
bool operator==(Iterator &other)
Compare two iterators for equality.
Iterator & operator++()
Move forward one item (prefix).
Packed string data container with sorting and iteration.
void Insert(const char *x, int L)
Insert string data into the container.
map< CArrayString< PREFIX >, CRef< TPacked > > TPackedMap
A map from the string prefixes to a packed buffer.
CWriteDB_PackedStrings< BLOCK > TPacked
A packed list of buffers.
Iterator End()
Get an iterator to the end of this collection.
void Sort()
Sort all contained data.
int Size() const
Return the number of contained entries.
CWriteDB_PackedBuffer< BLOCK > m_Buffer
Shared list of packed string buffers.
int m_Size
Number of elements stored in this container.
@ BLOCK
This is the amount of string capacity to request.
@ PREFIX
This is the number of bytes for the first level index.
void Clear()
Clear all objects from this container.
Iterator Begin()
Get an iterator to the beginning of this collection.
~CWriteDB_PackedSemiTree()
Destructor.
TPackedMap m_Packed
Map of string prefixes to packed string lists.
CWriteDB_PackedSemiTree()
Constructor.
Comparator for sorting null terminated strings.
bool operator()(const char *a, const char *b) const
Compare two null terminated strings.
Sortable packed array of strings, optimized for space.
const vector< const char * > & GetList()
Get the list of null terminated strings.
CWriteDB_PackedStrings(CWriteDB_PackedBuffer< ALLOCSIZE > &buffer)
Constructor.
CWriteDB_PackedStrings(const TThis &other)
Prevent copy constructor.
~CWriteDB_PackedStrings()
Destructor.
void Insert(const char *x, int length)
Insert string data - must be null terminated.
int Size()
Sort the keyloc array (in place).
CWriteDB_PackedBuffer< ALLOCSIZE > & m_Buffer
Reference to shared packed-buffer object.
TThis & operator=(const TThis &other)
Prevent assignment.
void Sort()
Sort the keyloc array (in place).
vector< const char * > m_KeyLoc
Pointers to the beginning of the strings stored here.
CWriteDB_PackedStrings< ALLOCSIZE > TThis
This object type.
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
constexpr auto sort(_Init &&init)
const GenericPointer< typename T::ValueType > T2 value
int strcmp(const char *str1, const char *str2)
static const BitmapCharRec ch1
static const BitmapCharRec ch2
USING_SCOPE(objects)
Import definitions from the objects namespace.
int s_DivideRoundUp(int value, int blocksize)
Divide by a number, rounding up to a whole integer.
int s_RoundUp(int value, int blocksize)
Round up to the next multiple of some number.
int WriteDB_FindSequenceLength(bool protein, const string &seq)
Compute length of sequence from raw packing.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4