--- myst: substitutions: bloc1: python: 1-4,11-27 cpp: 3-5,7-21 bloc2: python: 13-15 cpp: 8-10 bloc3: python: "18" cpp: "13" bloc4: python: 21,24,25 cpp: 4,16,17 bloc5: python: "26" cpp: "19" bloc6: python: "27" cpp: "21" bloc7: python: 2- cpp: 4- --- (use_cases_macro_dataserver_attributes)= # Macro "**dataserverAttributes.{{extension}}**" ## Objective The goal of this macro is only to master the objects `TAttribute` and {{tds}} of {{uranie}}. Three attributes will be created and linked to a {{tds}} object, then the *log* of this object will be printed to check internal data of this {{tds}}. ## Macro {{uranie}} {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/use_cases/" + language + "/dataserverAttributes." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} The first attribute *"x"* is defined on [-2.0, 4.0]; its title is $\Delta P^{\sigma}$ and unity $\frac{mm^{2}}{s}$ {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/use_cases/" + language + "/dataserverAttributes." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} The second attribute *"y"* is defined on [0.0,1.0]; it will be set with its name as title but without unity. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/use_cases/" + language + "/dataserverAttributes." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc3[language] + "\n" + "```" }} Secondly, a {{tds}} object is created and the two attributes *x* and *y* created before are linked to this one. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/use_cases/" + language + "/dataserverAttributes." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc4[language] + "\n" + "```" }} Finally, the last attribute *z* (defined on [0.25,0.50]) is directly added to the {{tds}} (its title will be its name and it will be set without unity) by creating it. An attribute could, indeed, be added to a {{tds}} meanwhile creating it, but then no other information than those available in the constructor would be set. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/use_cases/" + language + "/dataserverAttributes." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc5[language] + "\n" + "```" }} Then, the *log* of the {{tds}} object is printed. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/use_cases/" + language + "/dataserverAttributes." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc6[language] + "\n" + "```" }} Generally speaking, all {{uranie}} objects have the `printLog` method which allows to print internal data of the object. ## Console {{ "```{literalinclude} " + parent_dir + "/roottest/build/uranie/doc/dataserver/use_cases/" + language + "/dataserverAttributes_clean.log" + "\n" + ":language: none\n" + ":lines: " + bloc7[language] + "\n" + "```" }}