#ifndef ROOT_Reflex_ValueObject
#define ROOT_Reflex_ValueObject
#include "Reflex/Any.h"
#include "Reflex/Object.h"
#include "Reflex/Builder/TypeBuilder.h"
namespace ROOT {
namespace Reflex {
class RFLX_API ValueObject : public Object {
public:
ValueObject();
template <typename T> explicit ValueObject( T& v);
ValueObject( const ValueObject& o);
~ValueObject();
template<typename T> const T& Value();
template<typename T> ValueObject& operator =(const T&);
private:
Any fValue;
};
}
}
inline ROOT::Reflex::ValueObject::ValueObject() {
}
template <typename T>
inline ROOT::Reflex::ValueObject::ValueObject( T& v)
: Object( GetType<T>(), 0 ),
fValue(v) {
if ( TypeOf().IsPointer() ) fAddress = *(void**)fValue.Address();
else fAddress = fValue.Address();
}
inline ROOT::Reflex::ValueObject::ValueObject( const ValueObject& o)
: Object( o.TypeOf(), 0 ),
fValue(o.fValue) {
if ( TypeOf().IsPointer() ) fAddress = *(void**)fValue.Address();
else fAddress = fValue.Address();
}
template < typename T >
inline ROOT::Reflex::ValueObject& ROOT::Reflex::ValueObject::operator=( const T& v) {
fValue = Any(v);
fType = GetType<T>();
if ( TypeOf().IsPointer() ) fAddress = *(void**)fValue.Address();
else fAddress = fValue.Address();
return *this;
}
inline ROOT::Reflex::ValueObject::~ValueObject() {
}
template<typename T>
inline const T& ROOT::Reflex::ValueObject::Value() {
return *(T*)fAddress;
}
#endif // ROOT_Reflex_ValueObject
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.