[Debtags-devel] poptags

Gustavo Franco gustavorfranco at gmail.com
Mon Aug 15 20:29:26 UTC 2005


On 8/15/05, Enrico Zini <enrico at enricozini.org> wrote:
> On Sun, Aug 14, 2005 at 06:23:39PM -0300, Gustavo Franco wrote:
> > On 8/13/05, Enrico Zini <enrico at enricozini.org> wrote:
> > > Do you think you could make a 'popcon' tool with at least a 'popcon
> > > update' command that, like debtags, downloads popcon data and creates a
> > > binary index to access them quickly?  I (or you if you do C++) could
> > > then integrate that library into libapt-front.
> > Are you asking for a popcon code only or something like poptags but
> > with the 'update' feature creating a binary index ? In both cases i'll
> > use debtags code as reference.
> 
> I'd add the 'update' command to poptags, and then maybe, later on,
> discuss with the maintainer of 'popcon' about turning it into a 'popcon'
> tool.
> 
> If you want to see C++ code that handles the binary index, you can see
> TDBFile.h [package tagcoll] and a simple use in Vocabulary.h [package
> debtags].
> 
> What you would do is define a structure that can hold all the popcon
> data about a package, such as:
> 
> struct PopconData
> {
>         int inst;
>         int vote;
>         int old;
>         int recent;
>         int no-files;
> };
> 
> Then you write it with:
> 
>   TDBFile file("index.dat");
>   PopconData myData;
>   // fill in myData
>   file.set("myPackage", myData);
> 
> and you read it with:
>   file.get("myPackage", myData);
> 
> The 'get' and 'set' methods are template methods which are smart enough
> to see what is the size of the type of myData and write and read
> accordingly.
> 
> If you need it, you can easily cut the dependencies of the class TDBFile
> to just tdb.h and use it in your code.
> 
> 
> Ciao,
> 
> Enrico proud of those get and set methods :)

nice! :)

Hi Enrico,

Thank you again for the tips and support as always.

Best regards,
Gustavo Franco -- <stratus at debian.org>



More information about the Debtags-devel mailing list