[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kinosearch-commits
Subject:    [Kinosearch-commits] r3530 - in trunk: c_src/KinoSearch/Index
From:       marvin () rectangular ! com
Date:       2008-06-23 22:58:18
Message-ID: 200806232245.m5NMjWa7007154 () mailer ! progressive-comp ! com
[Download RAW message or body]

Author: creamyg
Date: 2008-06-23 15:58:18 -0700 (Mon, 23 Jun 2008)
New Revision: 3530

Added:
   trunk/c_src/KinoSearch/Index/Inverter.bp
   trunk/c_src/KinoSearch/Index/Inverter.c
Modified:
   trunk/perl/lib/KinoSearch/Index/Inverter.pm
Log:
Add C binding for Inverter.


Added: trunk/c_src/KinoSearch/Index/Inverter.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/Inverter.bp	                        (rev 0)
+++ trunk/c_src/KinoSearch/Index/Inverter.bp	2008-06-23 22:58:18 UTC (rev 3530)
@@ -0,0 +1,19 @@
+parcel KinoSearch cnick Kino;
+
+class KinoSearch::Index::Inverter extends KinoSearch::Obj {
+
+    Schema *schema;
+
+    static Inverter*
+    init(Inverter *self, Schema *schema);
+
+    void
+    Destroy(Inverter *self);
+}
+
+/* Copyright 2007-2008 Marvin Humphrey
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * under the same terms as Perl itself.
+ */
+

Added: trunk/c_src/KinoSearch/Index/Inverter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/Inverter.c	                        (rev 0)
+++ trunk/c_src/KinoSearch/Index/Inverter.c	2008-06-23 22:58:18 UTC (rev 3530)
@@ -0,0 +1,32 @@
+#include "KinoSearch/Util/ToolSet.h"
+
+#include "KinoSearch/Index/Inverter.h"
+#include "KinoSearch/Schema.h"
+
+Inverter*
+Inverter_new(Schema *schema)
+{
+    Inverter *self = (Inverter*)CREATE(NULL, INVERTER);
+    return Inverter_init(self, schema);
+}
+
+Inverter*
+Inverter_init(Inverter *self, Schema *schema)
+{
+    self->schema = REFCOUNT_INC(schema);
+    return self;
+}
+
+void
+Inverter_destroy(Inverter *self) 
+{
+    REFCOUNT_DEC(self->schema);
+    FREE_OBJ(self);
+}
+
+/* Copyright 2007-2008 Marvin Humphrey
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * under the same terms as Perl itself.
+ */
+

Modified: trunk/perl/lib/KinoSearch/Index/Inverter.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Index/Inverter.pm	2008-06-23 22:44:31 UTC (rev 3529)
+++ trunk/perl/lib/KinoSearch/Index/Inverter.pm	2008-06-23 22:58:18 UTC (rev 3530)
@@ -5,27 +5,12 @@
 use KinoSearch::Util::ToolSet;
 use KinoSearch::base qw( KinoSearch::Obj );
 
-our %instance_vars = __PACKAGE__->init_instance_vars(
-    # constructor params / members
-    schema => \our %schema,
-);
-
 use KinoSearch::Analysis::TokenBatch;
 
-sub new {
-    my ( $either, %args ) = @_;
-    my $schema = delete $args{schema};
-    confess("Missing required param 'schema'")
-        unless a_isa_b( $schema, "KinoSearch::Schema" );
-    my $self = $either->SUPER::new(%args);
-    $schema{$$self} = $schema;
-    return $self;
-}
-
 sub invert {
     my ( $self, %args ) = @_;
     my $doc    = $args{doc};
-    my $schema = $schema{$$self};
+    my $schema = $self->get_schema;
 
     # Perform analysis and conditioning of field values.
     my %inversion;
@@ -59,21 +44,18 @@
 
 __END__
 
-__POD__
+__AUTO_XS__
 
-=begin devdocs
+{   "KinoSearch::Index::Inverter" => {
+        make_constructors => ["new"],
+        make_getters => [qw( schema )],
+    }
+}
 
-=head1 PRIVATE CLASS
+__COPYRIGHT__
 
-KinoSearch::Index::Inverter - Invert documents.
-
-=head1 COPYRIGHT
-
 Copyright 2005-2008 Marvin Humphrey
 
-=head1 LICENSE, DISCLAIMER, BUGS, etc.
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
 
-See L<KinoSearch> version 0.20.
-
-=end devdocs
-=cut


_______________________________________________
kinosearch-commits mailing list
kinosearch-commits@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic