Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
producer_names Class Reference

Static Public Member Functions

static string producer_name (unsigned int producer_number, bool shared_producer=false)
 

Detailed Description

Definition at line 340 of file main.cpp.

Member Function Documentation

◆ producer_name()

string producer_names::producer_name ( unsigned int producer_number,
bool shared_producer = false )
static

Definition at line 354 of file main.cpp.

354 {
355 // keeping legacy "defproducer[a-z]", but if greater than valid_char_range, will use "defpraaaaaaa"
356 // shared_producer will appear in all nodes' config
357 char prod_name[] = "defproducera";
358 if (producer_number > valid_char_range) {
359 for (int current_char_loc = 5; current_char_loc < total_chars; ++current_char_loc) {
360 prod_name[current_char_loc] = slot_chars[0];
361 }
362 }
363
364 prod_name[total_chars] = '\0';
365 for (int current_char_loc = total_chars - 1; current_char_loc >= 0; --current_char_loc) {
366 const unsigned int slot_value = static_cast<char>(producer_number % valid_char_range);
367 producer_number /= valid_char_range;
368 prod_name[current_char_loc] = slot_chars[slot_value];
369 if (!producer_number)
370 break;
371 }
372
373 // make sure we haven't cycled back to the first 26 names (some time after 26^6)
374 if (string(prod_name) == "defproducera" && producer_number != 0)
375 throw std::runtime_error( "launcher not designed to handle numbers this large " );
376
377 if (shared_producer) {
378 prod_name[0] = 's';
379 prod_name[1] = 'h';
380 prod_name[2] = 'r';
381 }
382 return prod_name;
383}
Here is the caller graph for this function:

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