gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS > Class Template Reference

Backend functor class for functions with result type TYPE and argumentlist ARGS. More...

#include <functors.hpp>

Inheritance diagram for Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >:
Collaboration diagram for Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >:

Public Member Functions

 backend_functor_common (funcPtrType, str, str, str, str, str, str, Models::ModelFunctorClaw &)
 Constructor. More...
 
virtual ~backend_functor_common ()
 Destructor. More...
 
void updatePointer (funcPtrType)
 Update the internal function pointer wrapped by the functor. More...
 
funcPtrType handoutFunctionPointer ()
 Hand out the internal function pointer wrapped by the functor. More...
 
safe_ptr< bool > inUsePtr ()
 Hand out a safe pointer to this backend functor's inUse flag. More...
 
virtual str safe_version () const
 Getter for the 'safe' incarnation of the version of the wrapped function's origin (module or backend) More...
 
- Public Member Functions inherited from Gambit::functor
 functor (str, str, str, str, Models::ModelFunctorClaw &)
 Constructor. More...
 
virtual ~functor ()
 
virtual void calculate ()
 Virtual calculate(); needs to be redefined in daughters. More...
 
virtual void reset_and_calculate ()
 Reset-then-recalculate method. More...
 
void setStatus (int)
 Setter for status: -6 = required external tool absent (pybind11) -5 = required external tool absent (Mathematica) -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active. More...
 
void setPurpose (str)
 Setter for purpose (relevant only for next-to-output functors) More...
 
void setVertexID (int)
 Setter for vertex ID (used in printer system) More...
 
void setTimingVertexID (int)
 Set ID for timing 'vertex' (used in printer system) More...
 
str name () const
 Getter for the wrapped function's name. More...
 
str capability () const
 Getter for the wrapped function's reported capability. More...
 
str type () const
 Getter for the wrapped function's reported return type. More...
 
str origin () const
 Getter for the wrapped function's origin (module or backend name) More...
 
str version () const
 Getter for the version of the wrapped function's origin (module or backend) More...
 
int status () const
 Getter for the wrapped function current status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active. More...
 
sspair quantity () const
 Getter for the overall quantity provided by the wrapped function (capability-type pair) More...
 
str purpose () const
 Getter for purpose (relevant for output nodes, aka helper structures for the dep. resolution) More...
 
int vertexID () const
 Getter for vertex ID. More...
 
int timingVertexID () const
 Getter for timing vertex ID. More...
 
str label () const
 Getter for string label. More...
 
str timingLabel () const
 Getter for the printer timing label. More...
 
virtual bool requiresPrinting () const
 Getter indicating if the wrapped function's result should to be printed. More...
 
virtual bool requiresTimingPrinting () const
 Getter indicating if the timing data for this function's execution should be printed. More...
 
virtual void setPrintRequirement (bool)
 Setter for indicating if the wrapped function's result should to be printed. More...
 
virtual void setTimingPrintRequirement (bool)
 Setter for indicating if the timing data for this function's execution should be printed. More...
 
virtual void setNestedList (std::vector< functor *> &)
 Set the ordered list of pointers to other functors that should run nested in a loop managed by this one. More...
 
virtual void setIteration (long long)
 Set the iteration number in a loop in which this functor runs. More...
 
virtual bool canBeLoopManager ()
 Getter for revealing whether this is permitted to be a manager functor. More...
 
virtual str loopManagerCapability ()
 Getter for revealing the required capability of the wrapped function's loop manager. More...
 
virtual str loopManagerType ()
 Getter for revealing the required type of the wrapped function's loop manager. More...
 
virtual str loopManagerName ()
 Getter for revealing the name of the wrapped function's assigned loop manager. More...
 
virtual str loopManagerOrigin ()
 Getter for revealing the module of the wrapped function's assigned loop manager. More...
 
virtual void breakLoop ()
 Tell the functor that the loop it manages should break now. More...
 
virtual std::set< sspairdependencies ()
 Getter for listing currently activated dependencies. More...
 
virtual std::set< strbackendgroups ()
 Getter for listing backend requirement groups. More...
 
virtual std::set< sspairbackendreqs ()
 Getter for listing all backend requirements. More...
 
virtual std::set< sspairbackendreqs (str)
 Getter for listing backend requirements from a specific group. More...
 
virtual std::set< sspairbackendspermitted (sspair)
 Getter for listing permitted backends. More...
 
virtual std::set< strbackendreq_tags (sspair)
 Getter for listing tags associated with backend requirements. More...
 
virtual std::set< sspairforcematchingbackend (str)
 Getter for listing backend requirements that must be resolved from the same backend. More...
 
