gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
Gambit::CallFcn< HostSpec, MapTag::Set > Class Template Reference

Specialisation of CallFcn for calling 'setter' functions. More...

#include <spec_fptrfinder.hpp>

Collaboration diagram for Gambit::CallFcn< HostSpec, MapTag::Set >:

Public Member Functions

 CallFcn (FptrFinder< HostSpec, MapTag::Set > *host)
 
void operator() (const double set_value)
 

Private Types

typedef HostSpec::D DerivedSpec
 
typedef SpecTraits< DerivedSpec >::Model Model
 
typedef SpecTraits< DerivedSpec >::Input Input
 
typedef MapTypes< DerivedSpec, MapTag::SetMT
 

Private Attributes

FptrFinder< HostSpec, MapTag::Set > * ff
 

Detailed Description

template<class HostSpec>
class Gambit::CallFcn< HostSpec, MapTag::Set >

Specialisation of CallFcn for calling 'setter' functions.

Definition at line 917 of file spec_fptrfinder.hpp.

Member Typedef Documentation

◆ DerivedSpec

template<class HostSpec >
typedef HostSpec::D Gambit::CallFcn< HostSpec, MapTag::Set >::DerivedSpec
private

Definition at line 921 of file spec_fptrfinder.hpp.

◆ Input

template<class HostSpec >
typedef SpecTraits<DerivedSpec>::Input Gambit::CallFcn< HostSpec, MapTag::Set >::Input
private

Definition at line 923 of file spec_fptrfinder.hpp.

◆ Model

template<class HostSpec >
typedef SpecTraits<DerivedSpec>::Model Gambit::CallFcn< HostSpec, MapTag::Set >::Model
private

Definition at line 922 of file spec_fptrfinder.hpp.

◆ MT

template<class HostSpec >
typedef MapTypes<DerivedSpec,MapTag::Set> Gambit::CallFcn< HostSpec, MapTag::Set >::MT
private

Definition at line 925 of file spec_fptrfinder.hpp.

Constructor & Destructor Documentation

◆ CallFcn()

template<class HostSpec >
Gambit::CallFcn< HostSpec, MapTag::Set >::CallFcn ( FptrFinder< HostSpec, MapTag::Set > *  host)
inline

Definition at line 929 of file spec_fptrfinder.hpp.

930  : ff(host)
931  {}
FptrFinder< HostSpec, MapTag::Set > * ff

Member Function Documentation

◆ operator()()

template<class HostSpec >
void Gambit::CallFcn< HostSpec, MapTag::Set >::operator() ( const double  set_value)
inline

Definition at line 933 of file spec_fptrfinder.hpp.

References Gambit::FptrFinder< HostSpec, MTag >::check(), Gambit::FptrFinder< HostSpec, MTag >::check_index_initd(), Gambit::FptrFinder< HostSpec, MTag >::error_code, combine_hdf5::f, Gambit::FptrFinder< HostSpec, MTag >::fakethis, Gambit::FptrFinder< HostSpec, MTag >::index1, Gambit::FptrFinder< HostSpec, MTag >::index2, Gambit::FptrFinder< HostSpec, MTag >::it0, Gambit::FptrFinder< HostSpec, MTag >::it0_safe(), Gambit::FptrFinder< HostSpec, MTag >::it0I, Gambit::FptrFinder< HostSpec, MTag >::it0I_safe(), Gambit::FptrFinder< HostSpec, MTag >::it0M, Gambit::FptrFinder< HostSpec, MTag >::it0M_safe(), Gambit::FptrFinder< HostSpec, MTag >::it1, Gambit::FptrFinder< HostSpec, MTag >::it1_safe(), Gambit::FptrFinder< HostSpec, MTag >::it1I, Gambit::FptrFinder< HostSpec, MTag >::it1I_safe(), Gambit::FptrFinder< HostSpec, MTag >::it1M, Gambit::FptrFinder< HostSpec, MTag >::it1M_safe(), Gambit::FptrFinder< HostSpec, MTag >::it2, Gambit::FptrFinder< HostSpec, MTag >::it2_safe(), Gambit::FptrFinder< HostSpec, MTag >::it2I, Gambit::FptrFinder< HostSpec, MTag >::it2I_safe(), Gambit::FptrFinder< HostSpec, MTag >::it2M, Gambit::FptrFinder< HostSpec, MTag >::it2M_safe(), Gambit::FptrFinder< HostSpec, MTag >::label, LOCAL_INFO, Gambit::utils_error(), and Gambit::FptrFinder< HostSpec, MTag >::whichiter.

