2 #ifndef EPT_POPCON_POPCON_H
3 #define EPT_POPCON_POPCON_H
28 #include <tagcoll/diskindex/mmap.h>
51 Score(
float score) : offset(offset), score(score) {}
72 class Popcon :
public tagcoll::diskindex::MMap
74 struct GeneralInfo :
public tagcoll::diskindex::MMap
79 tagcoll::diskindex::MasterMMap mastermmap;
85 const Score* structByIndex(
size_t idx)
const
87 if (idx >= 0 && idx <
size())
88 return (
Score*)m_buf + idx;
99 bool hasData()
const {
return m_timestamp != 0; }
108 return ((
Score*)m_buf)->offset /
sizeof(
Score);
118 std::string
name(
size_t idx)
const
120 const Score* s = structByIndex(idx);
121 if (s == 0)
return std::string();
122 return std::string(m_buf + s->
offset);
128 const Score* s = structByIndex(idx);
float operator[](const std::string &name) const
Get the score structure by package name.
Definition: popcon.h:146
Definition: popconindexer.h:38
size_t submissions() const
Return the total number of popcon submissions.
Definition: popcon.h:102
Maps Packages to IDs and vice-versa.
Definition: popcon.h:72
size_t size() const
Get the number of packages in the index.
Definition: popcon.h:105
float scoreByName(const std::string &name) const
Get the score structure by package name.
Definition: popcon.cc:69
-*- C++ -*- (c) 2006, 2007 Petr Rockai me@mornfall.net
Definition: apt.cc:43
float scoreByIndex(size_t idx) const
Get the score by index.
Definition: popcon.h:126
Popcon()
Definition: popcon.cc:43
Score(float score)
Definition: popcon.h:51
bool hasData() const
Return true if this data source has data, false if it's empty.
Definition: popcon.h:99
float score
Definition: popcon.h:49
float score(size_t idx) const
Get the score by index.
Definition: popcon.h:137
float operator[](int idx) const
Get the score by index.
Definition: popcon.h:140
time_t timestamp() const
Get the timestamp of when the index was last updated.
Definition: popcon.h:96
unsigned offset
Definition: popcon.h:46
std::string name(size_t idx) const
Get a package name by index.
Definition: popcon.h:118
Store the score information in the popcon cache.
Definition: popcon.h:43
friend class PopconGenerator
Definition: popcon.h:55
float score(const std::string &name) const
Get the score by name.
Definition: popcon.h:143