ATLAS Offline Software
Loading...
Searching...
No Matches
LArHEC_Base_ID.cxx File Reference

Factor out code common between LArHEC_ID and LArHEC_SuperCell_ID. More...

#include "CaloIdentifier/LArHEC_Base_ID.h"
#include "CaloIdentifier/LArID_Exception.h"
#include "IdDict/IdDictDictionary.h"
#include "IdDict/IdDictField.h"
#include "IdDict/IdDictMgr.h"
#include "IdDict/IdDictRegion.h"
#include "AtlasDetDescr/AtlasDetectorID.h"
#include "Identifier/IdentifierHash.h"
#include "LArHEC_region.h"
#include "CxxUtils/StrFormat.h"
#include "CxxUtils/trapping_fp.h"
#include <cmath>
#include <set>
#include <string>

Go to the source code of this file.

Functions

std::string strformat (const char *fmt,...)
 return a std::string according to a format fmt and varargs

Detailed Description

Factor out code common between LArHEC_ID and LArHEC_SuperCell_ID.

Author
scott snyder snyde.nosp@m.r@bn.nosp@m.l.gov
Date
May, 2013

Definition in file LArHEC_Base_ID.cxx.

Function Documentation

◆ strformat()

std::string CxxUtils::strformat ( const char * fmt,
... )

return a std::string according to a format fmt and varargs

Definition at line 49 of file StrFormat.cxx.

50{
51 char *buf = NULL;
52 int nbytes = -1;
53
54 va_list ap;
55 va_start(ap, fmt); /* Initialize the va_list */
56
57 nbytes = vasprintf(&buf, fmt, ap);
58 va_end(ap); /* Cleanup the va_list */
59
60 if (nbytes < 0) {
61 /*buf is undefined when allocation failed
62 * see: http://linux.die.net/man/3/asprintf
63 */
64 // free(buf);
65 throw std::runtime_error("problem while calling vasprintf");
66 }
67
68 CharLiberator guard(buf);
69
70 // help compiler to apply RVO
71 return std::string(buf);
72}
const char *const fmt