Added some other keys in the configuration file. Now
[breadcrumbs.git] / src / lib / Bcd / Data / Model.pm
blobfa8738f86fe54d983cfb8d16de3e2e9230ad5024
1 package Bcd::Data::Model;
3 # This file is part of the breadcrumbs daemon (bcd).
4 # Copyright (C) 2007 Pasqualino Ferrentino
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
21 # Contact: lino.ferrentino@yahoo.it (in Italian, English or German).
23 #this file should be the main container of the breadcrumbs model.
24 #this is the other singleton in the application (the other is the
25 #manager of the listeners)
27 use strict;
28 use warnings;
30 use Bcd::Commands::CommandFactory;
31 use Data::Dumper;
33 my $myself = undef;
35 sub instance(){
36 if (! defined ($myself)){
37 #ok, I should create a model
38 my $model = Bcd::Data::Model->_new_instance();
39 $myself = $model;
42 return $myself;
45 sub _new_instance{
47 my $class = shift;
49 my $self = {};
50 $self->{id} = 39;
52 my $factory = Bcd::Commands::CommandFactory->new();
53 $self->{factory} = $factory;
54 bless ($self, $class);
56 return $self;
59 sub get_id{
60 my $self = shift;
61 return $myself->{id} ++;
64 sub get_command{
65 my ($self, $command, $in, $out) = @_;
66 return $self->get_factory()->get_command($command, $in, $out);
69 sub get_factory{
70 my $self = shift;
71 return $self->{factory};