| 1 | ## -*- Mode: CPerl -*- | ||
| 2 | ## | ||
| 3 | ## File: DTA::CAB::Client.pm | ||
| 4 | ## Author: Bryan Jurish <moocow@cpan.org> | ||
| 5 | ## Description: abstract class for DTA::CAB server clients: TODO | ||
| 6 | |||
| 7 | package DTA::CAB::Client; | ||
| 8 | use DTA::CAB; | ||
| 9 | use Carp; | ||
| 10 | use strict; | ||
| 11 | |||
| 12 | ##============================================================================== | ||
| 13 | ## Globals | ||
| 14 | ##============================================================================== | ||
| 15 | |||
| 16 | our @ISA = qw(DTA::CAB::Logger); | ||
| 17 | |||
| 18 | ##============================================================================== | ||
| 19 | ## Constructors etc. | ||
| 20 | ##============================================================================== | ||
| 21 | |||
| 22 | ## $obj = CLASS_OR_OBJ->new(%args) | ||
| 23 | ## + object structure: HASH ref | ||
| 24 | ## { | ||
| 25 | ## #... | ||
| 26 | ## } | ||
| 27 | sub new { | ||
| 28 | my $that = shift; | ||
| 29 | my $obj = bless({ | ||
| 30 | ## | ||
| 31 | ##-- user args | ||
| 32 | @_ | ||
| 33 | }, | ||
| 34 | ref($that)||$that); | ||
| 35 | $obj->initialize(); | ||
| 36 | return $obj; | ||
| 37 | } | ||
| 38 | |||
| 39 | ## undef = $obj->initialize() | ||
| 40 | ## + called to initialize new objects after new() | ||
| 41 | sub initialize { return $_[0]; } | ||
| 42 | |||
| 43 | ##============================================================================== | ||
| 44 | ## Methods: Generic Client API: Connections | ||
| 45 | ##============================================================================== | ||
| 46 | |||
| 47 | ## $bool = $cli->connected | ||
| 48 | sub connected { return 0; } | ||
| 49 | |||
| 50 | ## $bool = $cli->connect() | ||
| 51 | sub connect { return $_[0]->connected; } | ||
| 52 | |||
| 53 | ## $bool = $cli->disconnect() | ||
| 54 | sub disconnect { return !$_[0]->connected; } | ||
| 55 | |||
| 56 | ## @analyzers = $cli->analyzers() | ||
| 57 | sub analyzers { return qw(); } | ||
| 58 | |||
| 59 | ##============================================================================== | ||
| 60 | ## Methods: Generic Client API: Queries | ||
| 61 | ##============================================================================== | ||
| 62 | |||
| 63 | ## $tok = $cli->analyzeToken($analyzer, $tok, \%opts) | ||
| 64 | sub analyzeToken { | ||
| 65 | my $cli = shift; | ||
| 66 | $cli->logcroak("analyzeToken() method not implemented!"); | ||
| 67 | } | ||
| 68 | |||
| 69 | ## $sent = $cli->analyzeSentence($analyzer, $sent, \%opts) | ||
| 70 | sub analyzeSentence { | ||
| 71 | my $cli = shift; | ||
| 72 | $cli->logcroak("analyzeSentence() method not implemented!"); | ||
| 73 | } | ||
| 74 | |||
| 75 | ## $doc = $cli->analyzeDocument($analyzer, $doc, \%opts) | ||
| 76 | sub analyzeDocument { | ||
| 77 | my $cli = shift; | ||
| 78 | $cli->logcroak("analyzeDocument() method not implemented!"); | ||
| 79 | } | ||
| 80 | |||
| 81 | ## $doc = $cli->analyzeData($analyzer, $doc, \%opts) | ||
| 82 | sub analyzeData { | ||
| 83 | my $cli = shift; | ||
| 84 | $cli->logcroak("analyzeGeneric() method not implemented!"); | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | 1; ##-- be happy | ||
| 90 | |||
| 91 | __END__ |