Re: Complexity of new hardware

"Jarkko Lempiainen" <[email protected]>
Newsgroups gmane.games.devel.algorithms
Message-ID <EF874F29476047029CB34DFEFD716050@Tikru>
Yes, amongst few other things PFC_MONO macro defines a template function for
introspection, and PFC_VAR() macros expand to calls to the property
enumeration interface passed to the function (e.g. PFC_VAR(x); ->
pe_.var("x", v_.x);) Because it's a function, you can also define custom
introspection which is sometimes necessary by writing code instead of using
PFC_VAR() macros.

The advantage of non-custom introspection is that it can perform automatic
data conversion when loading data which I have found extremely useful, i.e.
if you add/remove variables or change variable types it's still able to load
the old data. Otherwise you would have to hand-code the conversion which
could get quite a taunting task.


Cheers, Jarkko


-----Original Message-----
From: Will Vale [mailto:[email protected]] 
Sent: Sunday, April 19, 2009 5:33 AM
To: Game Development Algorithms
Subject: Re: [Algorithms] Complexity of new hardware

On Sun, 19 Apr 2009 03:03:27 +1200, Jarkko Lempiainen <[email protected]>  
wrote:
> All I have is something like:
>struct foo
> { PFC_MONO(foo) {PFC_VAR3(x, y, z);}
>   int x, y, z;
> };

That's admirably brief! I assume you're generating code rather than data  
though - which tends to be more verbose, or at least it does for me.

One trick I found helpful to avoid identifier repetition was to move some  
commas inside macros, to avoid having to specify the parent name twice in  
IMPLEMENT_BEGIN/IMPLEMENT_END and still avoid explict arity:

// rtti.h - detail elided
#define COMPOUND(name) static const member_t members[];
#define RTTI(name, members) const member_t name::members[] = { members {  
NULL, ... } };
#define MEMBER(name) { #name, ... },

// foo.h
struct foo
{
COMPOUND(foo)

int x, y, z;
};

// foo.cpp - essentially generates const member_t foo::members[] = { ... };
RTTI(foo, MEMBER(x) MEMBER(y) MEMBER(z))

Cheers,

Will


----------------------------------------------------------------------------
--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.