All, a while ago someone mentioned converting Avalon and Excalibur to C++. Back then, I replied that porting it to C# might be a better idea, but since then I have grown to appreciate the versality of the framework, and I believe that the design patterns used in Avalon can be used not for just server applications (I believe there is at least one person using it to write a simulator).
Instead of talking about how it could be implemented in C++, I have done an implementation of a component manager and some lifestyle interfaces. (So I am afraid that in terms of functionality this is your regular version 0.0.0 freshmeat.net announcement.) The whole bunch is downloadable from http://www.student.nada.kth.se/~d97-lsu/massdriver/ and all code is under an Apache license unless explicitely mentioned otherwise in the code (there are no instances that I know of). The implementation relies heavily on RTTI at the moment, so this has to be evaluated in relation to shared object files, different compilers, different languages, project goals, etc. SAMPLE: /** * Component interface for the test component. */ class TestInterface : public virtual Component { public: /** * Single method. */ virtual void Method () = 0; /** * Default role for the component. * This UID is unique for the interface and * specialization should be done by using the * UID(UID&,UID&) constructor. */ static const UID ROLE; }; /** * Definition of the TestInterface's role. */ const UID TestInterface::ROLE(0x97413A80L, 0xDB8711D5L, 0xB1EB00C0L, 0x26010A22L); /** * Implementation of the TestInterface. */ class TestComponent : public virtual AbstractComponent, TestInterface, Initializable, AbstractComposable, Disposable { public: TestComponent (); virtual ~TestComponent (); virtual void Dispose (); virtual void Initialize (); virtual void Method (); /** * Standard method to get a factory for the * component. */ static ComponentFactory* GetFactory (); }; void main (int, char*[]) { DefaultComponentManager* dcm = new DefaultComponentManager (); // Add our single component dcm->AddComponent (TestInterface::ROLE, TestComponent::GetFactory ()); // Initialize the CM. dcm->Initialize (); // Cast to ComponentManager*. ComponentManager* cm = dynamic_cast<ComponentManager*> (dcm); if (cm != NULL) { // Guard the component to make sure it gets released no matter what happens. Guard<TestInterface> tc (cm, TestInterface::ROLE); if (tc) { printf (" INFO: Got component.\n"); cout << "Retrieved a " << typeid(tc).name() << endl; tc->Method (); } else { printf ("ERROR: Could not obtain component\n"); } printf (" INFO: Leaving guard scope...\n"); } else { printf ("ERROR: Unable to cast from DCM to CM\n"); } printf (" INFO: Done with component\n"); // Dispose and delete the CM. dcm->Dispose (); delete dcm; } /LS -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>