BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
Identifier.cxx
Go to the documentation of this file.
2#include <stdarg.h>
3#include <stdio.h>
4#include <algorithm>
5
6#include <iostream>
7#include <iomanip>
8
9//-----------------------------------------------
10void Identifier::set (const std::string& id)
11{
12 sscanf (id.c_str(), "0x%x", &m_id);
13}
14
15
16//-----------------------------------------------
17std::string Identifier::getString() const
18{
19 std::string result;
20 char temp[20];
21
22 sprintf (temp, "0x%x", (unsigned int)m_id);
23 result += temp;
24 result.insert(2,10-result.length(),'0');
25
26 return (result);
27}
28
29//-----------------------------------------------
30void Identifier::show () const
31{
32 const Identifier& me = *this;
33 std::cout << me.getString();
34}
35
36std::ostream& operator<<(std::ostream & os, const Identifier& Id)
37{
38 return (os<<Id.getString());
39}
std::ostream & operator<<(std::ostream &os, const Identifier &Id)
Definition: Identifier.cxx:36
const double me
Definition: PipiJpsi.cxx:48
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:17
void show() const
Print out in hex form.
Definition: Identifier.cxx:30
void set(const std::string &id)
build from a string form - hexadecimal
Definition: Identifier.cxx:10