You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/08/02 17:19:12 UTC
svn commit: r1368525 - in /incubator/etch/trunk/binding-cpp/runtime:
include/support/EtchTransportHelper.h
src/main/support/EtchTransportHelper.cpp
Author: veithm
Date: Thu Aug 2 15:19:12 2012
New Revision: 1368525
URL: http://svn.apache.org/viewvc?rev=1368525&view=rev
Log:
ETCH-197 Added destroyRessources method to TransportHelper
Change-Id: I78bccba944d316bb76aeaa4b672ccd2e13af65d3
Modified:
incubator/etch/trunk/binding-cpp/runtime/include/support/EtchTransportHelper.h
incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchTransportHelper.cpp
Modified: incubator/etch/trunk/binding-cpp/runtime/include/support/EtchTransportHelper.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/support/EtchTransportHelper.h?rev=1368525&r1=1368524&r2=1368525&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/support/EtchTransportHelper.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/support/EtchTransportHelper.h Thu Aug 2 15:19:12 2012
@@ -62,7 +62,12 @@ public:
* items.
* @return an error if there is a problem
*/
- static status_t initResources(EtchResources* resources, EtchResources** result);
+ static status_t initResources( EtchResources* resources, EtchResources*& result );
+
+ /**
+ * Dealloc resources
+ */
+ static status_t destroyResources(EtchResources* resources);
};
#endif /* __ETCHTRANSPORTHELPER_H__ */
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchTransportHelper.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchTransportHelper.cpp?rev=1368525&r1=1368524&r2=1368525&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchTransportHelper.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchTransportHelper.cpp Thu Aug 2 15:19:12 2012
@@ -16,9 +16,9 @@
* limitations under the License.
*/
-#include "support/EtchTransportHelper.h"
#include "support/EtchFreePool.h"
#include "support/EtchQueuedPool.h"
+#include "support/EtchTransportHelper.h"
EtchString EtchTransportHelper::QUEUED_POOL("QUEUED_POOL");
@@ -28,10 +28,7 @@ EtchString EtchTransportHelper::BINARY("
EtchString EtchTransportHelper::XML("xml");
-status_t EtchTransportHelper::initResources(EtchResources* resources, EtchResources** result) {
- if(result == NULL) {
- return ETCH_EINVAL;
- }
+status_t EtchTransportHelper::initResources(EtchResources* resources, EtchResources*& result) {
if(resources == NULL) {
resources = new EtchResources();
} else {
@@ -52,6 +49,39 @@ status_t EtchTransportHelper::initResour
// TODO: change interface to give NULL as return value
resources->put( EtchTransportHelper::FREE_POOL, obj, objOld);
}
- *result = resources;
+ result = resources;
return ETCH_OK;
}
+
+status_t EtchTransportHelper::destroyResources(EtchResources* resources) {
+ status_t result;
+ if (resources == NULL) {
+ return ETCH_EINVAL;
+ } else {
+ EtchObject* returnValue = NULL;
+
+ //get queued pool and delete it
+ result = resources->get(EtchTransportHelper::QUEUED_POOL, returnValue);
+ if(result == ETCH_OK && returnValue != NULL) {
+ //TODO: Add queue handling before deleting such as join()
+ delete returnValue;
+ } else {
+ return result;
+ }
+
+ //get free pool and delete it
+ returnValue = NULL;
+ result = resources->get(EtchTransportHelper::FREE_POOL, returnValue);
+ if(result == ETCH_OK && returnValue != NULL) {
+ //TODO: Add queue handling before deleting such as join()
+ delete returnValue;
+ } else {
+ return result;
+ }
+
+ //delete resource
+ delete resources;
+
+ return ETCH_OK;
+ }
+}