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

Search Toolkit Book for CScoreVector

#include <algo/text/vector.hpp>

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

Public Types

typedef Key key_type
 
typedef Score score_type
 
typedef map< Key, Score > TVector
 
typedef TVector::value_type 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 atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 

Public Member Functions

 CScoreVector ()
 
virtual ~CScoreVector ()
 
 CScoreVector (const CScoreVector< Key, Score > &other)
 
 CScoreVector (const CRawScoreVector< Key, Score > &other)
 
CScoreVectoroperator= (const CScoreVector< Key, Score > &other)
 
CScoreVectoroperator= (const CRawScoreVector< Key, Score > &other)
 
virtual void Swap (CScoreVector< Key, Score > &other)
 
key_type GetId () const
 setup functions More...
 
void SetId (key_type uid)
 
size_t GetSize () const
 
Score Get (Key idx) const
 
void Set (Key idx, Score weight)
 
void Add (Key idx, Score weight=Score(1))
 
void TrimLength (float trim_pct)
 
void TrimCount (size_t max_words)
 
void TrimThresh (Score min_score)
 
void SubtractMissing (const CScoreVector< Key, Score > &other)
 
void AddScores (const CScoreVector< Key, Score > &other)
 
float Length2 () const
 math functions More...
 
float Length () const
 
void Normalize ()
 
void ProbNormalize ()
 
CScoreVector< Key, Score > & operator+= (const CScoreVector< Key, Score > &other)
 
CScoreVector< Key, Score > & operator-= (const CScoreVector< Key, Score > &other)
 
CScoreVector< Key, Score > & operator*= (Score val)
 
CScoreVector< Key, Score > & operator/= (Score val)
 
TVectorSet ()
 
const TVectorGet () const
 
STL-ish functions
void clear ()
 
bool empty () const
 
size_t size () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
iterator find (const Key &key)
 
const_iterator find (const Key &key) const
 
pair< iterator, boolinsert (const value_type &val)
 
iterator insert (iterator hint, const value_type &val)
 
void erase (iterator it)
 
void erase (const key_type &v)
 
template<typename OtherIterator >
void insert (OtherIterator it_begin, OtherIterator it_end)
 
- 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_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT 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 CScoreVector< Key, Score >

Definition at line 146 of file vector.hpp.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 154 of file vector.hpp.

◆ iterator

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

Definition at line 153 of file vector.hpp.

◆ key_type

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

Definition at line 149 of file vector.hpp.

◆ score_type

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

Definition at line 150 of file vector.hpp.

◆ TVector

template<class Key , class Score >
typedef map<Key, Score> CScoreVector< Key, Score >::TVector

Definition at line 151 of file vector.hpp.

◆ value_type

template<class Key , class Score >
typedef TVector::value_type CScoreVector< Key, Score >::value_type

Definition at line 152 of file vector.hpp.

Constructor & Destructor Documentation

◆ CScoreVector() [1/3]

template<class Key , class Score >
CScoreVector< Key, Score >::CScoreVector
inline

Definition at line 658 of file vector_impl.hpp.

References InitialValue(), and CScoreVector< Key, Score >::m_Uid.

◆ ~CScoreVector()

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

Definition at line 157 of file vector.hpp.

◆ CScoreVector() [2/3]

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

Definition at line 667 of file vector_impl.hpp.

◆ CScoreVector() [3/3]

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

Definition at line 676 of file vector_impl.hpp.

Member Function Documentation

◆ Add()

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

◆ AddScores()

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

◆ begin() [1/2]

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

◆ begin() [2/2]

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

Definition at line 751 of file vector_impl.hpp.

◆ clear()

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

◆ empty()

template<class Key , class Score >
bool CScoreVector< Key, Score >::empty
inline

Definition at line 828 of file vector_impl.hpp.

◆ end() [1/2]

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

◆ end() [2/2]

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

Definition at line 759 of file vector_impl.hpp.

◆ erase() [1/2]

template<class Key , class Score >
void CScoreVector< Key, Score >::erase ( const key_type v)
inline

Definition at line 820 of file vector_impl.hpp.

References ncbi::grid::netcache::search::fields::key.

◆ erase() [2/2]

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

Definition at line 812 of file vector_impl.hpp.

Referenced by CTextUtil::TrimStopWords().

◆ find() [1/2]

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

Definition at line 777 of file vector_impl.hpp.

References ncbi::grid::netcache::search::fields::key.

Referenced by CTextUtil::GetStemFrequencies().

◆ find() [2/2]

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

Definition at line 768 of file vector_impl.hpp.

References ncbi::grid::netcache::search::fields::key.

◆ Get() [1/2]

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

Definition at line 221 of file vector.hpp.

References CScoreVector< Key, Score >::m_Data.

◆ Get() [2/2]

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

Definition at line 847 of file vector_impl.hpp.

References map_checker< Container >::find().

◆ GetId()

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

setup functions

Definition at line 711 of file vector_impl.hpp.

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

◆ GetSize()

template<class Key , class Score >
size_t CScoreVector< Key, Score >::GetSize ( ) const
inline

◆ insert() [1/3]

template<class Key , class Score >
pair< typename CScoreVector< Key, Score >::iterator, bool > CScoreVector< Key, Score >::insert ( const value_type val)
inline

◆ insert() [2/3]

template<class Key , class Score >
CScoreVector< Key, Score >::iterator CScoreVector< Key, Score >::insert ( iterator  hint,
const value_type val 
)
inline

Definition at line 786 of file vector_impl.hpp.

◆ insert() [3/3]

template<class Key , class Score >
template<typename OtherIterator >
void CScoreVector< Key, Score >::insert ( OtherIterator  it_begin,
OtherIterator  it_end 
)
inline

◆ Length()

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

Definition at line 939 of file vector_impl.hpp.

◆ Length2()

template<class Key , class Score >
float CScoreVector< Key, Score >::Length2
inline

math functions

Definition at line 927 of file vector_impl.hpp.

References ITERATE, and len.

◆ Normalize()

template<class Key , class Score >
void CScoreVector< Key, Score >::Normalize
inline

Definition at line 873 of file vector_impl.hpp.

References ITERATE, and NON_CONST_ITERATE.

◆ operator*=()

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

Definition at line 947 of file vector_impl.hpp.

References NON_CONST_ITERATE, and val.

◆ operator+=()

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

◆ operator-=()

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

◆ operator/=()

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

Definition at line 958 of file vector_impl.hpp.

References NON_CONST_ITERATE, and val.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ ProbNormalize()

template<class Key , class Score >
void CScoreVector< Key, Score >::ProbNormalize
inline

Definition at line 891 of file vector_impl.hpp.

References NON_CONST_ITERATE.

◆ Set() [1/2]

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

Definition at line 220 of file vector.hpp.

References CScoreVector< Key, Score >::m_Data.

◆ Set() [2/2]

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

Definition at line 860 of file vector_impl.hpp.

References map_checker< Container >::find(), and weight.

◆ SetId()

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

Definition at line 719 of file vector_impl.hpp.

◆ size()

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

Definition at line 727 of file vector_impl.hpp.

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

◆ SubtractMissing()

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

◆ Swap()

template<class Key , class Score >
void CScoreVector< Key, Score >::Swap ( CScoreVector< Key, Score > &  other)
inlinevirtual

◆ TrimCount()

template<class Key , class Score >
void CScoreVector< Key, Score >::TrimCount ( size_t  max_words)
inline

◆ TrimLength()

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

◆ TrimThresh()

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

Definition at line 1105 of file vector_impl.hpp.

Member Data Documentation

◆ m_Data

template<class Key , class Score >
TVector CScoreVector< Key, Score >::m_Data
protected

◆ m_Uid

template<class Key , class Score >
key_type CScoreVector< Key, Score >::m_Uid
protected

The documentation for this class was generated from the following files:
Modified on Mon May 27 04:36:10 2024 by modify_doxy.py rev. 669887