src/algo/text/vector_serial.cpp File Reference

#include <ncbi_pch.hpp>
#include <algo/text/vector.hpp>
#include <algo/text/vector_score.hpp>
#include <algorithm>
#include <math.h>
#include <set>
#include <connect/ncbi_conn_stream.hpp>
#include <util/compress/zlib.hpp>
#include <algo/text/vector_serial.hpp>
#include <corelib/rwstream.hpp>

Include dependency graph for vector_serial.cpp:

Go to the source code of this file.

Classes

class  CBufferWriter< Buffer >
class  CBufferWriterStream< Buffer >

Defines

#define ENCODE(Type)
#define INDEX_USE_GZIP

Functions

template<>
void Serialize< Uint4, float > (CNcbiOstream &ostr, const CRawScoreVector< Uint4, float > &vec)
 Uint4-based keys.
template<>
void Serialize< Uint4, float > (CNcbiOstream &ostr, const CScoreVector< Uint4, float > &vec)
template<>
void Deserialize< Uint4, float > (CNcbiIstream &istr, CRawScoreVector< Uint4, float > &vec)
template<>
void Deserialize< Uint4, float > (CNcbiIstream &istr, CScoreVector< Uint4, float > &vec)
template<>
void Encode< Uint4, float > (const CRawScoreVector< Uint4, float > &vec, vector< char > &data)
template<>
void Encode< Uint4, float > (const CRawScoreVector< Uint4, float > &vec, vector< unsigned char > &data)
template<>
void Encode< Uint4, float > (const CRawScoreVector< Uint4, float > &vec, CSimpleBuffer &data)
template<>
void Encode< Uint4, float > (const CScoreVector< Uint4, float > &vec, vector< char > &data)
template<>
void Encode< Uint4, float > (const CScoreVector< Uint4, float > &vec, CSimpleBuffer &data)
template<>
void Decode< Uint4, float > (const void *data, size_t size, CRawScoreVector< Uint4, float > &vec)
template<>
void Decode< Uint4, float > (const vector< char > &data, CRawScoreVector< Uint4, float > &vec)
template<>
void Decode< Uint4, float > (const vector< unsigned char > &data, CRawScoreVector< Uint4, float > &vec)
template<>
void Decode< Uint4, float > (const CSimpleBuffer &data, CRawScoreVector< Uint4, float > &vec)
template<>
void Decode< Uint4, float > (const vector< char > &data, CScoreVector< Uint4, float > &vec)
template<>
void Decode< Uint4, float > (const vector< unsigned char > &data, CScoreVector< Uint4, float > &vec)
template<>
void Decode< Uint4, float > (const CSimpleBuffer &data, CScoreVector< Uint4, float > &vec)
template<>
void Decode< Uint4, float > (const void *data, size_t size, CScoreVector< Uint4, float > &vec)
template<>
void Serialize< string, float > (CNcbiOstream &ostr, const CScoreVector< string, float > &vec)
 String based keys Raw vector encoding is not supported.
template<>
void Deserialize< string, float > (CNcbiIstream &istr, CScoreVector< string, float > &vec)
template<>
void Encode< string, float > (const CScoreVector< string, float > &vec, vector< char > &data)
template<>
void Encode< string, float > (const CScoreVector< string, float > &vec, vector< unsigned char > &data)
template<>
void Encode< string, float > (const CScoreVector< string, float > &vec, CSimpleBuffer &data)
template<>
void Decode< string, float > (const void *data, size_t size, CScoreVector< string, float > &vec)
template<>
void Decode< string, float > (const vector< char > &data, CScoreVector< string, float > &vec)
template<>
void Decode< string, float > (const vector< unsigned char > &data, CScoreVector< string, float > &vec)
template<>
void Decode< string, float > (const CSimpleBuffer &data, CScoreVector< string, float > &vec)


Define Documentation

#define ENCODE Type   ) 
 

Value:

