NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Attributes | List of all members
CRawScoreVector< Key, Score > Class Template Reference

Search Toolkit Book for CRawScoreVector

class CRawScoreVector stores its data in a (sorted) STL vector this gives a better memory profile and ias easier to serialize More...

#include <algo/text/vector.hpp>

+ Inheritance diagram for CRawScoreVector< Key, Score >:
+ Collaboration diagram for CRawScoreVector< Key, Score >:

Public Types

typedef Key key_type
 
typedef Score score_type
 
typedef pair< Key, Score > TIdxScore
 
typedef vector< TIdxScoreTVector
 
typedef TIdxScore value_type
 
typedef TVector::iterator iterator
 
typedef TVector::const_iterator const_iterator
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1, eAllocFillZero, eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef CAtomicCounter TCounter
 Counter type is CAtomiCounter. More...
 
typedef TCounter::TValue TCount
 Alias for value type of counter. More...
 

Public Member Functions

 CRawScoreVector ()
 
virtual ~CRawScoreVector ()
 
 CRawScoreVector (const CScoreVector< Key, Score > &)
 
CRawScoreVectoroperator= (const CScoreVector< Key, Score > &)
 
 CRawScoreVector (const CRawScoreVector< Key, Score > &)
 
CRawScoreVectoroperator= (const CRawScoreVector< Key, Score > &)
 
virtual void Swap (CRawScoreVector< Key, Score > &other)
 
key_type GetId () const
 setup functions More...
 
void SetId (key_type uid)
 
Score Get (Key idx) const
 
void Set (Key idx, Score weight)
 
void Add (Key idx, Score weight=Score(1))
 
void Set (const_iterator begin, const_iterator end)
 
void TrimLength (float trim_pct)
 
void TrimCount (size_t max_words)
 
void TrimThresh (Score min_score)
 
void SortByScore ()
 force the vector to be sorted in order of descending score More...
 
void SortByIndex ()
 re-sort the vector by index. More...
 
float Length2 () const
 math functions More...
 
float Length () const
 
void Normalize ()
 
void ProbNormalize ()
 
CRawScoreVector< Key, Score > & operator+= (const CRawScoreVector< Key, Score > &other)
 
CRawScoreVector< Key, Score > & operator-= (const CRawScoreVector< Key, Score > &other)
 
CRawScoreVector< Key, Score > & operator*= (Score val)
 
CRawScoreVector< Key, Score > & operator/= (Score val)
 
TVectorSet ()
 
const TVectorGet () const
 
STL-ish functions
void clear ()
 
bool empty () const
 
size_t size () const
 
void reserve (size_t size)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
iterator find (const Key &key)
 
const_iterator find (const Key &key) const
 
void insert (const value_type &val)
 
void insert (iterator ins_before, const_iterator start, const_iterator stop)
 
void erase (iterator it)
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Protected Attributes

key_type m_Uid
 UID for this set. More...
 
TVector m_Data
 the data for this document More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CObject
static NCBI_NORETURN void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_NORETURN void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Detailed Description

template<class Key, class Score>
class CRawScoreVector< Key, Score >

class CRawScoreVector stores its data in a (sorted) STL vector this gives a better memory profile and ias easier to serialize

Definition at line 43 of file vector.hpp.

Member Typedef Documentation

template<class Key, class Score>
typedef TVector::const_iterator CRawScoreVector< Key, Score >::const_iterator

Definition at line 62 of file vector.hpp.

template<class Key, class Score>
typedef TVector::iterator CRawScoreVector< Key, Score >::iterator

Definition at line 61 of file vector.hpp.

template<class Key, class Score>
typedef Key CRawScoreVector< Key, Score >::key_type

Definition at line 56 of file vector.hpp.

template<class Key, class Score>
typedef Score CRawScoreVector< Key, Score >::score_type

Definition at line 57 of file vector.hpp.

template<class Key, class Score>
typedef pair<Key, Score> CRawScoreVector< Key, Score >::TIdxScore

Definition at line 58 of file vector.hpp.

template<class Key, class Score>
typedef vector<TIdxScore> CRawScoreVector< Key, Score >::TVector

Definition at line 59 of file vector.hpp.

