NEXUS CLASS LIBRARY: NxsAssumptionsBlock Class

NEXUS CLASS LIBRARY | home | classes | functions

# Class NxsAssumptionsBlock

## Data Members

charBlockPtr, charsets, def_charset, def_exset, def_taxset, exsets, taxa, taxsets

## Member Functions

ApplyExSet, GetCharSet, GetCharSetNames, GetDefCharSetName, GetDefExSetName, GetDefTaxSetName, GetExSet, GetExSetNames, GetNumCharSets, GetNumExSets, GetNumTaxSets, GetTaxSet, GetTaxSetNames, HandleCharset, HandleEndblock, HandleExset, HandleTaxset, NxsAssumptionsBlock, ~NxsAssumptionsBlock, Read, ReplaceTaxaBlockPtr, Report, Reset, SetCallback, TaxonLabelToNumber

## Class Description

This class handles reading and storage for the NxsReader block ASSUMPTIONS. It overrides the member functions Read and Reset, which are abstract virtual functions in the base class NxsBlock . Adding a new data member? Don't forget to:

- Describe it in the class declaration using a C-style comment.
- Initialize it (unless it is self-initializing) in the constructor and re-initialize it in the Reset function.
- Describe the initial state in the constructor documentation.
- Delete memory allocated to it in both the destructor and Reset function.
- Report it in some way in the Report function.

### Key to symbols and colors

public, protected, private, `A` = abstract, `C` = constructor, `D` = destructor, `I` = inline, `S` = static, `V` = virtual, `F` = friend

Data Members

|  | `NxsCharactersBlock` |  | `*charBlockPtr`
|  |  |  | pointer to the NxsCharactersBlock-derived object to be notified in the event of exset changes
|  | `NxsUnsignedSetMap` |  | `charsets`
|  |  |  | the variable storing charsets
|  | `NxsString` |  | `def_charset`
|  |  |  | the default charset
|  | `NxsString` |  | `def_exset`
|  |  |  | the default exset
|  | `NxsString` |  | `def_taxset`
|  |  |  | the default taxset
|  | `NxsUnsignedSetMap` |  | `exsets`
|  |  |  | the variable storing exsets
|  | `NxsTaxaBlock` |  | `*taxa`
|  |  |  | pointer to the NxsTaxaBlock object
|  | `NxsUnsignedSetMap` |  | `taxsets`
|  |  |  | the variable storing taxsets

Member Functions

|  | `void` |  | `ApplyExSet``(NxsString nm)`
|  |  |  | Applies exclusion set having name 'nm' by calling the ApplyExset method of the NxsCharactersBlock or NxsCharactersBlock-derived object stored in the charBlockPtr pointer (which will be whichever block last called the NxsAssumptionsBlock::SetCallback method).
|  | `NxsUnsignedSet` |  | `&GetCharSet``(NxsString nm)`
|  |  |  | Returns reference to character set having name 'nm'.
|  | `void` |  | `GetCharSetNames``(NxsStringVector &names)`
|  |  |  | Erases 'names' vector, then fills 'names' with the names of all stored character sets.
|  | `NxsString` |  | `GetDefCharSetName``()`
|  |  |  | Returns name of default character set. If returned string has zero length, then no default character set was defined in the data set.
|  | `NxsString` |  | `GetDefExSetName``()`
|  |  |  | Returns name of default exclusion set. If returned string has zero length, then no default exclusion set was defined in the data set.
|  | `NxsString` |  | `GetDefTaxSetName``()`
|  |  |  | Returns name of default taxon set. If returned string has zero length, then no default taxon set was defined in the data set.
|  | `NxsUnsignedSet` |  | `&GetExSet``(NxsString nm)`
|  |  |  | Returns reference to exclusion set having name 'nm'.
|  | `void` |  | `GetExSetNames``(NxsStringVector &names)`
|  |  |  | Erases names, then fills names with the names of all stored exclusion sets.
|  | `int` |  | `GetNumCharSets``()`
|  |  |  | Returns the number of character sets stored.
|  | `int` |  | `GetNumExSets``()`
|  |  |  | Returns the number of exclusion sets stored.
|  | `int` |  | `GetNumTaxSets``()`
|  |  |  | Returns the number of taxon sets stored.
|  | `NxsUnsignedSet` |  | `&GetTaxSet``(NxsString nm)`
|  |  |  | Returns reference to taxon set having name 'nm'.
|  | `void` |  | `GetTaxSetNames``(NxsStringVector &names)`
|  |  |  | Erases 'names' vector, then fills 'names' with the names of all stored taxon sets.
|  | `void` |  | `HandleCharset``(NxsToken &token)`
|  |  |  | Reads and stores information contained in the command CHARSET within an ASSUMPTIONS block.
|  | `void` |  | `HandleEndblock``(NxsToken &token)`
|  |  |  | Called when the END or ENDBLOCK command needs to be parsed from within the ASSUMPTIONS block. Basically just checks to make sure the next token in the data file is a semicolon.
|  | `void` |  | `HandleExset``(NxsToken &token)`
|  |  |  | Reads and stores information contained in the command EXSET within an ASSUMPTIONS block. If EXSET keyword is followed by an asterisk, last read NxsCharactersBlock or NxsCharactersBlock-derived object is notified of the characters to be excluded (its ApplyExset function is called).
|  | `void` |  | `HandleTaxset``(NxsToken &token)`
|  |  |  | Reads and stores information contained in the command TAXSET within an ASSUMPTIONS block.
C |  | `` |  | `NxsAssumptionsBlock``(NxsTaxaBlock *t)`
|  |  |  | Sets id = "ASSUMPTIONS", charBlockPtr = NULL, and taxa = t. Assumes taxa is non-NULL.
D |  | `` |  | `~NxsAssumptionsBlock``()`
|  |  |  | Nothing needs to be done in the destructor.
V |  | `void` |  | `Read``(NxsToken &token)`
|  |  |  | This function provides the ability to read everything following the block name (which is read by the NxsReader object) to the end or ENDBLOCK statement. Characters are read from the input stream in. Overrides the pure virtual function in the base class.
|  | `void` |  | `ReplaceTaxaBlockPtr``(NxsTaxaBlock *tb)`
|  |  |  | Makes data member taxa point to 'tb'. Assumes tb is non-NULL.
V |  | `void` |  | `Report``(ostream &out)`
|  |  |  | This function outputs a brief report of the contents of this ASSUMPTIONS block. Overrides the pure virtual function in the base class.
V |  | `void` |  | `Reset``()`
|  |  |  | Prepares for reading a new ASSUMPTIONS block. Overrides the pure virtual function in the base class.
|  | `void` |  | `SetCallback``(NxsCharactersBlock *p)`
|  |  |  | A CHARACTERS, DATA, or ALLELES block can call this function to specify that it is to receive notification when the current taxon or character set changes (e.g., an "EXSET *" command is read or a program requests that one of the predefined taxon sets, character sets, or exsets be applied). Normally, a NxsCharactersBlock-derived object calls this function upon entering its MATRIX command, since when that happens it becomes the primary data-containing block.
V |  | `unsigned` |  | `TaxonLabelToNumber``(NxsString s)`
|  |  |  | Converts a taxon label to a number corresponding to the taxon's position within the list maintained by the NxsTaxaBlock object. This method overrides the virtual function of the same name in the NxsBlock base class. If s is not a valid taxon label, returns the value 0.