18 #include "cling/Interpreter/Value.h"
19 #include "llvm/Support/raw_ostream.h"
23 TClingValue::TClingValue() {
25 assert(
sizeof(fValue) >=
sizeof(cling::Value)
26 &&
"sizeof(fValue) too small!");
27 new (&fValue) cling::Value();
30 TClingValue::TClingValue(
const TClingValue& Other):
32 assert(
sizeof(fValue) >=
sizeof(cling::Value)
33 &&
"sizeof(fValue) too small!");
34 new (&fValue) cling::Value(Other.ToCV());
37 TClingValue::~TClingValue() {
41 TClingValue& TClingValue::operator=(TClingValue &Other) {
42 using namespace cling;
43 ToCV() = Other.ToCV();
47 std::pair<std::string, std::string> TClingValue::ToTypeAndValueString()
const {
48 std::string output = ToString();
51 for (
size_t pos = 0; pos < output.size(); ++pos) {
52 if (output[pos] ==
'(')
54 else if (output[pos] ==
')') {
57 return std::make_pair(output.substr(0, pos + 1), output.substr(pos + 2));
61 return std::make_pair(
"", output);
64 Bool_t TClingValue::IsValid()
const {
65 return ToCV().isValid();
68 Double_t TClingValue::GetAsDouble()
const {
69 return ToCV().getDouble();
72 Long_t TClingValue::GetAsLong()
const {
73 return ToCV().getLL();
76 ULong_t TClingValue::GetAsUnsignedLong()
const {
77 return ToCV().getULL();
80 void* TClingValue::GetAsPointer()
const {
81 return ToCV().getPtr();
84 std::string TClingValue::ToString()
const {
86 llvm::raw_string_ostream ost(retVal);