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

Farray specialization for Fortran arrays of strings. More...

#include <util_types.hpp>

Inheritance diagram for Gambit::FstringArray< len, lims >:
Collaboration diagram for Gambit::FstringArray< len, lims >:

Public Member Functions

template<typename ... Args>
enable_if_all_member< typename Farray< char, 1, len, lims... >::allowed_types, Fstring< len > *, Args... >::type::type operator() (Args ... a)
 
- Public Member Functions inherited from Gambit::Farray< char, 1, len, lims... >
 Farray ()
 
 Farray (Farray< char, lims... > &in)
 
 Farray (const char val)
 
enable_if_all_member< allowed_types, char &, Args... >::type::type operator() (Args ... a)
 
enable_if_all_member< allowed_types, const char &, Args... >::type::type operator() (Args ... a) const
 
Farray< char, lims... > & operator= (const Farray< char, lims... > &orig)
 
Farray< char, lims... > & operator= (const char val)
 

Additional Inherited Members

- Public Types inherited from Gambit::Farray< char, 1, len, lims... >
typedef calc_nElem< lims... > nElem
 
- Public Attributes inherited from Gambit::Farray< char, 1, len, lims... >
char array [nElem::val]
 
- Protected Types inherited from Gambit::Farray< char, 1, len, lims... >
typedef mult_types< short, const short, short &, const short &, unsigned short, const unsigned short, unsigned short &, const unsigned short &, int, const int, int &, const int &, unsigned, const unsigned, unsigned &, const unsigned &, long, const long, long &, const long &, unsigned long, const unsigned long, unsigned long &, const unsigned long &, long long, const long long, long long &, const long long &, unsigned long long, const unsigned long long, unsigned long long &, const unsigned long long &> allowed_types
 

Detailed Description

template<int len, int... lims>
class Gambit::FstringArray< len, lims >

Farray specialization for Fortran arrays of strings.

This is an N+1-dimensional char array, where N is the number of dimensions specified by the user (1/2 * the number of array index limits). The special () operator is intended to be used instead of the operators of the Farray base class, and takes 1 argument less than the Farray class operators (the array index for the letters in the strings should not be passed). This operator returns pointers to Fstring objects that can be assigned to and read from. Syntax: FstringArray<[string length], [lower index, dim 1], [upper index, dim 1], [alternating lower/upper indices for subsequent dimensions]> DO NOT UNDER ANY CIRCUMSTANCE add new member variables to this class!

Definition at line 493 of file util_types.hpp.

Member Function Documentation

◆ operator()()

template<int len, int... lims>
template<typename ... Args>
enable_if_all_member<typename Farray<char,1,len, lims... >::allowed_types, Fstring<len>*, Args...>::type::type Gambit::FstringArray< len, lims >::operator() ( Args ...  a)
inline

Definition at line 498 of file util_types.hpp.

References int, LOCAL_INFO, and Gambit::utils_error().

499  {
500  static_assert(2*sizeof...(a)==sizeof...(lims), "FstringArray error: Invalid number of arguments passed to () operator");
501  int indices[] = {1,int(a)...};
502  int limits[] = {1,len,lims...};
503  int idx = 0;
504  // Calculate index for array access
505  for (int i = 0; i < int((sizeof...(lims)+2)/2); ++i)
506  {
507  int idx_i = indices[i];
508  if(idx_i<limits[2*i] || idx_i>limits[2*i+1])
509  {
510  str errmsg = "FstringArray error: Array index out of bounds.";
511  utils_error().raise(LOCAL_INFO,errmsg);
512  }
513  idx_i -= limits[2*i];
514  for (int j=0; j<i; j++) idx_i *= (limits[2*j+1]-limits[2*j]+1);
515  idx += idx_i;
516  }
517  return reinterpret_cast<Fstring<len>*>(&Farray<char,1,len, lims... >::array[idx]);
518  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
DS5_MSPCTM DS_INTDOF int
Here is the call graph for this function:

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