diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-20 09:50:20 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-20 09:50:20 +0000 |
commit | 4c69eb46c553337e27b2bd81bc1e30f41cdd48cd (patch) | |
tree | ffe3c02793725d9918da4274eed6e9cbb992e17a /cpp/sca/runtime/extensions | |
parent | 28a8730ea280024f75075b0826c931756c394e3d (diff) |
TUSCANY-2643 - Patch supplied by Julien Bigot to correct the handling of composite scoped components. Thanks Julien.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@706173 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/sca/runtime/extensions')
4 files changed, 25 insertions, 14 deletions
diff --git a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp index fbf8281178..1304ab92a0 100644 --- a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp +++ b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp @@ -44,11 +44,6 @@ namespace tuscany { namespace cpp { - - // =================== - // Static data members - // =================== - void* CPPServiceWrapper::staticImpl = 0; // =========== // Constructor @@ -80,11 +75,12 @@ namespace tuscany logentry(); if (implementation->getScope() == CPPImplementation::COMPOSITE) { - if (!staticImpl) + // fill the cache if needed + if ( !implementation->getStaticImplementation() ) { - staticImpl = newImplementation(); + implementation->setStaticImplementation(newImplementation()); } - return staticImpl; + return implementation->getStaticImplementation(); } else // (scope == CPPInterface::STATELESS) { diff --git a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h index e8111b6423..899deca07a 100644 --- a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h +++ b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h @@ -120,11 +120,6 @@ namespace tuscany private: /** - * Holds an implementation instance if the scope is set to composite. - */ - static void* staticImpl; - - /** * The component to which this wrapper refers. */ tuscany::sca::model::Component* component; diff --git a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp index 9e5a227f01..56098ced93 100644 --- a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp +++ b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp @@ -45,7 +45,7 @@ namespace tuscany const string&headerPath, const string& headerStub, const string& className, Scope scope) : ComponentType(composite, headerPath + headerStub), library(library), header(header), headerPath(headerPath), - headerStub(headerStub), className(className), scope(scope) + headerStub(headerStub), className(className), scope(scope), staticImpl(0) { } @@ -80,6 +80,11 @@ namespace tuscany } } + void CPPImplementation::setStaticImplementation(void* staticImpl) + { + this->staticImpl = staticImpl; + } + } // End namespace cpp } // End namespace sca } // End namespace tuscany diff --git a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h index 11f487361d..2dfdac616e 100644 --- a/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h +++ b/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h @@ -107,6 +107,16 @@ namespace tuscany */ Scope getScope() { return scope; } + /** + * Returns the implementation instance (to be used if the scope is set to composite) + */ + void* getStaticImplementation() { return staticImpl; } + + /** + * Sets the implementation instance (to be used if the scope is set to composite) + */ + void setStaticImplementation(void* staticImpl); + private: /** @@ -139,6 +149,11 @@ namespace tuscany * Scope of the implementation */ Scope scope; + + /** + * Holds the implementation instance if the scope is set to composite. + */ + void* staticImpl; }; } // End namespace cpp |