ROOT logo
// @(#)root/reflex:$Id: VariableBuilder.h 29288 2009-07-01 13:03:35Z axel $
// Author: Stefan Roiser 2004

// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#ifndef Reflex_VariableBuilder
#define Reflex_VariableBuilder

// Include files
#include "Reflex/Reflex.h"
#include "Reflex/Builder/TypeBuilder.h"


namespace Reflex {
// forward declarations

/** @class VariableBuilder VariableBuilder.h Reflex/Builder/VariableBuilder.h
 *  @author Stefan Roiser
 *  @date 6/4/2005
 *  @ingroup RefBld
 */
class RFLX_API VariableBuilder {
public:
   /** constructor */
   VariableBuilder(const char* nam,
                   const Type &typ,
                   size_t offs,
                   unsigned int modifiers = 0);


   /** destructor */
   virtual ~VariableBuilder();


   /**
    * AddProperty will add a property
    * @param  key the property key
    * @param  value the value of the property
    * @return a reference to the building class
    */
   VariableBuilder& AddProperty(const char* key,
                                Any value);
   VariableBuilder& AddProperty(const char* key,
                                const char* value);


   /**
    * ToMember will return the member currently being built
    * @return member currently being built
    */
   Member ToMember();

private:
   /** function member */
   Member fDataMember;

};    // class VariableBuilder


/**
 * @class VariableBuilderImpl VariableBuilder.h Reflex/Builder/VariableBuilder.h
 * @author Stefan Roiser
 * @date 6/4/2005
 * @ingroup RefBld
 */
class RFLX_API VariableBuilderImpl {
public:
   /** constructor */
   VariableBuilderImpl(const char* nam,
                       const Type &typ,
                       size_t offs,
                       unsigned int modifiers = 0);


   /** destructor */
   ~VariableBuilderImpl();


   /** AddProperty will add a property
    * @param  key the property key
    * @param  value the value of the property
    * @return a reference to the building class
    */
   void AddProperty(const char* key,
                    Any value);
   void AddProperty(const char* key,
                    const char* value);


   /**
    * ToMember will return the member currently being built
    * @return member currently being built
    */
   Member ToMember();

private:
   /** member being built */
   Member fDataMember;

};    // class VariableBuilderImpl


/**
 * @class VariableBuilderT VariableBuilder.h Reflex/Builder/VariableBuilder.h
 * @author Stefan Roiser
 * @date 6/4/2005
 * @ingroup RefBld
 */
template <typename D> class VariableBuilderT {
public:
   /** constructor */
   VariableBuilderT(const char* nam,
                    size_t offs,
                    unsigned int modifiers = 0);


   /** destructor */
   virtual ~VariableBuilderT() {}


   /**
    * AddProperty will add a property
    * @param  key the property key
    * @param  value the value of the property
    * @return a reference to the building class
    */
   template <typename P>
   VariableBuilderT& AddProperty(const char* key,
                                 P value);


   /**
    * ToMember will return the member currently being built
    * @return member currently being built
    */
   Member ToMember();

private:
   /** data member builder implementation */
   VariableBuilderImpl fDataMemberBuilderImpl;

};    // class VariableBuilderT


} // namespace Reflex


//-------------------------------------------------------------------------------
template <typename D>
inline Reflex::VariableBuilderT<D>::VariableBuilderT(const char* nam,
                                                     size_t offs,
                                                     unsigned int modifiers)
//-------------------------------------------------------------------------------
   : fDataMemberBuilderImpl(nam,
                            TypeDistiller<D>::Get(),
                            offs,
                            modifiers) {
}


//-------------------------------------------------------------------------------
template <typename D> template <typename P>
inline Reflex::VariableBuilderT<D>&
Reflex::VariableBuilderT<D
>::AddProperty(const char* key,
               P value) {
//-------------------------------------------------------------------------------
   fDataMemberBuilderImpl.AddProperty(key, value);
   return *this;
}


//-------------------------------------------------------------------------------
template <typename D> inline Reflex::Member
Reflex::VariableBuilderT<D
>::ToMember() {
//-------------------------------------------------------------------------------
   return fDataMemberBuilderImpl.ToMember();
}