template<class Key, class Score>
typedef TIdxScore CRawScoreVector< Key, Score >::value_type

Definition at line 60 of file vector.hpp.

Constructor & Destructor Documentation

template<class Key , class Score >
CRawScoreVector< Key, Score >::CRawScoreVector ( )
inline

Definition at line 91 of file vector_impl.hpp.

References InitialValue().

template<class Key, class Score>
virtual CRawScoreVector< Key, Score >::~CRawScoreVector ( )
inlinevirtual

Definition at line 65 of file vector.hpp.

template<class Key, class Score>
CRawScoreVector< Key, Score >::CRawScoreVector ( const CScoreVector< Key, Score > &  other)
inline

Definition at line 99 of file vector_impl.hpp.

template<class Key, class Score>
CRawScoreVector< Key, Score >::CRawScoreVector ( const CRawScoreVector< Key, Score > &  other)
inline

Definition at line 107 of file vector_impl.hpp.

Member Function Documentation

template<class Key, class Score>
void CRawScoreVector< Key, Score >::Add ( Key  idx,
Score  weight = Score(1) 
)
inline

Definition at line 363 of file vector_impl.hpp.

template<class Key , class Score >
CRawScoreVector< Key, Score >::iterator CRawScoreVector< Key, Score >::begin ( void  )
inline

Definition at line 191 of file vector_impl.hpp.

template<class Key , class Score >
CRawScoreVector< Key, Score >::const_iterator CRawScoreVector< Key, Score >::begin ( void  ) const
inline

Definition at line 209 of file vector_impl.hpp.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::clear ( void  )
inline

Definition at line 254 of file vector_impl.hpp.

References InitialValue().

Referenced by Decode< Uint4, float >(), and CRawScoreVector< Key, Score >::operator=().

template<class Key , class Score >
bool CRawScoreVector< Key, Score >::empty ( ) const
inline

Definition at line 296 of file vector_impl.hpp.

template<class Key , class Score >
CRawScoreVector< Key, Score >::iterator CRawScoreVector< Key, Score >::end ( void  )
inline

Definition at line 200 of file vector_impl.hpp.

template<class Key , class Score >
CRawScoreVector< Key, Score >::const_iterator CRawScoreVector< Key, Score >::end ( void  ) const
inline

Definition at line 218 of file vector_impl.hpp.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::erase ( iterator  it)
inline

Definition at line 246 of file vector_impl.hpp.

template<class Key, class Score >
CRawScoreVector< Key, Score >::iterator CRawScoreVector< Key, Score >::find ( const Key &  key)
inline

Definition at line 237 of file vector_impl.hpp.

template<class Key, class Score >
CRawScoreVector< Key, Score >::const_iterator CRawScoreVector< Key, Score >::find ( const Key &  key) const
inline

Definition at line 227 of file vector_impl.hpp.

template<class Key, class Score >
Score CRawScoreVector< Key, Score >::Get ( Key  idx) const
inline

Definition at line 304 of file vector_impl.hpp.

template<class Key, class Score>
const TVector& CRawScoreVector< Key, Score >::Get ( void  ) const
inline

Definition at line 131 of file vector.hpp.

References CRawScoreVector< Key, Score >::m_Data.

template<class Key , class Score >
Key CRawScoreVector< Key, Score >::GetId ( void  ) const
inline

setup functions

Definition at line 158 of file vector_impl.hpp.

Referenced by CScoreVector< Key, Score >::operator=().

template<class Key , class Score >
void CRawScoreVector< Key, Score >::insert ( const value_type val)
inline

Definition at line 263 of file vector_impl.hpp.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::insert ( iterator  ins_before,
const_iterator  start,
const_iterator  stop 
)
inline

Definition at line 278 of file vector_impl.hpp.

References _ASSERT, and i.

template<class Key , class Score >
float CRawScoreVector< Key, Score >::Length ( void  ) const
inline

Definition at line 513 of file vector_impl.hpp.

template<class Key , class Score >
float CRawScoreVector< Key, Score >::Length2 ( ) const
inline

math functions

Definition at line 501 of file vector_impl.hpp.

References ITERATE, and len.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::Normalize ( )
inline

Definition at line 521 of file vector_impl.hpp.

References NON_CONST_ITERATE.