virtual std::set< sspairbackend_conditional_dependencies (str, str, str, str)
 Getter for listing backend-specific conditional dependencies (4-string version) More...
 
virtual std::set< sspairbackend_conditional_dependencies (str req, str type, str be)
 Getter for backend-specific conditional dependencies (3-string version) More...
 
virtual std::set< sspairbackend_conditional_dependencies (functor *)
 Getter for backend-specific conditional dependencies (backend functor pointer version) More...
 
virtual std::set< sspairmodel_conditional_dependencies (str)
 Getter for listing model-specific conditional dependencies. More...
 
virtual std::set< sspairmodel_conditional_backend_reqs (str)
 Getter for listing model-specific conditional backend requirements. More...
 
virtual void resolveDependency (functor *)
 Resolve a dependency using a pointer to another functor object. More...
 
virtual void resolveLoopManager (functor *)
 Set this functor's loop manager (if it has one) More...
 
virtual void resolveBackendReq (functor *)
 Resolve a backend requirement using a pointer to another functor object. More...
 
virtual void notifyOfModel (str)
 Notify the functor that a certain model is being scanned, so that it can activate itself accordingly. More...
 
virtual void notifyOfDependee (functor *)
 Notify the functor that it is being used to fill a dependency of another functor. More...
 
virtual void notifyOfBackends (std::map< str, std::set< str > >)
 Indicate to the functor which backends are actually loaded and working. More...
 
virtual void print (Printers::BasePrinter *printer, const int pointID, int thread_num)
 Printer function. More...
 
virtual void print (Printers::BasePrinter *printer, const int pointID)
 Printer function (no-thread-index short-circuit) More...
 
virtual invalid_point_exceptionretrieve_invalid_point_exception ()
 Retrieve the previously saved exception generated when this functor invalidated the current point in model space. More...
 
void notifyOfIniOptions (const Options &)
 Notify the functor about an instance of the options class that contains information from its corresponding ini-file entry in the auxiliaries or observables section. More...
 
template<typename TYPE >
void setOption (const str &key, const TYPE val)
 Set an option for the functor directly (for use in standalone executables). More...
 
safe_ptr< OptionsgetOptions ()
 Return a safe pointer to the options that this functor is supposed to run with (e.g. from the ini file). More...
 
void notifyOfSubCaps (const Options &)
 Notify the functor about an instance of the options class that contains sub-capability information. More...
 
template<typename TYPE >
void setSubCap (const str &key, const TYPE val)
 Set a sub-capability (subcap)for the functor directly (for use in standalone executables). More...
 
safe_ptr< OptionsgetSubCaps ()
 Return a safe pointer to the subcaps that this functor realises it is supposed to facilitate downstream calculation of. More...
 
safe_ptr< std::set< sspair > > getDependees ()
 Return a safe pointer to the vector of all capability,type pairs of functors arranged downstream of this one in the dependency tree. More...
 
bool allModelsAllowed ()
 Test whether the functor is allowed to be used with all models. More...
 
bool modelAllowed (str model)
 Test whether the functor is always allowed (either explicitly or implicitly) to be used with a given model. More...
 
bool modelExplicitlyAllowed (str model)
 Test whether the functor is explictly always allowed to be used with a given model. More...
 
void setAllowedModel (str model)
 Add a model to the internal list of models for which this functor is allowed to be used. More...
 
bool modelComboAllowed (std::set< str > combo)
 Test whether the functor is allowed (either explicitly or implicitly) to be used with a given combination of models. More...
 
bool modelComboExplicitlyAllowed (std::set< str > combo)
 Test whether the functor has been explictly allowed to be used with a given combination of models. More...
 
void setModelGroup (str group, str contents)
 Add a model group definition to the internal list of model groups. More...
 
void setAllowedModelGroupCombo (str groups)
 Add a combination of model groups to the internal list of combinations for which this functor is allowed to be used. More...
 
virtual double getRuntimeAverage ()
 Interfaces for runtime optimization Need to be implemented by daughters. More...
 
virtual double getInvalidationRate ()
 
virtual void setFadeRate (double)
 
virtual void notifyOfInvalidation (const str &)
 
virtual void reset ()
 

Protected Types

typedef PTR_TYPE funcPtrType
 Type of the function pointer being encapsulated. More...
 

Protected Member Functions

virtual void setInUse (bool)
 Set the inUse flag. More...
 
- Protected Member Functions inherited from Gambit::functor
bool allowed_parent_or_friend_exists (str model)
 Test if there is a model in the functor's allowedModels list as which this model can be interpreted. More...
 
