23Implemente_instanciable_sans_constructeur_ni_destructeur(
Nom,
"Nom",
Objet_U);
48 const int ok = s.
get(buffer, BUFLEN);
85 snprintf(chaine, 22,
"%d", i);
94 snprintf(chaine, 22,
"%ld", i);
103 snprintf(chaine, 22,
"%lld", i);
136 snprintf(la_chaine,80,
"%f",le_reel);
149 snprintf(la_chaine,80,format,le_reel);
153 unsigned int length=strlen(la_chaine);
154 if (la_chaine[length-5]==
'e')
157 for (
unsigned int i=length-3; i<=length; i++)
158 la_chaine[i]=la_chaine[i+1];
178 std::transform(
nom_.begin(),
nom_.end(),
nom_.begin(), ::toupper);
189 return (
int)
nom_.size()+1;
270 int n2 = (int)strlen(s);
280 const int n1 = (int)strlen(s);
281 const int n2 = (int)
nom_.size();
282 const std::string str1 =
nom_.substr(n1,n2);
291 return (
nom_.rfind(ch, 0) == 0);
296 auto l =
nom_.size(), e = s.size();
298 return (0 ==
nom_.compare(l - e, e, s));
305 std::size_t x =
nom_.find(n);
306 return (x != std::string::npos) ? (int)x : -1;
311 return find(std::string(n));
328 int n = (int)
nom_.size();
329 int n2 = (int)strlen(s);
339 const int n1 = (int)
nom_.size();
340 const int n2 = (int)strlen(s);
341 const std::string str1 =
nom_.substr(0,n1-n2);
368 if (!(sub_type(
Nom, x)))
return 0;
369 return (*
this == ref_cast(
Nom, x));
371 const Nom& n2 =
dynamic_cast<const Nom&
>(x);
372 return (*
this == n2);
382 int compteur=(int)
nom_.size();
383 const char* ptr=
nom_.c_str()+compteur;
384 while((*ptr!=
'.') && (*ptr!=
'/')&&(compteur>0))
396 compteur=(int)
nom_.size();
399 std::string newname=
nom_.substr(0,compteur);
402 int digits=0,diviseur=0;
405 digits = (n==0) ? 1 : (int)std::lrint(std::truncl(log10(n)+1.0));
406 diviseur = (int)std::lrint(std::truncl(pow(10, digits-1)));
433 Cerr <<
"Error in Nom::nom_me. Contact TRUST support." << finl;
440 if(prefixe) prefix_len+=(int)strlen(prefixe);
442 char *c_numero=
new char[prefix_len+digits+1];
445 if(prefixe) strcpy(c_numero+1, prefixe);
446 for (
int i=prefix_len; i<prefix_len+digits; i++)
449 char c= (char)((
int)
'0' + resultat);
451 n-=resultat*diviseur;
454 c_numero[prefix_len+digits]=
'\0';
458 Nom new_name(newname);
470 assert(deb - 1 + la_longueur <= (
int)
nom_.size());
471 Nom nouveau(
nom_.substr(deb-1,la_longueur));
482 int iLength = (int)
nom_.size();
483 for (
int i=0; i<iLength; i++)
488 the_basename.
suffix(dirname);
499Nom::operator
const char*()
const
510int operator ==(
const Nom& un_nom,
const char*
const un_autre)
512 int res_actu=(un_nom.
nom_.compare(un_autre)==0);
515int operator ==(
const Nom& un_nom,
const Nom& un_autre)
517 return (un_nom==un_autre.
getChar());
519int operator ==(
const char*
const un_autre,
const Nom& un_nom)
521 return (un_nom == un_autre);
530int operator !=(
const Nom& un_nom,
const char* un_autre)
532 return ! (un_nom == un_autre);
535int operator !=(
const Nom& un_nom,
const Nom& un_autre)
537 return ! (un_nom == un_autre);
540int operator !=(
const char*
const un_autre,
const Nom& un_nom)
542 return ! (un_autre == un_nom);
545bool operator <(
const Nom& n1,
const Nom& n2)
547 return n1.
nom_.compare(n2.
nom_) < 0;
Class defining operators and methods for all reading operation in an input flow (file,...
virtual int get(int *ob, std::streamsize n)
class Nom: a character string for naming TRUST objects.
~Nom() override
Destructor.
const char * getChar() const
Nom()
Default constructor. Creates the string "??".
virtual int finit_par(const char *const n) const
Nom substr_old(const int, const int) const
Returns a name using the usual substr command. NOTE: deb = 1 means the first character of the string.
int est_egal_a(const Objet_U &) const override
Comparison with an Objet_U. The Objet_U is cast to Nom for the comparison.
const Nom getPrefix(const char *const) const
Nom & operator=(const char *const)
Copies the string nom.
Nom nom_me(int, const char *prefix=0, int without_padding=0) const
Inserts _prefix000n (n=me() or nproc()) into a file name (e.g. toto.titi) to produce toto_prefix000n....
const Nom getSuffix(const char *const) const
virtual int debute_par(const char *const n) const
virtual int find(const char *const n) const
Nom & operator+=(const Nom &x)
Concatenation with a Nom.
int longueur() const
Returns the number of characters in the Nom string, including the null terminator.
Nom & prefix(const char *const)
Nom & majuscule()
Converts the name to uppercase. Only letters 'a'-'z' are modified.
Nom operator+(const Nom &) const
Concatenation with a Nom.
Nom & suffix(const char *const)
Suffix extraction: Nom x("azerty");.
Nom basename() const
Returns the filename part if the name is in the form /toto/titi/filename.
const Nom & le_nom() const override
Returns *this.
Base class for TRUST objects (Objet_U).
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
static int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.