template<class Key , class Score>
CRawScoreVector< Key, Score > & CRawScoreVector< Key, Score >::operator*= ( Score  val)
inline

Definition at line 627 of file vector_impl.hpp.

References NON_CONST_ITERATE.

template<class Key, class Score>
CRawScoreVector< Key, Score > & CRawScoreVector< Key, Score >::operator+= ( const CRawScoreVector< Key, Score > &  other)
inline

Definition at line 554 of file vector_impl.hpp.

References is_sorted(), and CRawScoreVector< Key, Score >::m_Data.

template<class Key, class Score>
CRawScoreVector< Key, Score > & CRawScoreVector< Key, Score >::operator-= ( const CRawScoreVector< Key, Score > &  other)
inline

Definition at line 595 of file vector_impl.hpp.

References CRawScoreVector< Key, Score >::m_Data.

template<class Key , class Score>
CRawScoreVector< Key, Score > & CRawScoreVector< Key, Score >::operator/= ( Score  val)
inline

Definition at line 639 of file vector_impl.hpp.

References NON_CONST_ITERATE.

template<class Key, class Score>
CRawScoreVector< Key, Score > & CRawScoreVector< Key, Score >::operator= ( const CScoreVector< Key, Score > &  vec)
inline
template<class Key, class Score>
CRawScoreVector< Key, Score > & CRawScoreVector< Key, Score >::operator= ( const CRawScoreVector< Key, Score > &  other)
inline
template<class Key , class Score >
void CRawScoreVector< Key, Score >::ProbNormalize ( )
inline

Definition at line 536 of file vector_impl.hpp.

References NON_CONST_ITERATE.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::reserve ( size_t  size)
inline

Definition at line 182 of file vector_impl.hpp.

Referenced by Decode< Uint4, float >().

template<class Key, class Score>
void CRawScoreVector< Key, Score >::Set ( Key  idx,
Score  weight 
)
inline

Definition at line 319 of file vector_impl.hpp.

template<class Key, class Score>
void CRawScoreVector< Key, Score >::Set ( const_iterator  begin,
const_iterator  end 
)
inline

Definition at line 327 of file vector_impl.hpp.

References is_sorted().

template<class Key, class Score>
TVector& CRawScoreVector< Key, Score >::Set ( void  )
inline

Definition at line 130 of file vector.hpp.

References CRawScoreVector< Key, Score >::m_Data.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::SetId ( key_type  uid)
inline

Definition at line 166 of file vector_impl.hpp.

template<class Key , class Score >
size_t CRawScoreVector< Key, Score >::size ( void  ) const
inline

Definition at line 174 of file vector_impl.hpp.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::SortByIndex ( )
inline

re-sort the vector by index.

This should normally never need to be done

Definition at line 489 of file vector_impl.hpp.

template<class Key , class Score >
void CRawScoreVector< Key, Score >::SortByScore ( )
inline

force the vector to be sorted in order of descending score

Definition at line 480 of file vector_impl.hpp.

template<class Key, class Score>
void CRawScoreVector< Key, Score >::Swap ( CRawScoreVector< Key, Score > &  other)
inlinevirtual
template<class Key , class Score >
void CRawScoreVector< Key, Score >::TrimCount ( size_t  max_words)
inline

Definition at line 420 of file vector_impl.hpp.

References max(), and prev().

template<class Key , class Score >
void CRawScoreVector< Key, Score >::TrimLength ( float  trim_pct)
inline

Definition at line 379 of file vector_impl.hpp.

References prev().

template<class Key , class Score>
void CRawScoreVector< Key, Score >::TrimThresh ( Score  min_score)
inline

Definition at line 452 of file vector_impl.hpp.

References prev().

Member Data Documentation

template<class Key, class Score>
TVector CRawScoreVector< Key, Score >::m_Data
protected
template<class Key, class Score>
key_type CRawScoreVector< Key, Score >::m_Uid
protected

UID for this set.

Definition at line 135 of file vector.hpp.

Referenced by CRawScoreVector< Key, Score >::operator=(), and CRawScoreVector< Key, Score >::Swap().


The documentation for this class was generated from the following files:
Modified on Tue Jan 16 15:49:31 2018 by modify_doxy.py rev. 546573