bool in_allowed_combo (str model)
 Check that a model is actually part of a combination that is allowed to be used with this functor. More...
 
bool contains_anything_interpretable_as_member_of (std::set< str > combo, str group)
 Test whether any of the entries in a given model group is a valid interpretation of any members in a given combination. More...
 
bool has_common_elements (std::set< str > combo, str group)
 Work out whether a given combination of models and a model group have any elements in common. More...
 
str find_friend_or_parent_model_in_map (str model, std::map< str, std::set< sspair > > karta)
 Try to find a parent or friend model in some user-supplied map from models to sspair vectors. More...
 
virtual void reset (int)
 Reset functor for one thread only. More...
 

Protected Attributes

funcPtrType myFunction
 Internal storage of function pointer. More...
 
int myLogTag
 Integer LogTag, for tagging log messages. More...
 
str mySafeVersion
 Internal storage of the 'safe' version of the version (for use in namespaces, variable names, etc). More...
 
bool inUse
 Flag indicating if this backend functor is actually in use in a given scan. More...
 
- Protected Attributes inherited from Gambit::functor
str myName
 Internal storage of the function name. More...
 
str myCapability
 Internal storage of exactly what the function calculates. More...
 
str myType
 Internal storage of the type of what the function calculates. More...
 
str myOrigin
 Internal storage of the name of the module or backend to which the function belongs. More...
 
str myVersion
 Internal storage of the version of the module or backend to which the function belongs. More...
 
str myPurpose
 Purpose of the function (relevant for output and next-to-output functors) More...
 
const Models::ModelFunctorClawmyClaw
 Bound model functor claw, for checking relationships between models. More...
 
const str myLabel
 String label, used to label functor results for printer system. More...
 
const str myTimingLabel
 String label, used to label functor timing data for printer system. More...
 
int myStatus
 Status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active. More...
 
int myVertexID
 Internal storage of the vertex ID number used by the printer system to identify functors. More...
 
int myTimingVertexID
 ID assigned by printers to the timing data output stream. More...
 
bool verbose
 Debug flag. More...
 
Options myOptions
 Internal storage of function options, as a YAML node. More...
 
Options mySubCaps
 Internal storage of function sub-capabilities, as a YAML node. More...
 
std::set< sspairmyDependees
 List of all capability,type pairs of functors downstream of this one in the dependency tree. More...
 
std::set< strallowedModels
 List of allowed models. More...
 
std::set< std::set< str > > allowedGroupCombos
 List of allowed model group combinations. More...
 
std::map< str, std::set< str > > modelGroups
 Map from model group names to group contents. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Gambit::functor
static void failBigTime (str method)
 Attempt to retrieve a dependency or model parameter that has not been resolved. More...
 

Detailed Description

template<typename PTR_TYPE, typename TYPE, typename... ARGS>
class Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >

Backend functor class for functions with result type TYPE and argumentlist ARGS.

Definition at line 833 of file functors.hpp.

Member Typedef Documentation

◆ funcPtrType

template<typename PTR_TYPE, typename TYPE, typename... ARGS>
typedef PTR_TYPE Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::funcPtrType
protected

Type of the function pointer being encapsulated.

Definition at line 842 of file functors.hpp.

Constructor & Destructor Documentation

◆ backend_functor_common()

template<typename PTR_TYPE , typename TYPE , typename... ARGS>
Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::backend_functor_common ( funcPtrType  inputFunction,
str  func_name,
str  func_capability,
str  result_type,
str  origin_name,
str  origin_version,
str  origin_safe_version,
Models::ModelFunctorClaw claw 
)

Constructor.

Definition at line 198 of file functor_definitions.hpp.

206  : functor (func_name, func_capability, result_type, origin_name, claw),
207  myFunction (inputFunction),
208  myLogTag(-1),
209  inUse(false)
210  {
211  myVersion = origin_version;
212  mySafeVersion = origin_safe_version;
213  // Determine LogTag number
215  // Or in the case where we prefer to include the version number in the LogTag too
216  //myLogTag = Logging::str2tag(myOrigin+"v"+myVersion);
217  // Check for failure
218  if(myLogTag==-1)
219  {
220  std::ostringstream ss;
221  ss << "Error retrieving LogTag number (in functors.hpp, constructor for "
222  "backend_functor_common)! No match for backend name in tag2str map! "
223  "This is supposed to be a backend functor, so this is a fatal error. "
224  "(myOrigin=" << myOrigin << ", myName=" << myName << ")";
225  utils_error().raise(LOCAL_INFO,ss.str());
226  }
227  }
funcPtrType myFunction
Internal storage of function pointer.
Definition: functors.hpp:845
str myVersion
Internal storage of the version of the module or backend to which the function belongs.
Definition: functors.hpp:328
EXPORT_SYMBOLS error & utils_error()
Utility errors.
str myOrigin
Internal storage of the name of the module or backend to which the function belongs.
Definition: functors.hpp:326
int myLogTag
Integer LogTag, for tagging log messages.
Definition: functors.hpp:848
#define LOCAL_INFO
Definition: local_info.hpp:34
functor(str, str, str, str, Models::ModelFunctorClaw &)
Constructor.
Definition: functors.cpp:57
int str2tag(const std::string &)
Definition: logging.cpp:152
str mySafeVersion
Internal storage of the &#39;safe&#39; version of the version (for use in namespaces, variable names...
Definition: functors.hpp:851
str myName
Internal storage of the function name.
Definition: functors.hpp:320
bool inUse
Flag indicating if this backend functor is actually in use in a given scan.
Definition: functors.hpp:854

◆ ~backend_functor_common()

template<typename PTR_TYPE, typename TYPE, typename... ARGS>
virtual Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::~backend_functor_common ( )
inlinevirtual

Destructor.

Definition at line 862 of file functors.hpp.

862 {}

Member Function Documentation

◆ handoutFunctionPointer()

template<typename PTR_TYPE , typename TYPE , typename... ARGS>
backend_functor_common< PTR_TYPE, TYPE, ARGS... >::funcPtrType Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::handoutFunctionPointer ( )

Hand out the internal function pointer wrapped by the functor.

Definition at line 238 of file functor_definitions.hpp.

239  {
240  return myFunction;
241  }
funcPtrType myFunction
Internal storage of function pointer.
Definition: functors.hpp:845

◆ inUsePtr()

template<typename PTR_TYPE , typename TYPE , typename... ARGS>
safe_ptr< bool > Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::inUsePtr ( )

Hand out a safe pointer to this backend functor's inUse flag.

Definition at line 253 of file functor_definitions.hpp.

254  {
255  return safe_ptr<bool>(&inUse);
256  }
bool inUse
Flag indicating if this backend functor is actually in use in a given scan.
Definition: functors.hpp:854

◆ safe_version()

template<typename PTR_TYPE , typename TYPE , typename... ARGS>
str Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::safe_version ( ) const
virtual

Getter for the 'safe' incarnation of the version of the wrapped function's origin (module or backend)

Getter for the 'safe' incarnation of the wrapped function's origin's version (module or backend)

Reimplemented from Gambit::functor.

Definition at line 245 of file functor_definitions.hpp.

245 { return mySafeVersion; }
str mySafeVersion
Internal storage of the &#39;safe&#39; version of the version (for use in namespaces, variable names...
Definition: functors.hpp:851

◆ setInUse()

template<typename PTR_TYPE , typename TYPE , typename... ARGS>
void Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::setInUse ( bool  flag)
protectedvirtual

Set the inUse flag.

Reimplemented from Gambit::functor.

Definition at line 249 of file functor_definitions.hpp.

249 { inUse = flag; }
bool inUse
Flag indicating if this backend functor is actually in use in a given scan.
Definition: functors.hpp:854

◆ updatePointer()

template<typename PTR_TYPE , typename TYPE , typename... ARGS>
void Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::updatePointer ( funcPtrType  inputFunction)

Update the internal function pointer wrapped by the functor.

Definition at line 231 of file functor_definitions.hpp.

232  {
233  myFunction = inputFunction;
234  }
funcPtrType myFunction
Internal storage of function pointer.
Definition: functors.hpp:845

Member Data Documentation

◆ inUse

template<typename PTR_TYPE, typename TYPE, typename... ARGS>
bool Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::inUse
protected

Flag indicating if this backend functor is actually in use in a given scan.

Definition at line 854 of file functors.hpp.

◆ myFunction

template<typename PTR_TYPE, typename TYPE, typename... ARGS>
funcPtrType Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::myFunction
protected

Internal storage of function pointer.

Definition at line 845 of file functors.hpp.

◆ myLogTag

template<typename PTR_TYPE, typename TYPE, typename... ARGS>
int Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::myLogTag
protected

Integer LogTag, for tagging log messages.

Definition at line 848 of file functors.hpp.

◆ mySafeVersion

template<typename PTR_TYPE, typename TYPE, typename... ARGS>
str Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >::mySafeVersion
protected

Internal storage of the 'safe' version of the version (for use in namespaces, variable names, etc).

Definition at line 851 of file functors.hpp.


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