template<> \
void Encode<Uint4, float>(const CRawScoreVector<Uint4, float>& vec, \
                          Type& data) \
{ \
    data.clear(); \
    data.reserve(sizeof(Uint4) + \
                 sizeof(CRawScoreVector<Uint4, float>::TVector::value_type) * vec.size()); \
 \
    CBufferWriter< Type > bw(data); \
    CBufferWriterStream< Type > ostr(bw); \
 \
    Uint4 uid = vec.GetId(); \
    ostr.write((const char*)&uid, sizeof(uid)); \
    ostr.write((const char*)&vec.Get()[0],  \
               sizeof(CRawScoreVector<Uint4, float>::TVector::value_type) * vec.Get().size()); \
}

Definition at line 144 of file vector_serial.cpp.

#define INDEX_USE_GZIP
 

Definition at line 289 of file vector_serial.cpp.


Function Documentation

template<>
void Decode< string, float > const CSimpleBuffer data,
CScoreVector< string, float > &  vec
 

template<>
void Decode< string, float > const vector< unsigned char > &  data,
CScoreVector< string, float > &  vec
 

template<>
void Decode< string, float > const vector< char > &  data,
CScoreVector< string, float > &  vec
 

template<>
void Decode< string, float > const void *  data,
size_t  size,
CScoreVector< string, float > &  vec
 

template<>
void Decode< Uint4, float > const void *  data,
size_t  size,
CScoreVector< Uint4, float > &  vec
 

template<>
void Decode< Uint4, float > const CSimpleBuffer data,
CScoreVector< Uint4, float > &  vec
 

template<>
void Decode< Uint4, float > const vector< unsigned char > &  data,
CScoreVector< Uint4, float > &  vec
 

template<>
void Decode< Uint4, float > const vector< char > &  data,
CScoreVector< Uint4, float > &  vec
 

template<>
void Decode< Uint4, float > const CSimpleBuffer data,
CRawScoreVector< Uint4, float > &  vec
 

template<>
void Decode< Uint4, float > const vector< unsigned char > &  data,
CRawScoreVector< Uint4, float > &  vec
 

template<>
void Decode< Uint4, float > const vector< char > &  data,
CRawScoreVector< Uint4, float > &  vec
 

template<>
void Decode< Uint4, float > const void *  data,
size_t  size,
CRawScoreVector< Uint4, float > &  vec
 

uid should be guaranteed

invalid UID; no data returned

data strip while valid

typedef CRawScoreVector<Uint4, float> TVector; cout << "read vector: " << vec.GetId() << ": "; ITERATE (TVector, iter, vec) { cout << " (" << iter->first << "," << iter->second << ")"; } cout << endl;

template<>
void Deserialize< string, float > CNcbiIstream istr,
CScoreVector< string, float > &  vec
 

template<>
void Deserialize< Uint4, float > CNcbiIstream istr,
CScoreVector< Uint4, float > &  vec
 

template<>
void Deserialize< Uint4, float > CNcbiIstream istr,
CRawScoreVector< Uint4, float > &  vec
 

template<>
void Encode< string, float > const CScoreVector< string, float > &  vec,
CSimpleBuffer data
 

template<>
void Encode< string, float > const CScoreVector< string, float > &  vec,
vector< unsigned char > &  data
 

template<>
void Encode< string, float > const CScoreVector< string, float > &  vec,
vector< char > &  data
 

template<>
void Encode< Uint4, float > const CScoreVector< Uint4, float > &  vec,
CSimpleBuffer data
 

template<>
void Encode< Uint4, float > const CScoreVector< Uint4, float > &  vec,
vector< char > &  data
 

template<>
void Encode< Uint4, float > const CRawScoreVector< Uint4, float > &  vec,
CSimpleBuffer data
 

template<>
void Encode< Uint4, float > const CRawScoreVector< Uint4, float > &  vec,
vector< unsigned char > &  data
 

template<>
void Encode< Uint4, float > const CRawScoreVector< Uint4, float > &  vec,
vector< char > &  data
 

template<>
void Serialize< string, float > CNcbiOstream ostr,
const CScoreVector< string, float > &  vec
 

String based keys Raw vector encoding is not supported.

template<>
void Serialize< Uint4, float > CNcbiOstream ostr,
const CScoreVector< Uint4, float > &  vec
 

template<>
void Serialize< Uint4, float > CNcbiOstream ostr,
const CRawScoreVector< Uint4, float > &  vec
 

Uint4-based keys.


Generated on Mon Sep 29 09:01:41 2008 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Sep 29 16:07:56 2008 by modify_doxy.py rev. 117643