c++ - Deciding about constructed objects at compilation time -


i have following problem solve.

i have component a. component has sub-components - b,c,d. using cmake building or not b,c,d components. depends on current platform configuration. cmake system making executable makefiles (for component) linking components, used in given cmake run. if component b built, added executable if not - not linked. same other - c,d.

all b,c,d components provide implementations of interface used in component. component shall manage objects created b,c,d , keep objects in map, using proper object @ proper time.

question:

i want achieve simple , reliable mechanism adding objects implementing interface automatically, same linking - linked modules, built. same objects - have them registered in component when compiled.

it hard me explain it. idea easy - build map of objects @ compilation time. components compiled shall deliver object map.

i have used designs similar how objective-c , smalltalk implement methods.

in c++, methods == member functions , must defined @ compile time. so, though interface can extended mechanisms such preprocessor, same configuration must affect clients of class, or won't link.

so use message passing system invoke methods on objects. if main class, , compile in c , d not b, message processor of respond messages have handlers registered c , d.

this type of design require having messaging system of sort. there numerous existing systems such google protocol buffers , apache thrift. chose design 1 since wanted more runtime configurability existing systems allow (many of these messaging systems have idl compilers involved).

however, did allow me closer oo realm mixed-paradigm language c++ typically permits.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -