#include "RegistryAccess.h" #include "Class.h" #include "ClassBuilder.h" #include "GetType.h" #include "BuiltinTypes.h" #include "Reference.h" //---------------------------------------------------------------------------------------- #include #include using namespace std; struct Servant0 { int N; Servant0() { N = 42; } static void Register(Registry &R) { ClassBuilder(R, "Servant0") (&Servant0::Method0, "Method0") (&Servant0::Method1, "Method1") ; } void Method0() { } void Method1(int N) { } }; struct Servant1 : ServerBase { static void Register(Registry &R) { ClassBuilder(R, "Servant1") (&Servant1::foo, "foo") (&Servant1::bar, "bar") ; } void foo(int N, String S) { cout << "Servant1::foo: "; while (N-- > 0) cout << S; cout << endl; } void bar(String S, Servant0 Q) { cout << "Servant1::bar: S=" << S << ", Q.N=" << Q.N << endl; } }; namespace Type { template <> struct Traits : MakeTraits { }; template <> struct Traits : MakeTraits { }; } #include int main() { Registry R; Servant0::Register(R); Servant1::Register(R); Pointer S0 = R.New(); Pointer S1 = R.New(); Object Q0 = S0; // GCC WTF? Reference V0 = Q0; Pointer N = R.New(3); Pointer S = R.New("Hello "); Stack args; args.PushBack(S0); args.PushBack(R.New("World")); args.PushBack(S); args.PushBack(N); ClassBase *K = R.GetClassBase(Type::Traits::TypeNumber); K->GetMethod("foo").Invoke(&*S1, args); K->GetMethod("bar").Invoke(&*S1, args); cout << "\n------\n"; fstream file("/tmp/types.xml", ios::out); String classes = R.WriteClassesXML(); file << classes; cout << classes; } //EOF