.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.08) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "SWISS::BaseClass 3pm" .TH SWISS::BaseClass 3pm "2006-01-26" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SWISS::BaseClass .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class is designed to impliment many of the properties that you expect in inheritance. All the housekeeping functions are defined in this module. See the notes on use for a description of how to make use of it. .SH "Functions" .IX Header "Functions" .IP "new" 4 .IX Item "new" Returns a new SWISS::BaseClass object. .IP "rebless" 4 .IX Item "rebless" Converts a base class into your class! Call as \f(CW$self\fR\->rebless($class) where \&\f(CW$self\fR is a base class object. It returns \f(CW$self\fR, reblessed, with the correct member variables. .IP "initialize" 4 .IX Item "initialize" Override this in each derived class to provide class specific initialization. For example, initialize may put arrays into member variables that need them. You must provide an initialize function. .IP "reformat" 4 .IX Item "reformat" Some line objects are implementing \*(L"lazy writing\*(R". This means that on writing an entry, they are only reformatted if they have been modified. The method reformat forces an object to be reformatted even if its content has not been modified. This may be useful e.g. to make sure the current formatting rules are applied. .ie n .IP "setEvidenceTags @array" 4 .el .IP "setEvidenceTags \f(CW@array\fR" 4 .IX Item "setEvidenceTags @array" Sets the evidence tags of the object to the list passed in \f(CW@array\fR. .IP "addEvidenceTag string" 4 .IX Item "addEvidenceTag string" Adds the evidence tag to the object. .IP "deleteEvidenceTag string" 4 .IX Item "deleteEvidenceTag string" Deletes the evidence tag from the object. .IP "hasEvidenceTag string" 4 .IX Item "hasEvidenceTag string" returns true if the object has the evidence tag. .IP "getEvidenceTags" 4 .IX Item "getEvidenceTags" returns the array of evidence tags of the object .IP "Check4Clashes" 4 .IX Item "Check4Clashes" This function checks your classes member variable list for clashes with any class that it inherits from (any class that can(_containsFields) returns true on!). If it detects that in any base class that any data members have been already defined, it dies with a listing of the variables already used. .Sp It stops searching a root of an inheritance hierachy when it can find no baseclasses that support _containsFields. It will find all clashes in an entire inheritance tree. .Sp So in the inheritance hierachy of .Sp .Vb 3 \& SWISS::BaseClass \-> A \-> B \-\e \& > E \& SWISS::BaseClass \-> C \-> D \-/ .Ve .Sp where E is the most derived class, if E contains names that clash with A members and names that clash with B members, both the A and B member clashes will be reported. .Sp If there were clashes with B and C, say, then again, all of the clashes would be reported. .IP "_containsFields" 4 .IX Item "_containsFields" This function is responsible for comparing a classes fields with the set in the calling package. This implimentation will work for cases where all of the classes that contribute fields are derived from SWISS::BaseClass. You may wish to make your own class fit this interface, so what follows is an interface \s-1API\s0. .Sp _containsFields assumes that the first argument is the package that it is being called in. The following arguments are taken to be a list of fields which to check are not found in members of the current package. .Sp It should return either \f(CW\*(C`undef\*(C'\fR or a reference to an array of name clashes in the format \&\f(CW\*(C`package::variable\*(C'\fR. It should call it's self for each parental class that supports this function. .Sp So it would look something like _containsFields { my \f(CW$class\fR = shift; my \f(CW@toCheck\fR = \f(CW@_\fR; .Sp .Vb 3 \& foreach @toCheck { \& check that they are not in me. If they are, add them to the list of clashes to return. \& } \& \& add all base class clashes to your list of clashes \& \& if there were name clashes return a reference to them \& \& otherwise return undef \& } .Ve .IP "equal" 4 .IX Item "equal" If two objects are equal, it returns true. .Sp Warning: This funktion compares two objects using a simple dump in Perl format, see Data::Dumper module. The comparison also takes private variables into account. Therefore: If the method 'equal' returns true, the objects are guaranteed to be equal, but it might return false although the two objects are equal in they public attributes. .IP "copy" 4 .IX Item "copy" Returns a \*(L"deep copy\*(R" of the object. .SH "A skeletal derived class" .IX Header "A skeletal derived class" .Vb 1 \& package myDerived; \& \& use vars qw ( @ISA %fields ); \& \& BEGIN { \& @ISA = (\*(AqSWISS::BaseClass\*(Aq); \& \& %fields = ( \& \*(Aqi\*(Aq => 1, \& \*(Aqhash\*(Aq => undef \& ); \& \& myDerived\->check4Clashes(); \& } \& \& sub new { \& print "myDerived::new(@_)\en"; \& my $class = shift; \& my $self = new SWISS::BaseClass; \& \& $self\->rebless ($class); \& \& return $self; \& } \& \& sub initialize { \& my $self = shift; \& $self\->{\*(Aqhash\*(Aq} = {}; \& } .Ve .PP A class derived from myDerived would just substitute the name myDerived for SWISS::BaseClass. Hey presto \- all sorted!