diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2007-03-26 20:45:38 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2007-03-26 20:45:38 +0000 |
commit | d61f3b25976a56df8a86b65884d1602854973733 (patch) | |
tree | 4399312d331a44142749df505f432a67feb38a92 /TAO/examples/Persistent_Grid | |
parent | 4bd8580859df8c9d154563d5a32cc3607952b745 (diff) | |
download | ATCD-d61f3b25976a56df8a86b65884d1602854973733.tar.gz |
ChangeLogTag:Mon Mar 26 20:44:40 UTC 2007 William R. Otte <wotte@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/examples/Persistent_Grid')
-rw-r--r-- | TAO/examples/Persistent_Grid/Grid_i.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/TAO/examples/Persistent_Grid/Grid_i.cpp b/TAO/examples/Persistent_Grid/Grid_i.cpp index 99caf3105fc..2a59227186b 100644 --- a/TAO/examples/Persistent_Grid/Grid_i.cpp +++ b/TAO/examples/Persistent_Grid/Grid_i.cpp @@ -19,18 +19,26 @@ Grid_i::Grid_i (CORBA::Short x, CORBA::Short y, pool_t *mem_pool) : width_ (x), - height_ (y) + height_ (y), + array_ (0) { // First try to locate the matrix in the pool. If it is there then // it has already been created. In such a case we just get that // memory and assign it to array_ - if (mem_pool->find ("Array", (void *&) array_) == -1) + + void *tmp_array (0); + + if (mem_pool->find ("Array", tmp_array) != -1) + { + array_ = reinterpret_cast <CORBA::Long **> (tmp_array); + } + else { // Allocate memory for the matrix. - ACE_ALLOCATOR (array_, - static_cast<CORBA::Long **> (mem_pool->malloc (y * sizeof (CORBA::Long *)))); + ACE_ALLOCATOR (array_, + static_cast<CORBA::Long **> (mem_pool->malloc (y * sizeof (CORBA::Long *)))); //array_ = (CORBA::Long **) mem_pool->malloc (y * sizeof (CORBA::Long *)); - + if (array_ != 0) { for (int ctr = 0; ctr < y; ctr++) @@ -46,6 +54,7 @@ Grid_i::Grid_i (CORBA::Short x, mem_pool->bind ("Array", array_); } } + } // Default destructor. |