So, are you working on these things?:
There is only one copy of the metadata for Foo. To do what you propose, you would need to copy all of Foo's metadata up into Bar and Baz, and that would take more memory at runtime.
Devil's Advocate Question: What is the benefit of what you are proposing? If you could write a syntax to select a specific field nested within one or more aggregates/arrays, why would you not just use C++ syntax to select that memory? The driving thrust of Reflection/Introspection is so that you can write code that doesn't need to assume a particular field layout or aggregation. Inventing a whole separate syntax to handle aggregates and array/associative-array item selection seems overcomplex (but this depends on the problem you are trying to solve).
int main()
{
Initialize();
Blob blob;
meta_lookup& metalookup = meta_lookup::get_instance();
ComicUniverse* pComic1= new ComicUniverse ();
metalookup.add( ComicUniverse::s_MetaClass ); // extension to register.....
std::vector<uint32_t> vChgFields; // crc to changed "field_paths"
// Kind of workflow
if( editor )
{
// Editor ( work with tmp_obj = pComic1->clone() )
m_pWxHelium = new wxHeliumProperty(wxT("Helium"),wxPG_LABEL, pComic1 );
m_pWxHelium->get_changes( vChgFields );
}
else
{
// or hardcoded.. not a common use case
pComic1->m_Heroes[ 3 ].m_Name = TXT("testing");
pComic1->m_Heroes[ 3 ].m_HitPoints = 42;
pComic1->m_Heroes[ 7 ].m_HitPoints = 24;
vChgFields.push_back(Crc32("Heroes[3]:hp"));
vChgFields.push_back(Crc32("Heroes[3]:name"));
vChgFields.push_back(Crc32("Heroes[7]:hp"));
}
// Just, playing with Pointer & Field operations...workhorse for blob:write and editor
Pointer ptr;
const Field* field=0;
metalookup.find( pComic1, vChgFields[0], ptr, field );
uint32_t hp3 = ptr.As<uint32_t>();
metalookup.find( pComic1, vChgFields[1], ptr, field );
String name3 = ptr.As<String>();
metalookup.find( pComic1, vChgFields[2], ptr, field );
uint32_t hp7 = ptr.As<uint32_t>();
2) Pubsub
I am all for keeping things modular, but I can't quite conceive of the design of what you want to build just from what you have included in this post. Personally those simulation network libraries are overcomplicated. Can you elaborate a bit more on how you want transmission/sync to work between objects in different address spaces? (I assume this is the problem you are trying to solve). I also find that approach interesting but I haven't settled in my head on a good approach to doing that with only reflection and reliable UDP.
// Write selected/changed fields to blob ( using metalookup.find + serialize_translator for each "field" )
blob.write(pComic1,vChgFields);
Publisher :
ENet => send( blob ) => "subscribers"
Subscriber:
ENet=> receive( blob ) => find object => blob.read(object/changes); => display updates.....
wxHeliumProperty
, ENet pub/sub )PropertyGrid integration would be cool :) Keep in mind though that there is a reflection-driven properties system in Helium already: Inspect. Inspect itself is toolkit agnostic, and the wxWidgets integration is currently implemented in the Editor project (all wx code is currently there).Are you inventing your own binary blob format? FWIW I really, really like msgpack and its somewhat widely supported. The msgpack implementation that is in Persist right now is a work-in-progress. Really the json support is the only fully functional Persist implementation. I have been trying to think of a better way of abstracting different formats that how the Persist Archive classes are currently used. Some way we could make Archive a template class instead of polymorphic would be nice. That way one could just implement some template functions against the data format library (libbson, libmsgpack, rapidjson) intead of having to re-implement the core logic of traversing fields and data structures, which is tricky business!