#endif // Reflex_VariableBuilder
 VariableBuilder.h:1
 VariableBuilder.h:2
 VariableBuilder.h:3
 VariableBuilder.h:4
 VariableBuilder.h:5
 VariableBuilder.h:6
 VariableBuilder.h:7
 VariableBuilder.h:8
 VariableBuilder.h:9
 VariableBuilder.h:10
 VariableBuilder.h:11
 VariableBuilder.h:12
 VariableBuilder.h:13
 VariableBuilder.h:14
 VariableBuilder.h:15
 VariableBuilder.h:16
 VariableBuilder.h:17
 VariableBuilder.h:18
 VariableBuilder.h:19
 VariableBuilder.h:20
 VariableBuilder.h:21
 VariableBuilder.h:22
 VariableBuilder.h:23
 VariableBuilder.h:24
 VariableBuilder.h:25
 VariableBuilder.h:26
 VariableBuilder.h:27
 VariableBuilder.h:28
 VariableBuilder.h:29
 VariableBuilder.h:30
 VariableBuilder.h:31
 VariableBuilder.h:32
 VariableBuilder.h:33
 VariableBuilder.h:34
 VariableBuilder.h:35
 VariableBuilder.h:36
 VariableBuilder.h:37
 VariableBuilder.h:38
 VariableBuilder.h:39
 VariableBuilder.h:40
 VariableBuilder.h:41
 VariableBuilder.h:42
 VariableBuilder.h:43
 VariableBuilder.h:44
 VariableBuilder.h:45
 VariableBuilder.h:46
 VariableBuilder.h:47
 VariableBuilder.h:48
 VariableBuilder.h:49
 VariableBuilder.h:50
 VariableBuilder.h:51
 VariableBuilder.h:52
 VariableBuilder.h:53
 VariableBuilder.h:54
 VariableBuilder.h:55
 VariableBuilder.h:56
 VariableBuilder.h:57
 VariableBuilder.h:58
 VariableBuilder.h:59
 VariableBuilder.h:60
 VariableBuilder.h:61
 VariableBuilder.h:62
 VariableBuilder.h:63
 VariableBuilder.h:64
 VariableBuilder.h:65
 VariableBuilder.h:66
 VariableBuilder.h:67
 VariableBuilder.h:68
 VariableBuilder.h:69
 VariableBuilder.h:70
 VariableBuilder.h:71
 VariableBuilder.h:72
 VariableBuilder.h:73
 VariableBuilder.h:74
 VariableBuilder.h:75
 VariableBuilder.h:76
 VariableBuilder.h:77
 VariableBuilder.h:78
 VariableBuilder.h:79
 VariableBuilder.h:80
 VariableBuilder.h:81
 VariableBuilder.h:82
 VariableBuilder.h:83
 VariableBuilder.h:84
 VariableBuilder.h:85
 VariableBuilder.h:86
 VariableBuilder.h:87
 VariableBuilder.h:88
 VariableBuilder.h:89
 VariableBuilder.h:90
 VariableBuilder.h:91
 VariableBuilder.h:92
 VariableBuilder.h:93
 VariableBuilder.h:94
 VariableBuilder.h:95
 VariableBuilder.h:96
 VariableBuilder.h:97
 VariableBuilder.h:98
 VariableBuilder.h:99
 VariableBuilder.h:100
 VariableBuilder.h:101
 VariableBuilder.h:102
 VariableBuilder.h:103
 VariableBuilder.h:104
 VariableBuilder.h:105
 VariableBuilder.h:106
 VariableBuilder.h:107
 VariableBuilder.h:108
 VariableBuilder.h:109
 VariableBuilder.h:110
 VariableBuilder.h:111
 VariableBuilder.h:112
 VariableBuilder.h:113
 VariableBuilder.h:114
 VariableBuilder.h:115
 VariableBuilder.h:116
 VariableBuilder.h:117
 VariableBuilder.h:118
 VariableBuilder.h:119
 VariableBuilder.h:120
 VariableBuilder.h:121
 VariableBuilder.h:122
 VariableBuilder.h:123
 VariableBuilder.h:124
 VariableBuilder.h:125
 VariableBuilder.h:126
 VariableBuilder.h:127
 VariableBuilder.h:128
 VariableBuilder.h:129
 VariableBuilder.h:130
 VariableBuilder.h:131
 VariableBuilder.h:132
 VariableBuilder.h:133
 VariableBuilder.h:134
 VariableBuilder.h:135
 VariableBuilder.h:136
 VariableBuilder.h:137
 VariableBuilder.h:138
 VariableBuilder.h:139
 VariableBuilder.h:140
 VariableBuilder.h:141
 VariableBuilder.h:142
 VariableBuilder.h:143
 VariableBuilder.h:144
 VariableBuilder.h:145
 VariableBuilder.h:146
 VariableBuilder.h:147
 VariableBuilder.h:148
 VariableBuilder.h:149
 VariableBuilder.h:150
 VariableBuilder.h:151
 VariableBuilder.h:152
 VariableBuilder.h:153
 VariableBuilder.h:154
 VariableBuilder.h:155
 VariableBuilder.h:156
 VariableBuilder.h:157
 VariableBuilder.h:158
 VariableBuilder.h:159
 VariableBuilder.h:160
 VariableBuilder.h:161
 VariableBuilder.h:162
 VariableBuilder.h:163
 VariableBuilder.h:164
 VariableBuilder.h:165
 VariableBuilder.h:166
 VariableBuilder.h:167
 VariableBuilder.h:168
 VariableBuilder.h:169
 VariableBuilder.h:170
 VariableBuilder.h:171
 VariableBuilder.h:172
 VariableBuilder.h:173
 VariableBuilder.h:174
 VariableBuilder.h:175
 VariableBuilder.h:176
 VariableBuilder.h:177
 VariableBuilder.h:178
 VariableBuilder.h:179
 VariableBuilder.h:180
 VariableBuilder.h:181
 VariableBuilder.h:182
 VariableBuilder.h:183
 VariableBuilder.h:184
 VariableBuilder.h:185
 VariableBuilder.h:186
 VariableBuilder.h:187
 VariableBuilder.h:188