10#ifndef LDNDC_INPUT_SPECIESGROUPS_H_
11#define LDNDC_INPUT_SPECIESGROUPS_H_
13#include "crabmeat-common.h"
16namespace ldndc{
namespace species
44extern CBM_API
char const * SPECIES_GROUP_NAMES[SPECIES_GROUP_CNT];
45extern CBM_API
char const * internal_SPECIES_GROUP_ANY;
55extern CBM_API
char const * SPECIES_NAME_NONE;
61template < species_group_e _G >
70 static int fselect( species_group_e _g)
76template < species_group_e _g >
77struct CBM_API species_group_t
83 static species_group_e group() {
return _g; }
84 static char const * name() {
return SPECIES_GROUP_NAMES[_g]; }
86struct CBM_API none :
public species_group_t< SPECIES_GROUP_NONE >
90 select = select_species_t< SPECIES_GROUP_NONE >::select,
94struct CBM_API any :
public species_group_t< SPECIES_GROUP_ANY >
98 select = select_species_t< SPECIES_GROUP_CROP >::select|select_species_t< SPECIES_GROUP_GRASS >::select|select_species_t< SPECIES_GROUP_WOOD >::select,
104struct CBM_API crop :
public species_group_t< SPECIES_GROUP_CROP >
108 select = select_species_t< SPECIES_GROUP_CROP >::select,
112struct CBM_API no_crop :
public species_group_t< SPECIES_GROUP_NONE >
117 deselect = select_species_t< SPECIES_GROUP_CROP >::deselect
120struct CBM_API grass :
public species_group_t< SPECIES_GROUP_GRASS >
124 select = select_species_t< SPECIES_GROUP_GRASS >::select,
128struct CBM_API no_grass :
public species_group_t< SPECIES_GROUP_NONE >
133 deselect = select_species_t< SPECIES_GROUP_GRASS >::deselect
136struct CBM_API wood :
public species_group_t< SPECIES_GROUP_WOOD >
140 select = select_species_t< SPECIES_GROUP_WOOD >::select,
144struct CBM_API no_wood :
public species_group_t< SPECIES_GROUP_NONE >
149 deselect = select_species_t< SPECIES_GROUP_WOOD >::deselect
155template < species_group_e _G >
156struct species_group_from_enum_t
160struct species_group_from_enum_t< SPECIES_GROUP_NONE >
165struct species_group_from_enum_t< SPECIES_GROUP_ANY >
170struct species_group_from_enum_t< SPECIES_GROUP_CROP >
175struct species_group_from_enum_t< SPECIES_GROUP_GRASS >
180struct species_group_from_enum_t< SPECIES_GROUP_WOOD >
185struct species_groups_selector_t
187 virtual ~species_groups_selector_t() {}
188 virtual bool is_selected( species_group_e)
const = 0;
190template <
typename _G1 = species::any,
typename _G2 = species::none,
typename _G3 = species::none,
191 typename _G4 = species::none,
typename _G5 = species::none,
typename _G6 = species::none,
typename _G7 = species::none >
192struct species_groups_select_t :
public species_groups_selector_t
196 select = (_G1::select|_G2::select|_G3::select|_G4::select|_G5::select|_G6::select|_G7::select) &
197 (_G1::deselect&_G2::deselect&_G3::deselect&_G4::deselect&_G5::deselect&_G6::deselect&_G7::deselect)
199 bool is_selected( species_group_e _group)
const
201 return ( _group==SPECIES_GROUP_ANY &&
int(this->select)!=
int(species::none::select)) ||
202 ( this->select & select_species_t< SPECIES_GROUP_ANY >::fselect( _group));
Spatially explicit groundwater model.
Definition airchemistryput.h:15
make species group number a bit mask for or'ing
Definition speciesgroups.h:63