Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,56 @@
// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.
#ifndef tools_pointer
#define tools_pointer
//WARNING : touchy
//NOTE : on 32 or 64 bits machine, a pointer matches an unsigned long.
#include "typedefs"
#include "snpf"
#include <string>
namespace tools {
inline bool to_pointer(const std::string& a_string,void*& a_value){
unsigned long v = 0L;
if(::sscanf(a_string.c_str(),"0x%lx",&v)!=1) {
if(::sscanf(a_string.c_str(),"%lu",&v)!=1) {
a_value = 0;
return false;
}
}
a_value = (void*)v;
return true;
}
inline std::string p2s(const void* a_value){
char s[512];
snpf(s,sizeof(s),"%lu",(unsigned long)a_value);
return s;
}
inline std::string p2sx(const void* a_value){
char s[512];
snpf(s,sizeof(s),"0x%lx",(unsigned long)a_value);
return s;
}
inline std::string char_p2s(const char* a_value) {
char s[512];
snpf(s,sizeof(s),"%lu",(unsigned long)a_value);
return std::string(s);
}
inline std::string long2s(const long a_value) {
char s[512];
snpf(s,sizeof(s),"%ld",a_value);
return std::string(s);
}
}
#endif