#!/usr/bin/perl -w
#
# $Id: LogUnit.pm,v 1.1 2002/03/08 10:02:54 fpmip Exp $
#
# LogUnit object (Logfile + an EventGroup)
#
# Author : Tycho Fruru <tycho@fruru.com>
#
# Copyright (C) 2001 Tycho Fruru <tycho@fruru.com>
# Copyright (C) 2001 Conostix S.A. Luxembourg - Tycho Fruru <tycho@conostix.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
package IPFC::LogUnit;

use strict;
use warnings;

use Storable;

sub new() {
	my $proto = shift;
	my $class = ref($proto) || $proto;
	my $self = [];
	bless ($self,$class);
	return $self;
}

sub clone() {
	my $self = shift;
	my $class = ref($self);
	my $new;
	
	$new = Storable::dclone($self);
	
	bless ($new,$class);
	return $new;
}

sub set_logfile($) {
	my $self = shift;
	my $logfile = shift; # an IPFC::Logfile
	if ($logfile->isa("IPFC::Logfile")) {
		$self->[0] = $logfile;
		return 1;
	} else {
		warn "The object was not an IPFC::Logfile !";
		return 0;
	}
}

sub set_eventgroup($) {
	my $self = shift;
	my $eventgroup = shift; # an IPFC::Event
	if ($eventgroup->isa("IPFC::EventGroup")) {
		$self->[1] = $eventgroup;
		return 1;
	} else {
		warn "The object was not an IPFC::EventGroup !";
		return 0;
	}
}

sub get_logfile() {
	my $self = shift;
	return $self->[0];
}

sub get_eventgroup($) {
	my $self = shift;
	return ( $self->[1] );
}

return 1;
