class Gambit::FptrFinder

Forward declaration of FptrFinder. More…

#include <spec_fptrfinder.hpp>

Public Functions

Name
intget_error_code()
Error reporting.
std::stringget_error_message()
voidraise_error(const std::string & origin)
voidcheck_index_initd(const std::string & origin, const int index, const std::string & label)
boolfind_override_0index(const std::string & name)
Search 0-index override map.
boolfind_override_1index(const std::string & name, const int i)
Search 1-index override map.
boolfind_override_2index(const std::string & name, const int i, const int j)
Search 2-index override map.
boolfind_0index(const std::string & name)
Search 0-index wrapper maps.
boolfind_1index(const std::string & name, const int i)
Search 1-index wrapper maps.
boolfind_2index(const std::string & name, const int i, const int j)
Search 2-index wrapper maps.
FptrFinder(const SetMaps< HostSpec, MTag > & params)
template <class Map >
bool
search_map(const std::string & name, const Map *const map, typename Map::const_iterator & it)
helper functions for searching individual maps
voidcheck(bool safe)
template <class ITER >
bool
check_indices_1(const std::string & name, const ITER & it, const int i, const int whichit, const bool debug)
template <class ITER >
bool
check_indices_2(const std::string & , const ITER & it, const int i, const int j, const int whichit)
boolfind(const std::string & name, bool =true, SafeBool check_antiparticle =SafeBool(true))
Search function for 0-index maps.
boolfind(const std::string & name, int i, bool =true, SafeBool check_antiparticle =SafeBool(true))
Search function for 1-index maps.
boolfind(const std::string & name, int i, int j)
Search function for 2-index maps.

Public Attributes

Name
CallFcn< HostSpec, MTag >callfcn

Friends

Name
classCallFcn< HostSpec, MTag >

Detailed Description

template <class HostSpec ,
class MTag >
class Gambit::FptrFinder;

Forward declaration of FptrFinder.

Helper class for locating the function pointer corresponding to a requested string, from amongst the various different maps in which it could be located.

Public Functions Documentation

function get_error_code

inline int get_error_code()

Error reporting.

function get_error_message

inline std::string get_error_message()

function raise_error

inline void raise_error(
    const std::string & origin
)

function check_index_initd

inline void check_index_initd(
    const std::string & origin,
    const int index,
    const std::string & label
)

function find_override_0index

inline bool find_override_0index(
    const std::string & name
)

Search 0-index override map.

Functions to search for specific entries with no translation (to factorise the various pieces of the complicated search functions)

function find_override_1index

inline bool find_override_1index(
    const std::string & name,
    const int i
)

Search 1-index override map.

function find_override_2index

inline bool find_override_2index(
    const std::string & name,
    const int i,
    const int j
)

Search 2-index override map.

function find_0index

inline bool find_0index(
    const std::string & name
)

Search 0-index wrapper maps.

function find_1index

inline bool find_1index(
    const std::string & name,
    const int i
)

Search 1-index wrapper maps.

function find_2index

inline bool find_2index(
    const std::string & name,
    const int i,
    const int j
)

Search 2-index wrapper maps.

function FptrFinder

inline FptrFinder(
    const SetMaps< HostSpec, MTag > & params
)

function search_map

template <class Map >
inline bool search_map(
    const std::string & name,
    const Map *const map,
    typename Map::const_iterator & it
)

helper functions for searching individual maps

function check

inline void check(
    bool safe
)

Check if it is (supposed to be) safe to dereference a map iterator Throw an error if it isn’t

function check_indices_1

template <class ITER >
inline bool check_indices_1(
    const std::string & name,
    const ITER & it,
    const int i,
    const int whichit,
    const bool debug
)

Methods for setting parameters (named parameter idiom) E.g. call constructor like this to use named “parameters” FptrFinder().map(x).map2(z).mapM(y) Could protect parameters from being reset by putting these setters in a friend class, which can only set the FptrFinder parameters via the FptrFinder constructor, but this is good enough for the use here I think. NOTE: I think this comment refers to moved/removed functionality…

function check_indices_2

template <class ITER >
inline bool check_indices_2(
    const std::string & ,
    const ITER & it,
    const int i,
    const int j,
    const int whichit
)

function find

inline bool find(
    const std::string & name,
    bool  =true,
    SafeBool check_antiparticle =SafeBool(true)
)

Search function for 0-index maps.

Get antiparticle name if it exists Slightly wasteful to do this all the time if not needed, but makes the code simpler and realistically won’t make any difference.

function find

inline bool find(
    const std::string & name,
    int i,
    bool  =true,
    SafeBool check_antiparticle =SafeBool(true)
)

Search function for 1-index maps.

Get antiparticle name if it exists

function find

inline bool find(
    const std::string & name,
    int i,
    int j
)

Search function for 2-index maps.

Public Attributes Documentation

variable callfcn

CallFcn< HostSpec, MTag > callfcn;

Caller for whatever function was found HostSpec has to work slightly differently depending on whether FptrFinder is specialised for MapTag::Get or MapTag::Set, so we just declare it here and do the specialisation after the class declaration. HostSpec has to be a struct, since we partial specialisation of functions is not allowed in C++, but it is treated like a member function.

Friends

friend CallFcn< HostSpec, MTag >

friend class CallFcn< HostSpec, MTag >(
    CallFcn< HostSpec, MTag > 
);

Updated on 2023-06-26 at 21:36:50 +0000