934  {
935  if(ff->error_code==0)
936  {
937  // Must use NON-const version; make sure pointer correctly initialised!
938  if(ff->fakethis==NULL)
939  {
940  std::ostringstream errmsg;
941  errmsg << "Error! 'Setter' version of FptrFinder tried to use non-const 'fakethis' pointer, but the pointer was not initialised! This indicates a bug in the FptrFinder class. Please report it! (this FptrFinder has label="<<ff->label<<" and is specialised for Setter maps, current error_code="<<ff->error_code<<", whichiter="<<ff->whichiter<<")"<<std::endl;
942  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
943  }
944  Model& model = ff->fakethis->model();
945  Input& input = ff->fakethis->input();
946  switch( ff->whichiter )
947  {
948  // Override retrieval cases
949  // ABSENT ON PURPOSE. set_override functions don't work via an fptrfinder
950  case 0:
951  case 1:
952  case 2: {
953  std::ostringstream errmsg;
954  errmsg << "Error! 'Setter' version of FptrFinder called a map-access case reserved for override maps, however these only work in the 'Getter' version (since SubSpectrum override values are not supposed to be set via an FptrFinder). This indicates a bug in the FptrFinder class. Please report it! (this FptrFinder has label="<<ff->label<<" and is specialised for Setter maps, current error_code="<<ff->error_code<<", whichiter="<<ff->whichiter<<")"<<std::endl;
955  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
956  break;
957  }
958  // Wrapper class function call cases
959  case 3: {
960  ff->check(ff->it0_safe());
961  typename MT::FSptr f = ff->it0->second;
962  (model.*f)(set_value);
963  break;}
964  case 4: {
965  ff->check(ff->it0M_safe());
966  typename MT::plainfptrM f = ff->it0M->second;
967  (*f)(model,set_value);
968  break;}
969  case 5: {
970  ff->check(ff->it0I_safe());
971  typename MT::plainfptrI f = ff->it0I->second;
972  (*f)(input,set_value);
973  break;}
974  case 6: {
975  ff->check(ff->it1_safe());
976  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
977  typename MT::FSptr1 f = ff->it1->second.fptr;
978  (model.*f)(set_value,ff->index1);
979  break;}
980  case 7: {
981  ff->check(ff->it1M_safe());
982  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
983  typename MT::plainfptrM1 f = ff->it1M->second.fptr;
984  (*f)(model,set_value,ff->index1);
985  break;}
986  case 8: {
987  ff->check(ff->it1I_safe());
988  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
989  typename MT::plainfptrI1 f = ff->it1I->second.fptr;
990  (*f)(input,set_value,ff->index1);
991  break;}
992  case 9: {
993  ff->check(ff->it2_safe());
994  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
995  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
996  typename MT::FSptr2 f = ff->it2->second.fptr;
997  (model.*f)(set_value,ff->index1,ff->index2);
998  break;}
999  case 10: {
1000  ff->check(ff->it2M_safe());
1001  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
1002  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
1003  typename MT::plainfptrM2 f = ff->it2M->second.fptr;
1004  (*f)(model,set_value,ff->index1,ff->index2);
1005  break;}
1006  case 11: {
1007  ff->check(ff->it2I_safe());
1008  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
1009  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
1010  typename MT::plainfptrI2 f = ff->it2I->second.fptr;
1011  (*f)(input,set_value,ff->index1,ff->index2);
1012  break;}
1013  default:{
1014  std::ostringstream errmsg;
1015  errmsg << "Error! Unanticipated whichiter code received while trying to call a function from SubSpectrum maps. This indicates a bug in the FptrFinder class. Please report it! (this FptrFinder has label="<<ff->label<<" and is specialised for Setter maps, current error_code="<<ff->error_code<<", whichiter="<<ff->whichiter<<")"<<std::endl;
1016  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
1017  }
1018  }
1019  } else if(ff->error_code==-1)
1020  {
1021  std::ostringstream errmsg;
1022  errmsg << "Error! Tried to call function from SubSpectrum maps without first finding the function! This indicates a bug, probably in the Spectrum or SubSpectrum classes. Please report it! (this FptrFinder has label="<<ff->label<<" and is specialised for Getter maps, current error_code="<<ff->error_code<<")"<<std::endl;
1023  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
1024  } else {
1025  std::ostringstream errmsg;
1026  errmsg << "Error! Unanticipated error code received while trying to call a function from SubSpectrum maps. This indicates a bug in the FptrFinder class. Please report it! (this FptrFinder has label="<<ff->label<<" and is specialised for Getter maps, current error_code="<<ff->error_code<<")"<<std::endl;
1027  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
1028  }
1029  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
SpecTraits< DerivedSpec >::Input Input
SpecTraits< DerivedSpec >::Model Model
FptrFinder< HostSpec, MapTag::Set > * ff
Here is the call graph for this function:

Member Data Documentation

◆ ff

template<class HostSpec >
FptrFinder<HostSpec,MapTag::Set>* Gambit::CallFcn< HostSpec, MapTag::Set >::ff
private

Definition at line 926 of file spec_fptrfinder.hpp.


The documentation for this class was generated from the following file: