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

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

#include <spec_fptrfinder.hpp>

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

Public Member Functions

 CallFcn (FptrFinder< HostSpec, MapTag::Get > *host)
 
double operator() ()
 

Private Types

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

Private Attributes

FptrFinder< HostSpec, MapTag::Get > * ff
 

Detailed Description

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

Specialisation of CallFcn for calling 'getter' functions.

Definition at line 774 of file spec_fptrfinder.hpp.

Member Typedef Documentation

◆ DerivedSpec

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

Definition at line 778 of file spec_fptrfinder.hpp.

◆ Input

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

Definition at line 780 of file spec_fptrfinder.hpp.

◆ Model

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

Definition at line 779 of file spec_fptrfinder.hpp.

◆ MT

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

Definition at line 782 of file spec_fptrfinder.hpp.

Constructor & Destructor Documentation

◆ CallFcn()

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

Definition at line 786 of file spec_fptrfinder.hpp.

787  : ff(host)
788  {}
FptrFinder< HostSpec, MapTag::Get > * ff

Member Function Documentation

◆ operator()()

template<class HostSpec >
double Gambit::CallFcn< HostSpec, MapTag::Get >::operator() ( )
inline

Definition at line 790 of file spec_fptrfinder.hpp.

References Gambit::FptrFinder< HostSpec, MTag >::check(), Gambit::FptrFinder< HostSpec, MTag >::check_index_initd(), Gambit::FptrFinder< HostSpec, MTag >::const_fakethis, Gambit::FptrFinder< HostSpec, MTag >::error_code, combine_hdf5::f, 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 >::it0W, Gambit::FptrFinder< HostSpec, MTag >::it0W_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 >::it1W, Gambit::FptrFinder< HostSpec, MTag >::it1W_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 >::it2W, Gambit::FptrFinder< HostSpec, MTag >::it2W_safe(), Gambit::FptrFinder< HostSpec, MTag >::ito0, Gambit::FptrFinder< HostSpec, MTag >::ito0_safe(), Gambit::FptrFinder< HostSpec, MTag >::ito1, Gambit::FptrFinder< HostSpec, MTag >::ito1_safe(), Gambit::FptrFinder< HostSpec, MTag >::ito2, Gambit::FptrFinder< HostSpec, MTag >::ito2_safe(), Gambit::FptrFinder< HostSpec, MTag >::label, LOCAL_INFO, Gambit::utils_error(), and Gambit::FptrFinder< HostSpec, MTag >::whichiter.

791  {
792  double result(-1); // should not be returned in this state
793  if(ff->error_code==0)
794  {
795  const Model& model = ff->const_fakethis->model();
796  const Input& input = ff->const_fakethis->input();
797  switch( ff->whichiter )
798  {
799  // Override retrieval cases
800  case 0: {
801  ff->check(ff->ito0_safe());
802  result = ff->ito0->second;
803  break;}
804  case 1: {
805  ff->check(ff->ito1_safe());
806  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
807  result = (ff->ito1->second).at(ff->index1);
808  break;}
809  case 2: {
810  ff->check(ff->ito2_safe());
811  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
812  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
813  result = (ff->ito2->second).at(ff->index1).at(ff->index2);
814  break;}
815  // Wrapper class function call cases
816  case 3: {
817  ff->check(ff->it0_safe());
818  typename MT::FSptr f = ff->it0->second;
819  result = (model.*f)();
820  break;}
821  case 4: {
822  ff->check(ff->it0M_safe());
823  typename MT::plainfptrM f = ff->it0M->second;
824  result = (*f)(model);
825  break;}
826  case 5: {
827  ff->check(ff->it0I_safe());
828  typename MT::plainfptrI f = ff->it0I->second;
829  result = (*f)(input);
830  break;}
831  case 6: {
832  ff->check(ff->it1_safe());
833  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
834  typename MT::FSptr1 f = ff->it1->second.fptr;
835  result = (model.*f)(ff->index1);
836  break;}
837  case 7: {
838  ff->check(ff->it1M_safe());
839  typename MT::plainfptrM1 f = ff->it1M->second.fptr;
840  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
841  result = (*f)(model,ff->index1);
842  break;}
843  case 8: {
844  ff->check(ff->it1I_safe());
845  typename MT::plainfptrI1 f = ff->it1I->second.fptr;
846  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
847  result = (*f)(input,ff->index1);
848  break;}
849  case 9: {
850  ff->check(ff->it2_safe());
851  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
852  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
853  typename MT::FSptr2 f = ff->it2->second.fptr;
854  result = (model.*f)(ff->index1,ff->index2);
855  break;}
856  case 10: {
857  ff->check(ff->it2M_safe());
858  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
859  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
860  typename MT::plainfptrM2 f = ff->it2M->second.fptr;
861  result = (*f)(model,ff->index1,ff->index2);
862  break;}
863  case 11: {
864  ff->check(ff->it2I_safe());
865  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
866  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
867  typename MT::plainfptrI2 f = ff->it2I->second.fptr;
868  result = (*f)(input,ff->index1,ff->index2);
869  break;}
870  case 12: {
871  ff->check(ff->it0W_safe());
872  typename MT::FSptrW f = ff->it0W->second;
873  // These are member functions of DerivedSpec, but "HostSpec"
874  // (and therefore the fakethis pointers) is going to be of
875  // type Spec<DerivedSpec>. Therefore need to cast to the
876  // derived type to call the function.
877  const DerivedSpec* wrapper = static_cast<const DerivedSpec*>(ff->const_fakethis);
878  result = (wrapper->*f)();
879  break;}
880  case 13: {
881  ff->check(ff->it1W_safe());
882  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
883  typename MT::FSptr1W f = ff->it1W->second.fptr;
884  const DerivedSpec* wrapper = static_cast<const DerivedSpec*>(ff->const_fakethis);
885  result = (wrapper->*f)(ff->index1);
886  break;}
887  case 14: {
888  ff->check(ff->it2W_safe());
889  ff->check_index_initd(LOCAL_INFO,ff->index1,"index1");
890  ff->check_index_initd(LOCAL_INFO,ff->index2,"index2");
891  typename MT::FSptr2W f = ff->it2W->second.fptr;
892  const DerivedSpec* wrapper = static_cast<const DerivedSpec*>(ff->const_fakethis);
893  result = (wrapper->*f)(ff->index1,ff->index2);
894  break;}
895  default:{
896  std::ostringstream errmsg;
897  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 Getter maps, current error_code="<<ff->error_code<<", whichiter="<<ff->whichiter<<")"<<std::endl;
898  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
899  }
900  }
901  } else if(ff->error_code==-1)
902  {
903  std::ostringstream errmsg;
904  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;
905  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
906  } else {
907  std::ostringstream errmsg;
908  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;
909  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
910  }
911  return result;
912  }
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::Get > * ff
Here is the call graph for this function:

Member Data Documentation

◆ ff

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

Definition at line 783 of file spec_fptrfinder.hpp.


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