ATLAS Offline Software
Loading...
Searching...
No Matches
interpretSeeds.h File Reference
#include <string>
#include <stdint.h>
Include dependency graph for interpretSeeds.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool interpretSeeds (const std::string &buffer, std::string &stream, uint32_t &seed1, uint32_t &seed2, short &luxury, uint32_t &offset)
bool interpretSeeds (const std::string &buffer, std::string &stream, uint32_t &seed1, uint32_t &seed2, uint32_t &offset)
bool interpretSeeds (const std::string &buffer, std::string &stream, uint32_t &seed1, uint32_t &seed2)
bool interpretSeeds (const std::string &buffer, std::string &stream, std::vector< uint32_t > &seeds)

Function Documentation

◆ interpretSeeds() [1/4]

bool interpretSeeds ( const std::string & buffer,
std::string & stream,
std::vector< uint32_t > & seeds )

Definition at line 69 of file interpretSeeds.cxx.

71{
72 //split the space-separated string in 31 or 33 words:
73 std::vector<std::string> tokens;
74 for (auto&& range : std::string_view{buffer} | std::views::split(' ')) if (!range.empty()) tokens.emplace_back(range.begin(), range.end());
75 int nToks = static_cast<int>(tokens.size());
76 bool status = (nToks == 31 || nToks == 33 || nToks == 771);
77 if (status) {
78 auto token = tokens.begin();
79 stream = *token++;
80 --nToks;
81 if (nToks == 32) nToks=30; //ranlux (FIXME NEEDED?)
82 for (int i=0; i<nToks; i++) {
83 uint32_t value = 0;
84 auto [ptr, ec] = std::from_chars(token->data(), token->data() + token->size(), value);
85 if (ec != std::errc()) {
86 status = false;
87 break;
88 }
89 seeds.push_back(value);
90 ++token;
91 }
92 }
93 return status;
94}
void * ptr(T *p)
Definition SGImplSvc.cxx:74
status
Definition merge.py:16
setEventNumber uint32_t

◆ interpretSeeds() [2/4]

bool interpretSeeds ( const std::string & buffer,
std::string & stream,
uint32_t & seed1,
uint32_t & seed2 )
inline

Definition at line 21 of file interpretSeeds.h.

22 {
23 short luxury(0);
25 return interpretSeeds(buffer, stream, seed1, seed2, luxury, offset);
26}
bool interpretSeeds(const std::string &buffer, std::string &stream, uint32_t &seed1, uint32_t &seed2, short &luxury, uint32_t &offset)

◆ interpretSeeds() [3/4]

bool interpretSeeds ( const std::string & buffer,
std::string & stream,
uint32_t & seed1,
uint32_t & seed2,
short & luxury,
uint32_t & offset )

Definition at line 43 of file interpretSeeds.cxx.

45{
46 //split the space-separated string in 3 or 5 or 7 words:
47 std::vector<std::string> tokens;
48 for (auto&& range : std::string_view{buffer} | std::views::split(' ')) if (!range.empty()) tokens.emplace_back(range.begin(), range.end());
49 int nToks = static_cast<int>(tokens.size());
50 bool status = (nToks == 3 || nToks == 5 || nToks == 7);
51 if (status) {
52 auto token = tokens.begin();
53 stream = *token++;
54 //FIXME, try permutations by hand. With more than two we'd need a parser
55 getOffset(token, offset);
56 getLuxury(token, luxury);
57 getOffset(token, offset);
58 auto [ptr1, ec1] = std::from_chars(token->data(), token->data() + token->size(), seed1);
59 ++token;
60 auto [ptr2, ec2] = std::from_chars(token->data(), token->data() + token->size(), seed2);
61 ++token;
62 if (ec1 != std::errc() || ec2 != std::errc()) {
63 status = false;
64 }
65 }
66 return status;
67}
void getLuxury(std::vector< std::string >::iterator &token, short &luxLevel)
void getOffset(std::vector< std::string >::iterator &token, uint32_t &offset)

◆ interpretSeeds() [4/4]

bool interpretSeeds ( const std::string & buffer,
std::string & stream,
uint32_t & seed1,
uint32_t & seed2,
uint32_t & offset )
inline

Definition at line 13 of file interpretSeeds.h.

15 {
16 short luxury(0);
17 return interpretSeeds(buffer, stream, seed1, seed2, luxury, offset);
18}