Logo ROOT   6.08/07
Reference Guide
TClingValue.cxx
Go to the documentation of this file.
1 // @(#)root/core/meta:$Id$
2 // Author: Vassil Vassilev 14/03/2013
3 
4 /*******************************************************************************
5 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  ******************************************************************************/
11 
12 /** \class TClingValue
13 Bridge between cling::Value and ROOT.
14 */
15 
16 #include "TClingValue.h"
17 
18 #include "cling/Interpreter/Value.h"
19 #include "llvm/Support/raw_ostream.h"
20 
21 #include <cassert>
22 
24  // We default initialize to invalid value to keep a "sane" state.
25  assert(sizeof(fValue) >= sizeof(cling::Value)
26  && "sizeof(fValue) too small!");
27  new (&fValue) cling::Value();
28 }
29 
32  assert(sizeof(fValue) >= sizeof(cling::Value)
33  && "sizeof(fValue) too small!");
34  new (&fValue) cling::Value(Other.ToCV());
35 }
36 
38  ToCV().~Value();
39 }
40 
42  using namespace cling;
43  ToCV() = Other.ToCV();
44  return *this;
45 }
46 
48  return ToCV().isValid();
49 }
50 
52  return ToCV().getDouble();
53 }
54 
56  return ToCV().getLL();
57 }
58 
60  return ToCV().getULL();
61 }
62 
64  return ToCV().getPtr();
65 }
66 
67 std::string TClingValue::ToString() const {
68  std::string retVal;
69  llvm::raw_string_ostream ost(retVal);
70  ToCV().print(ost);
71  return ost.str();
72 }
struct TClingValue::HasTheSameSizeAsClingValue fValue
Long_t GetAsLong() const
Definition: TClingValue.cxx:55
bool Bool_t
Definition: RtypesCore.h:59
void * GetAsPointer() const
Definition: TClingValue.cxx:63
TClingValue & operator=(TClingValue &Other)
Definition: TClingValue.cxx:41
ULong_t GetAsUnsignedLong() const
Definition: TClingValue.cxx:59
long Long_t
Definition: RtypesCore.h:50
Bool_t IsValid() const
Definition: TClingValue.cxx:47
double Double_t
Definition: RtypesCore.h:55
Print a TSeq at the prompt:
Definition: TDatime.h:114
unsigned long ULong_t
Definition: RtypesCore.h:51
Double_t GetAsDouble() const
Definition: TClingValue.cxx:51
cling::Value & ToCV()
Definition: TClingValue.h:47
Bridge between cling::Value and ROOT.
Definition: TClingValue.h:38
std::string ToString() const
Definition: TClingValue.cxx:67
const char * Value
Definition: TXMLSetup.cxx:73