17#ifndef LDNDC_INPUT_SPECIESGROUPS_H_
18#define LDNDC_INPUT_SPECIESGROUPS_H_
20#include "crabmeat-common.h"
23namespace ldndc{
namespace species
51extern CBM_API
char const * SPECIES_GROUP_NAMES[SPECIES_GROUP_CNT];
52extern CBM_API
char const * internal_SPECIES_GROUP_ANY;
62extern CBM_API
char const * SPECIES_NAME_NONE;
68template < species_group_e _G >
77 static int fselect( species_group_e _g)
83template < species_group_e _g >
84struct CBM_API species_group_t
90 static species_group_e group() {
return _g; }
91 static char const * name() {
return SPECIES_GROUP_NAMES[_g]; }
93struct CBM_API none :
public species_group_t< SPECIES_GROUP_NONE >
97 select = select_species_t< SPECIES_GROUP_NONE >::select,
101struct CBM_API any :
public species_group_t< SPECIES_GROUP_ANY >
105 select = select_species_t< SPECIES_GROUP_CROP >::select|select_species_t< SPECIES_GROUP_GRASS >::select|select_species_t< SPECIES_GROUP_WOOD >::select,
111struct CBM_API crop :
public species_group_t< SPECIES_GROUP_CROP >
115 select = select_species_t< SPECIES_GROUP_CROP >::select,
119struct CBM_API no_crop :
public species_group_t< SPECIES_GROUP_NONE >
124 deselect = select_species_t< SPECIES_GROUP_CROP >::deselect
127struct CBM_API grass :
public species_group_t< SPECIES_GROUP_GRASS >
131 select = select_species_t< SPECIES_GROUP_GRASS >::select,
135struct CBM_API no_grass :
public species_group_t< SPECIES_GROUP_NONE >
140 deselect = select_species_t< SPECIES_GROUP_GRASS >::deselect
143struct CBM_API wood :
public species_group_t< SPECIES_GROUP_WOOD >
147 select = select_species_t< SPECIES_GROUP_WOOD >::select,
151struct CBM_API no_wood :
public species_group_t< SPECIES_GROUP_NONE >
156 deselect = select_species_t< SPECIES_GROUP_WOOD >::deselect
162template < species_group_e _G >
163struct species_group_from_enum_t
167struct species_group_from_enum_t< SPECIES_GROUP_NONE >
172struct species_group_from_enum_t< SPECIES_GROUP_ANY >
177struct species_group_from_enum_t< SPECIES_GROUP_CROP >
182struct species_group_from_enum_t< SPECIES_GROUP_GRASS >
187struct species_group_from_enum_t< SPECIES_GROUP_WOOD >
192struct species_groups_selector_t
194 virtual ~species_groups_selector_t() {}
195 virtual bool is_selected( species_group_e)
const = 0;
197template <
typename _G1 = species::any,
typename _G2 = species::none,
typename _G3 = species::none,
198 typename _G4 = species::none,
typename _G5 = species::none,
typename _G6 = species::none,
typename _G7 = species::none >
199struct species_groups_select_t :
public species_groups_selector_t
203 select = (_G1::select|_G2::select|_G3::select|_G4::select|_G5::select|_G6::select|_G7::select) &
204 (_G1::deselect&_G2::deselect&_G3::deselect&_G4::deselect&_G5::deselect&_G6::deselect&_G7::deselect)
206 bool is_selected( species_group_e _group)
const
208 return ( _group==SPECIES_GROUP_ANY &&
int(this->select)!=
int(species::none::select)) ||
209 ( this->select & select_species_t< SPECIES_GROUP_ANY >::fselect( _group));
Spatially explicit groundwater model.
Definition airchemistryput.h:21
make species group number a bit mask for or'ing
Definition speciesgroups.h:70