Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Class.h
1 /*
2  * AbstractClass and Class classes interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2007, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef ELM_RTTI_CLASS_H_
22 #define ELM_RTTI_CLASS_H_
23 
24 #include <elm/data/List.h>
25 #include <elm/data/Vector.h>
26 #include <elm/dyndata/Collection.h>
27 #include <elm/util/Variant.h>
28 #include "light.h"
29 #include "type_of.h"
30 
31 namespace elm {
32 
33 namespace rtti {
34 
35 template <class T> struct _type<dyndata::AbstractIter<T> >
36  { static inline const Type& _(void) { return *static_cast<const Type *>(nullptr); } };
37 
38 // operations
39 class Parameter {
40 public:
41  inline Parameter(void): _type(&type_of<int>()) { }
42  inline Parameter(const Type& type): _type(&type) { }
43  inline Parameter(cstring name, const Type& type): _name(name), _type(&type) { }
44  inline cstring name(void) const { return _name; }
45  inline const Type& type(void) const { return *_type; }
46 private:
47  cstring _name;
48  const Type *_type;
49 };
50 
51 class Operation {
52 public:
53  typedef enum {
59  } kind_t;
60 
61  Operation(kind_t kind, cstring name, const Type& rtype = void_type);
62  Operation(kind_t kind, cstring name, const List<Parameter>& pars, const Type& rtype = void_type);
63  virtual ~Operation(void);
64 
65  inline kind_t kind(void) const { return _kind; }
66  inline cstring name(void) const { return _name; }
67  inline const Type& returnType(void) const { return _rtype; }
68  const List<Parameter>& parameters(void) const { return _pars; }
69 
70  virtual Variant call(const Vector<Variant>& args) const;
71 
72 protected:
73  void add(const Parameter& param);
74 
75 private:
76  kind_t _kind;
77  cstring _name;
78  List<Parameter> _pars;
79  const Type& _rtype;
80 };
81 
82 template <class T>
83 class Iterator: public Operation {
84 public:
85  inline Iterator(cstring name): Operation(ITER, name), _t(type_of<T>()) { }
86  inline const Type& itemType(void) const { return _t; }
87 private:
88  const Type& _t;
89 };
90 
91 template <class C, class O>
92 class CollectionIterator: public Iterator<typename C::t> {
93  typedef typename C::t t;
94 public:
95  typedef const C& (O::*fun_t)(void) const;
96  inline CollectionIterator(cstring name, fun_t fun): Iterator<t>(name), _fun(fun) { }
97  Variant call(const Vector<Variant>& args) const override {
98  const O *o = static_cast<const O *>(args[0].asPointer());
99  return new dyndata::IterInst<t, typename C::Iter>((o->*_fun)().begin());
100  }
101 private:
102  fun_t _fun;
103 };
104 
105 template <class T, class I, class O>
106 class IterIterator: public Iterator<T> {
107  typedef T t;
108 public:
110  Variant call(const Vector<Variant>& args) const override {
111  const O *o = static_cast<const O *>(args[0].asPointer());
112  return new dyndata::IterInst<t, I>(I(o));
113  }
114 };
115 
116 template <class T>
117 class Constructor0: public Operation {
118 public:
120  Variant call(const Vector<Variant>& args) const override { return new T(); }
121 };
122 
123 template <class T, class T1>
124 class Constructor1: public Operation {
125 public:
127  { add(Parameter(type_of<T1>())); }
128  Variant call(const Vector<Variant>& args) const override { return new T(args[0].as<T1>()); }
129 };
130 
131 template <class T, class T1, class T2>
132 class Constructor2: public Operation {
133 public:
135  { add(Parameter(type_of<T1>())); add(Parameter(type_of<T2>())); }
136  Variant call(const Vector<Variant>& args) const override { return new T(args[0].as<T1>(), args[1].as<T2>()); }
137 };
138 
139 inline Variant __call_static0(void (*f)(void)) { f(); return Variant(); }
140 template <class T> inline Variant __call_static0(T (*f)(void)) { return Variant(f()); }
141 template <class T>
142 class Static0: public Operation {
143 public:
144  Static0(cstring name, T (*f)(void)): Operation(STATIC, name, type_of<T>()), _f(f) { }
145  Variant call(const Vector<Variant>& args) const override { return __call_static0(_f); }
146 private:
147  T (*_f)(void);
148 };
149 
150 template <class T1> inline Variant __call_static1(void (*f)(T1), T1 a1) { f(a1); return Variant(); }
151 template <class T, class T1> inline Variant __call_static1(T (*f)(T1), T1 a1) { return Variant(f(a1)); }
152 template <class T, class T1>
153 class Static1: public Operation {
154 public:
155  Static1(cstring name, T (*f)(T1)): Operation(STATIC, name, type_of<T>()), _f(f) { add(Parameter(type_of<T1>())); }
156  Variant call(const Vector<Variant>& args) const override { return __call_static1(_f, args[0].as<T1>()); }
157 private:
158  T (*_f)(T1);
159 };
160 
161 template <class T1, class T2> inline Variant __call_static2(void (*f)(T1, T2), T1 a1, T2 a2) { f(a1, a2); return Variant(); }
162 template <class T, class T1, class T2> inline Variant __call_static2(T (*f)(T1, T2), T1 a1, T2 a2) { return Variant(f(a1, a2)); }
163 template <class T, class T1, class T2>
164 class Static2: public Operation {
165 public:
166  Static2(cstring name, T (*f)(T1, T2)): Operation(STATIC, name, type_of<T>()), _f(f)
167  { add(Parameter(type_of<T1>())); add(Parameter(type_of<T2>())); }
168  Variant call(const Vector<Variant>& args) const override { return __call_static2(_f, args[0].as<T1>(), args[1].as<T2>()); }
169 private:
170  T (*_f)(T1, T2);
171 };
172 
173 template <class C> inline Variant __call_method0(void (C::*f)(void), C *o) { (o->*f)(); return Variant(); }
174 template <class T, class C> inline Variant __call_method0(T (C::*f)(void), C *o) { return Variant((o->*f)()); }
175 template <class T, class C>
176 class Method0: public Operation {
177 public:
178  typedef T (C::*fun_t)(void);
179  Method0(cstring name, fun_t f): Operation(METHOD, name, type_of<T>()), _f(f) { add(Parameter(type_of<C>().pointer())); }
180  Variant call(const Vector<Variant>& args) const override { return __call_method0(_f, args[0].as<C *>()); }
181 private:
182  fun_t _f;
183 };
184 
185 template <class C> inline Variant __call_method0_const(void (C::*f)(void) const, const C *o) { (o->*f)(); return Variant(); }
186 template <class T, class C> inline Variant __call_method0_const(T (C::*f)(void) const, const C *o) { return Variant((o->*f)()); }
187 template <class T, class C>
188 class Method0Const: public Operation {
189 public:
190  typedef T (C::*fun_t)(void) const;
191  Method0Const(cstring name, fun_t f): Operation(METHOD, name, type_of<T>()), _f(f) { add(Parameter(type_of<C>().pointer())); }
192  Variant call(const Vector<Variant>& args) const override { return __call_method0_const(_f, args[0].as<const C *>()); }
193 private:
194  fun_t _f;
195 };
196 
197 template <class C, class T1> inline Variant __call_method1(void (C::*f)(T1), C *o, T1 a1) { (o->*f)(a1); return Variant(); }
198 template <class T, class C, class T1> inline Variant __call_method1(T (C::*f)(T1), C *o, T1 a1) { return Variant((o->*f)(a1)); }
199 template <class T, class C, class T1>
200 class Method1: public Operation {
201 public:
202  typedef T (C::*fun_t)(T1);
204  { add(Parameter(type_of<C>().pointer())); add(Parameter(type_of<T1>())); }
205  Variant call(const Vector<Variant>& args) const override { return __call_method1(_f, args[0].as<C *>(), args[1].as<T1>()); }
206 private:
207  fun_t _f;
208 };
209 
210 template <class C, class T1> inline Variant __call_method1_const(void (C::*f)(T1) const, const C *o, T1 a1) { (o->*f)(a1); return Variant(); }
211 template <class T, class C, class T1> inline Variant __call_method1_const(T (C::*f)(T1) const, const C *o, T1 a1) { return Variant((o->*f)(a1)); }
212 template <class T, class C, class T1>
213 class Method1Const: public Operation {
214 public:
215  typedef T (C::*fun_t)(T1) const;
217  { add(Parameter(type_of<C>().pointer())); add(Parameter(type_of<T1>())); }
218  Variant call(const Vector<Variant>& args) const override { return __call_method1_const(_f, args[0].as<const C *>(), args[1].as<T1>()); }
219 private:
220  fun_t _f;
221 };
222 
223 template <class C, class T1, class T2> inline Variant __call_method2(void (C::*f)(T1, T2), C *o, T1 a1, T2 a2) { (o->*f)(a1, a2); return Variant(); }
224 template <class T, class C, class T1, class T2> inline Variant __call_method2(T (C::*f)(T1, T2), C *o, T1 a1, T2 a2) { return Variant((o->*f)(a1, a2)); }
225 template <class T, class C, class T1, class T2>
226 class Method2: public Operation {
227 public:
228  typedef T (C::*fun_t)(T1, T2);
230  { add(Parameter(type_of<C>().pointer())); add(Parameter(type_of<T1>())); add(Parameter(type_of<T2>())); }
231  Variant call(const Vector<Variant>& args) const override { return __call_method2(_f, args[0].as<C *>(), args[1].as<T1>(), args[2].as<T2>()); }
232 private:
233  fun_t _f;
234 };
235 
236 template <class C, class T1, class T2> inline Variant __call_method2_const(void (C::*f)(T1, T2) const, const C *o, T1 a1, T2 a2) { (o->*f)(a1, a2); return Variant(); }
237 template <class T, class C, class T1, class T2> inline Variant __call_method2_const(T (C::*f)(T1, T2) const, const C *o, T1 a1, T2 a2) { return Variant((o->*f)(a1, a2)); }
238 template <class T, class C, class T1, class T2>
239 class Method2Const: public Operation {
240 public:
241  typedef T (C::*fun_t)(T1, T2) const;
243  { add(Parameter(type_of<C>().pointer())); add(Parameter(type_of<T1>())); add(Parameter(type_of<T2>())); }
244  Variant call(const Vector<Variant>& args) const override { return __call_method2_const(_f, args[0].as<const C *>(), args[1].as<T1>(), args[2].as<T2>()); }
245 private:
246  fun_t _f;
247 };
248 
249 
250 // class definition
251 class make {
252  friend class AbstractClass;
253 public:
254  inline make(cstring name): _name(name), _base(&void_type.asClass()) { }
255  template <class T> inline make& extend(void) { _base = &type_of<T>().asClass(); return *this; }
256  inline make& extend(const AbstractClass& base) { _base = &base; return *this; }
257  inline make& extend(const Type& base) { _base = &base.asClass(); return *this; }
258  inline make& add(Operation *op) { _ops.add(op); return *this; }
259 
260  template <class T> inline make& construct(cstring name) { _ops.add(new Constructor0<T>(name)); return *this; }
261  template <class T, class T1> inline make& construct(cstring name) { _ops.add(new Constructor1<T, T1>(name)); return *this; }
262  template <class T, class T1, class T2> inline make& construct(cstring name) { _ops.add(new Constructor2<T, T1, T2>(name)); return *this; }
263 
264  template <class T> inline make& op(cstring name, T (*f)(void)) { _ops.add(new Static0<T>(name, f)); return *this; }
265  template <class T, class T1> inline make& op(cstring name, T (*f)(T1)) { _ops.add(new Static1<T, T1>(name, f)); return *this; }
266  template <class T, class T1, class T2> inline make& op(cstring name, T (*f)(T1, T2)) { _ops.add(new Static2<T, T1, T2>(name, f)); return *this; }
267 
268  template <class T, class C> inline make& op(cstring name, T (C::*f)(void)) { _ops.add(new Method0<T, C>(name, f)); return *this; }
269  template <class T, class C, class T1> inline make& op(cstring name, T (C::*f)(T1)) { _ops.add(new Method1<T, C, T1>(name, f)); return *this; }
270  template <class T, class C, class T1, class T2> inline make& op(cstring name, T (C::*f)(T1, T2)) { _ops.add(new Method2<T, C, T1, T2>(name, f)); return *this; }
271 
272  template <class T, class C> inline make& op(cstring name, T (C::*f)(void) const) { _ops.add(new Method0Const<T, C>(name, f)); return *this; }
273  template <class T, class C, class T1> inline make& op(cstring name, T (C::*f)(T1) const) { _ops.add(new Method1Const<T, C, T1>(name, f)); return *this; }
274  template <class T, class C, class T1, class T2> inline make& op(cstring name, T (C::*f)(T1, T2) const) { _ops.add(new Method2Const<T, C, T1, T2>(name, f)); return *this; }
275 
276  template <class C, class O> inline make& coll(cstring name, const C& (O::*f)(void) const)
277  { _ops.add(new CollectionIterator<C, O>(name, f)); return *this; }
278  template <class T, class I, class O> inline make& iter(cstring name)
279  { _ops.add(new IterIterator<T, I, O>(name)); return *this; }
280 
281 private:
282  cstring _name;
283  const AbstractClass *_base;
284  List<Operation *> _ops;
285 };
286 
287 class Tuple;
288 
289 class AbstractClass: public rtti::Type {
290  friend class Operation;
291 public:
292 
294  AbstractClass(const make& m);
295  AbstractClass(const make& m, const AbstractClass& base);
296 
297  inline const AbstractClass& base(void) const { return _base; };
298  virtual void *instantiate(void) const = 0;
299  virtual void free(void *obj) const = 0;
300  bool baseOf(const AbstractClass *clazz);
301  virtual bool isClass(void) const;
302  virtual const AbstractClass& asClass(void) const;
303  virtual void *upCast(void *ptr) const;
304  virtual void *downCast(void *ptr) const;
305  virtual const Tuple *toTuple() const;
306 
307  void *upCast(void *ptr, const AbstractClass& cls) const;
308  void *downCast(void *ptr, const AbstractClass& cls) const;
309 
310  inline const void *upCast(const void *ptr) const { return upCast(const_cast<void *>(ptr)); }
311  inline const void *downCast(const void *ptr) const { return downCast(const_cast<void *>(ptr)); }
312  inline const void *upCast(const void *ptr, const AbstractClass& cls) const { return upCast(const_cast<void *>(ptr), cls); }
313  inline const void *downCast(const void *ptr, const AbstractClass& cls) const { return downCast(const_cast<void *>(ptr), cls); }
314 
315  inline const List<Operation *>& operations(void) const { return _ops; }
316  inline const List<const Type *> params(void) const { return _params; }
317 
318 private:
319  const AbstractClass& _base;
320  List<Operation *> _ops;
321  List<const Type *> _params;
322 };
323 
324 class TemplateClass: public AbstractClass, public TemplateType {
325 public:
326  TemplateClass(int count, make& make);
327  const TemplateType *asTemplate(void) const override;
328  int count(void) const override;
329 private:
330  int _count;
331 };
332 
333 class InstanceClass: public AbstractClass, public InstanceType {
334 public:
335 
336  class instantiate {
337  friend class InstanceClass;
338  public:
339  inline instantiate(const TemplateClass& temp): _temp(temp) { }
340  template <class T> inline instantiate& add(void) { _params.add(&type_of<T>()); return *this; }
341  private:
342  const TemplateClass& _temp;
343  List<const Type *> _params;
344  };
345 
346  InstanceClass(const make& m, const instantiate& i);
347  const InstanceType *asInstance(void) const override;
348  const Type& templ(void) const override;
349  const List<const Type *> params(void) const override;
350 
351 private:
352  const TemplateClass& _temp;
353  const List<const Type *> _params;
354 };
355 
356 template <class T>
357 struct no_inst {
358  static inline T *_(void) { return nullptr; }
359  static inline void _free(void *p) { }
360 };
361 template <class T>
362 struct inst {
363  static inline T *_(void) { return new T; }
364  static inline void _free(void *p) { delete static_cast<T*>(p); }
365 };
366 
367 template <class T, class B = void, template <class _ > class I = inst>
368 class Class: public AbstractClass {
369 public:
370  inline Class(CString name, const AbstractClass& base = type_of<B>().asClass()): AbstractClass(name, base) { };
371  inline Class(const make& m): AbstractClass(m, type_of<B>().asClass()) { }
372  void *instantiate(void) const override { return I<T>::_(); };
373  void free(void *obj) const override { I<T>::_free(obj); }
374  void *upCast(void *ptr) const override { return static_cast<B *>(static_cast<T *>(ptr)); }
375  void *downCast(void *ptr) const override { return static_cast<T *>(static_cast<B *>(ptr)); }
376 
377  inline void *upCast(void *ptr, const AbstractClass& cls) const { return AbstractClass::upCast(const_cast<void *>(ptr), cls); }
378  inline void *downCast(void *ptr, const AbstractClass& cls) const { return AbstractClass::downCast(const_cast<void *>(ptr), cls); }
379  inline const void *upCast(const void *ptr) const { return AbstractClass::upCast(ptr); }
380  inline const void *downCast(const void *ptr) const { return AbstractClass::downCast(ptr); }
381  inline const void *upCast(const void *ptr, const AbstractClass& cls) const { return AbstractClass::upCast(ptr, cls); }
382  inline const void *downCast(const void *ptr, const AbstractClass& cls) const { return AbstractClass::downCast(ptr, cls); }
383 };
384 
385 
386 // macros
387 #define ELM_IS_CLASS_EXTEND(name, base) \
388  public: \
389  typedef base __base; \
390  static elm::rtti::Class<name, base> __type; \
391  const elm::rtti::Type& getType(void) const override; \
392  private:
393 
394 #define ELM_CLASS_EXTEND(name, base) \
395  class name: public base { \
396  ELM_IS_CLASS_EXTEND(name, base)
397 
398 #define ELM_IS_CLASS(name) \
399  public: \
400  typedef void __base; \
401  static elm::rtti::Class<name, void> __type; \
402  const elm::rtti::Type& getType(void) const override; \
403  private:
404 
405 #define ELM_CLASS(name) \
406  class name: public elm::rtti::Object { \
407  ELM_IS_CLASS(name)
408 
409 #define ELM_END_CLASS };
410 
411 #define ELM_IMPLEMENT(name) \
412  elm::rtti::Class<name, typename name::__base> name::__type(#name); \
413  const elm::rtti::Type& name::getType(void) const { return __type; }
414 
415 #ifndef ELM_NO_SHORTCUT
416 # define IS_CLASS_EXTEND(name, base) ELM_IS_CLASS_EXTEND(name, base)
417 # define CLASS_EXTEND(name, base) ELM_CLASS_EXTEND(name, base)
418 # define IS_CLASS(name) ELM_IS_CLASS(name)
419 # define CLASS(name) ELM_CLASS(name)
420 # define END_CLASS ELM_END_CLASS
421 # define IMPLEMENT(name) ELM_IMPLEMENT(name)
422 #endif
423 
424 } } // elm::rtti
425 
426 #endif /* ELM_RTTI_CLASS_H_ */
elm::rtti::Tuple
Definition: Tuple.h:29
elm::rtti::AbstractClass::toTuple
virtual const Tuple * toTuple() const
Definition: rtti.cpp:958
elm::Variant
Definition: Variant.h:92
elm::rtti::__call_static0
Variant __call_static0(void(*f)(void))
Definition: Class.h:139
elm::rtti::Static1::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:156
elm::rtti::Method2
Definition: Class.h:226
elm::rtti::__call_method0_const
Variant __call_method0_const(void(C::*f)(void) const, const C *o)
Definition: Class.h:185
elm::rtti::Type::name
string name(void) const
Definition: Type.h:91
elm::rtti::Class::downCast
void * downCast(void *ptr) const override
Definition: Class.h:375
elm::rtti::Class::upCast
void * upCast(void *ptr, const AbstractClass &cls) const
Definition: Class.h:377
elm::rtti::Method2Const::Method2Const
Method2Const(cstring name, fun_t f)
Definition: Class.h:242
elm::rtti::AbstractClass::upCast
virtual void * upCast(void *ptr) const
Definition: rtti.cpp:937
elm::rtti::Operation::CONSTRUCTOR
@ CONSTRUCTOR
Definition: Class.h:55
elm::io::p
Printable< T, M > p(const T &data, const M &man)
Definition: Output.h:302
elm::rtti::Method0Const
Definition: Class.h:188
elm::rtti::Method0::Method0
Method0(cstring name, fun_t f)
Definition: Class.h:179
elm::rtti::Iterator::Iterator
Iterator(cstring name)
Definition: Class.h:85
elm::rtti::Constructor0
Definition: Class.h:117
elm::rtti::Operation::~Operation
virtual ~Operation(void)
Definition: rtti.cpp:1377
elm::rtti::InstanceClass::instantiate::instantiate
instantiate(const TemplateClass &temp)
Definition: Class.h:339
elm::rtti::Static2::Static2
Static2(cstring name, T(*f)(T1, T2))
Definition: Class.h:166
elm::rtti::Method2::fun_t
T(C::* fun_t)(T1, T2)
Definition: Class.h:228
elm::rtti::inst::_free
static void _free(void *p)
Definition: Class.h:364
elm::rtti::Static1
Definition: Class.h:153
elm::rtti::make::op
make & op(cstring name, T(*f)(void))
Definition: Class.h:264
elm::rtti::AbstractClass::downCast
const void * downCast(const void *ptr, const AbstractClass &cls) const
Definition: Class.h:313
elm::rtti::make::extend
make & extend(void)
Definition: Class.h:255
elm::rtti::Method1Const::Method1Const
Method1Const(cstring name, fun_t f)
Definition: Class.h:216
elm::rtti::Operation::NONE
@ NONE
Definition: Class.h:54
elm::rtti::Class
Definition: Class.h:368
elm::rtti::Operation::ITER
@ ITER
Definition: Class.h:58
elm::rtti::AbstractClass::downCast
const void * downCast(const void *ptr) const
Definition: Class.h:311
elm::rtti::Operation::add
void add(const Parameter &param)
Definition: rtti.cpp:1405
elm::rtti::Operation::name
cstring name(void) const
Definition: Class.h:66
elm::rtti::InstanceClass::asInstance
const InstanceType * asInstance(void) const override
Definition: rtti.cpp:1052
elm::rtti::make::add
make & add(Operation *op)
Definition: Class.h:258
elm::rtti::make::extend
make & extend(const Type &base)
Definition: Class.h:257
elm::rtti::no_inst::_
static T * _(void)
Definition: Class.h:358
elm::rtti::Operation::kind
kind_t kind(void) const
Definition: Class.h:65
elm::rtti::Method0::fun_t
T(C::* fun_t)(void)
Definition: Class.h:178
elm::rtti::_type
Definition: type_of.h:48
elm::rtti::Static0::Static0
Static0(cstring name, T(*f)(void))
Definition: Class.h:144
elm::dyndata::IterInst
Definition: Collection.h:30
elm::io::base
IntFormat base(int base, IntFormat fmt)
Definition: Output.h:256
elm::rtti::Method2Const::fun_t
T(C::* fun_t)(T1, T2) const
Definition: Class.h:241
elm::rtti::Parameter::Parameter
Parameter(void)
Definition: Class.h:41
elm::rtti::Constructor2::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:136
elm::rtti::make::op
make & op(cstring name, T(C::*f)(T1))
Definition: Class.h:269
elm::rtti::Constructor1::Constructor1
Constructor1(cstring name)
Definition: Class.h:126
elm::rtti::Operation::call
virtual Variant call(const Vector< Variant > &args) const
Definition: rtti.cpp:1399
elm::rtti::TemplateClass::asTemplate
const TemplateType * asTemplate(void) const override
Definition: rtti.cpp:1023
elm::rtti::Method0::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:180
elm::rtti::AbstractClass::asClass
virtual const AbstractClass & asClass(void) const
Definition: rtti.cpp:927
elm::rtti::make::op
make & op(cstring name, T(C::*f)(T1, T2))
Definition: Class.h:270
elm::rtti::CollectionIterator::CollectionIterator
CollectionIterator(cstring name, fun_t fun)
Definition: Class.h:96
elm::rtti::CollectionIterator
Definition: Class.h:92
elm::io::pointer
IntFormat pointer(const void *p)
Definition: io_Output.cpp:871
elm::rtti::AbstractClass::operations
const List< Operation * > & operations(void) const
Definition: Class.h:315
elm::rtti::make::iter
make & iter(cstring name)
Definition: Class.h:278
elm::rtti::TemplateClass
Definition: Class.h:324
elm::rtti::make::coll
make & coll(cstring name, const C &(O::*f)(void) const)
Definition: Class.h:276
elm::rtti::Parameter::name
cstring name(void) const
Definition: Class.h:44
void
elm::rtti::AbstractClass::downCast
virtual void * downCast(void *ptr) const
Definition: rtti.cpp:947
elm::rtti::Constructor2::Constructor2
Constructor2(cstring name)
Definition: Class.h:134
elm::rtti::InstanceClass::instantiate::add
instantiate & add(void)
Definition: Class.h:340
elm::rtti::make::op
make & op(cstring name, T(C::*f)(void) const)
Definition: Class.h:272
elm::rtti::Parameter
Definition: Class.h:39
elm::CString
Definition: CString.h:17
elm::rtti::InstanceClass
Definition: Class.h:333
elm::rtti::IterIterator
Definition: Class.h:106
elm::rtti::AbstractClass::params
const List< const Type * > params(void) const
Definition: Class.h:316
elm::rtti::Method0Const::Method0Const
Method0Const(cstring name, fun_t f)
Definition: Class.h:191
elm::rtti::CollectionIterator::fun_t
const typedef C &(O::* fun_t)(void) const
Definition: Class.h:95
elm::rtti::Constructor0::Constructor0
Constructor0(cstring name)
Definition: Class.h:119
elm::rtti::make::op
make & op(cstring name, T(C::*f)(T1) const)
Definition: Class.h:273
elm::rtti::__call_method1
Variant __call_method1(void(C::*f)(T1), C *o, T1 a1)
Definition: Class.h:197
elm::rtti::Class::free
void free(void *obj) const override
Definition: Class.h:373
elm::rtti::Static2::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:168
elm::rtti::void_type
const Type & void_type
Definition: type_of.h:45
elm::rtti::Parameter::Parameter
Parameter(const Type &type)
Definition: Class.h:42
elm::rtti::__call_method0
Variant __call_method0(void(C::*f)(void), C *o)
Definition: Class.h:173
elm::rtti::Method2::Method2
Method2(cstring name, fun_t f)
Definition: Class.h:229
elm::rtti::Operation::parameters
const List< Parameter > & parameters(void) const
Definition: Class.h:68
elm::rtti::Method2::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:231
elm::type_of
const rtti::Type & type_of(void)
Definition: type_of.h:77
elm::_
AutoStringStartup & _
Definition: debug_CrashHandler.cpp:232
elm::rtti::AbstractClass::free
virtual void free(void *obj) const =0
elm::rtti::Parameter::Parameter
Parameter(cstring name, const Type &type)
Definition: Class.h:43
elm::rtti::Class::Class
Class(const make &m)
Definition: Class.h:371
elm::rtti::make::op
make & op(cstring name, T(C::*f)(T1, T2) const)
Definition: Class.h:274
elm::rtti::Static0
Definition: Class.h:142
elm::rtti::__call_static2
Variant __call_static2(void(*f)(T1, T2), T1 a1, T2 a2)
Definition: Class.h:161
elm::rtti::Parameter::type
const Type & type(void) const
Definition: Class.h:45
elm::rtti::Method1::Method1
Method1(cstring name, fun_t f)
Definition: Class.h:203
elm::rtti::AbstractClass::upCast
const void * upCast(const void *ptr) const
Definition: Class.h:310
elm::rtti::TemplateClass::TemplateClass
TemplateClass(int count, make &make)
Definition: rtti.cpp:1018
elm::rtti::Constructor2
Definition: Class.h:132
elm
Definition: adapter.h:26
elm::rtti::Class::upCast
void * upCast(void *ptr) const override
Definition: Class.h:374
elm::rtti::AbstractClass::instantiate
virtual void * instantiate(void) const =0
elm::rtti::Class::downCast
void * downCast(void *ptr, const AbstractClass &cls) const
Definition: Class.h:378
elm::rtti::Method1Const::fun_t
T(C::* fun_t)(T1) const
Definition: Class.h:215
elm::rtti::Operation::METHOD
@ METHOD
Definition: Class.h:56
elm::rtti::CollectionIterator::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:97
elm::rtti::AbstractClass::upCast
const void * upCast(const void *ptr, const AbstractClass &cls) const
Definition: Class.h:312
elm::Vector
Definition: Vector.h:34
elm::rtti::make::construct
make & construct(cstring name)
Definition: Class.h:261
elm::rtti::Class::downCast
const void * downCast(const void *ptr, const AbstractClass &cls) const
Definition: Class.h:382
elm::rtti::__call_method1_const
Variant __call_method1_const(void(C::*f)(T1) const, const C *o, T1 a1)
Definition: Class.h:210
elm::rtti::TemplateType
Definition: Type.h:59
elm::rtti::make::op
make & op(cstring name, T(*f)(T1))
Definition: Class.h:265
elm::rtti::Method0
Definition: Class.h:176
elm::rtti::AbstractClass::isClass
virtual bool isClass(void) const
Definition: rtti.cpp:921
elm::rtti::__call_static1
Variant __call_static1(void(*f)(T1), T1 a1)
Definition: Class.h:150
elm::rtti::Method1Const
Definition: Class.h:213
elm::rtti::__call_method2_const
Variant __call_method2_const(void(C::*f)(T1, T2) const, const C *o, T1 a1, T2 a2)
Definition: Class.h:236
elm::rtti::Operation::Operation
Operation(kind_t kind, cstring name, const Type &rtype=void_type)
Definition: rtti.cpp:1365
elm::rtti::Class::downCast
const void * downCast(const void *ptr) const
Definition: Class.h:380
elm::rtti::Static1::Static1
Static1(cstring name, T(*f)(T1))
Definition: Class.h:155
elm::rtti::make::construct
make & construct(cstring name)
Definition: Class.h:262
elm::rtti::AbstractClass::base
const AbstractClass & base(void) const
Definition: Class.h:297
elm::rtti::Class::Class
Class(CString name, const AbstractClass &base=type_of< B >().asClass())
Definition: Class.h:370
elm::rtti::make::op
make & op(cstring name, T(C::*f)(void))
Definition: Class.h:268
elm::rtti::AbstractClass::baseOf
bool baseOf(const AbstractClass *clazz)
Definition: rtti.cpp:910
elm::rtti::Class::upCast
const void * upCast(const void *ptr) const
Definition: Class.h:379
elm::rtti::Iterator
Definition: Class.h:83
elm::rtti::IterIterator::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:110
elm::rtti::Static0::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:145
elm::rtti::InstanceClass::params
const List< const Type * > params(void) const override
Definition: rtti.cpp:1064
elm::rtti::Constructor1
Definition: Class.h:124
elm::rtti::Method0Const::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:192
elm::rtti::Operation::kind_t
kind_t
Definition: Class.h:53
elm::rtti::Operation
Definition: Class.h:51
elm::rtti::AbstractClass::AbstractClass
AbstractClass(CString name, const AbstractClass &base)
Definition: rtti.cpp:863
elm::rtti::Method1Const::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:218
elm::rtti::inst::_
static T * _(void)
Definition: Class.h:363
elm::rtti::Constructor0::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:120
elm::rtti::InstanceType
Definition: Type.h:67
elm::rtti::InstanceClass::instantiate
Definition: Class.h:336
elm::rtti::Method2Const::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:244
elm::rtti::IterIterator::IterIterator
IterIterator(cstring name)
Definition: Class.h:109
elm::rtti::make::op
make & op(cstring name, T(*f)(T1, T2))
Definition: Class.h:266
elm::rtti::AbstractClass
Definition: Class.h:289
elm::rtti::Method1
Definition: Class.h:200
elm::rtti::InstanceClass::templ
const Type & templ(void) const override
Definition: rtti.cpp:1058
elm::rtti::make::make
make(cstring name)
Definition: Class.h:254
elm::rtti::TemplateClass::count
int count(void) const override
Definition: rtti.cpp:1029
elm::rtti::inst
Definition: Class.h:362
elm::rtti::Constructor1::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:128
elm::rtti::Operation::STATIC
@ STATIC
Definition: Class.h:57
elm::rtti::no_inst
Definition: Class.h:357
elm::rtti::Method1::call
Variant call(const Vector< Variant > &args) const override
Definition: Class.h:205
elm::rtti::Method0Const::fun_t
T(C::* fun_t)(void) const
Definition: Class.h:190
elm::rtti::Operation::returnType
const Type & returnType(void) const
Definition: Class.h:67
elm::rtti::no_inst::_free
static void _free(void *p)
Definition: Class.h:359
elm::rtti::Method1::fun_t
T(C::* fun_t)(T1)
Definition: Class.h:202
elm::rtti::__call_method2
Variant __call_method2(void(C::*f)(T1, T2), C *o, T1 a1, T2 a2)
Definition: Class.h:223
elm::rtti::InstanceClass::InstanceClass
InstanceClass(const make &m, const instantiate &i)
Definition: rtti.cpp:1046
elm::rtti::Static2
Definition: Class.h:164
elm::rtti::make::construct
make & construct(cstring name)
Definition: Class.h:260
elm::List
Definition: List.h:34
elm::rtti::make::extend
make & extend(const AbstractClass &base)
Definition: Class.h:256
elm::rtti::make
Definition: Class.h:251
elm::rtti::Type
Definition: Type.h:83
elm::rtti::Class::upCast
const void * upCast(const void *ptr, const AbstractClass &cls) const
Definition: Class.h:381
elm::rtti::Iterator::itemType
const Type & itemType(void) const
Definition: Class.h:86
elm::rtti::_type< dyndata::AbstractIter< T > >::_
static const Type & _(void)
Definition: Class.h:36
elm::rtti::Method2Const
Definition: Class.h:239
elm::rtti::Class::instantiate
void * instantiate(void) const override
Definition: Class.h:372