diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-07-09 17:34:21 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-07-09 17:34:21 +0000 |
commit | 8ce273869c3b8631403579c81aa8ca02a4524cd0 (patch) | |
tree | 7f5601a9811ec1bdbf2b1bf0dff9b28f4ed2da42 /TAO | |
parent | 0d3881ea203d7433bb1cccdcf1045bb8dc3dda3b (diff) | |
download | ATCD-8ce273869c3b8631403579c81aa8ca02a4524cd0.tar.gz |
.
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/examples/Persistent_Grid/Grid_i.cpp | 29 | ||||
-rw-r--r-- | TAO/examples/Persistent_Grid/Persistent_Client_i.cpp | 2 | ||||
-rw-r--r-- | TAO/examples/Persistent_Grid/README | 21 | ||||
-rw-r--r-- | TAO/examples/Persistent_Grid/client.cpp | 1 | ||||
-rw-r--r-- | TAO/examples/Persistent_Grid/persistent_client.cpp | 3 | ||||
-rw-r--r-- | TAO/examples/README | 5 |
6 files changed, 29 insertions, 32 deletions
diff --git a/TAO/examples/Persistent_Grid/Grid_i.cpp b/TAO/examples/Persistent_Grid/Grid_i.cpp index aeeedc25fe1..9599a421a25 100644 --- a/TAO/examples/Persistent_Grid/Grid_i.cpp +++ b/TAO/examples/Persistent_Grid/Grid_i.cpp @@ -25,24 +25,22 @@ Grid_i::Grid_i (CORBA::Short x, // 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) + if (mem_pool->find ("Array", (void *&) array_) == -1) { // Allocate memory for the matrix. - array_ = (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++) { - array_[ctr] = (CORBA::Long *)mem_pool->malloc(x * - sizeof(CORBA::Long)); + array_[ctr] = (CORBA::Long *)mem_pool->malloc (x * + sizeof (CORBA::Long)); if (array_[ctr] == 0) - { - ACE_THROW (CORBA::NO_MEMORY ()); - } + ACE_THROW (CORBA::NO_MEMORY ()); } - mem_pool->bind("Array",array_); + mem_pool->bind ("Array", array_); } else ACE_THROW (CORBA::NO_MEMORY ()); @@ -130,7 +128,7 @@ Grid_i::destroy (CORBA::Environment &) delete [] array_; ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %s\n", + " (%P|%t) %s\n", "Grid has been destroyed")); } @@ -171,9 +169,8 @@ Grid_Factory_i::make_grid (CORBA::Short width, Grid_i *grid_ptr = 0; ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Making a new Grid\n")); + " (%P|%t) Making a new Grid\n")); - // Set a default value for width. if (width <= 0) width = Grid_Factory::DEFAULT_WIDTH; @@ -212,7 +209,7 @@ void Grid_Factory_i::shutdown (CORBA::Environment &) { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %s\n", + " (%P|%t) %s\n", "Grid Factory is shutting down")); // Instruct the ORB to shutdown. @@ -223,12 +220,10 @@ void Grid_Factory_i::cleanup (CORBA::Environment &) { const char *name = "Array"; + if (this->pool_t_->unbind (name) == -1) - { - ACE_DEBUG ((LM_DEBUG, - "\n Failed to unbind ")); - } - + ACE_DEBUG ((LM_DEBUG, + "\n Failed to unbind ")); } void diff --git a/TAO/examples/Persistent_Grid/Persistent_Client_i.cpp b/TAO/examples/Persistent_Grid/Persistent_Client_i.cpp index 988a4b8b6a1..1711dd5ccee 100644 --- a/TAO/examples/Persistent_Grid/Persistent_Client_i.cpp +++ b/TAO/examples/Persistent_Grid/Persistent_Client_i.cpp @@ -72,7 +72,7 @@ Persistent_Client_i::run (const char *name, "(%P|%t) Made the grid succesfully\n")); - for ( CORBA::Short index_ = 0; index_ < height_; index_++) + for (CORBA::Short index_ = 0; index_ < height_; index_++) { for (CORBA::Short ctr = 0; ctr < width_; ctr++) { diff --git a/TAO/examples/Persistent_Grid/README b/TAO/examples/Persistent_Grid/README index aa55eed144b..ea5b1771acf 100644 --- a/TAO/examples/Persistent_Grid/README +++ b/TAO/examples/Persistent_Grid/README @@ -1,16 +1,15 @@ $Id$ -This is a simple example based that shows how to use the persistent -memory. The example is a derivative with a slight variation of the -Grid example in $TAO_ROOT/Simple/grid. - -The server hosts the Grid servant. A client comes along and sets -some values in the grid. These values are written out by the server in -to a Memory map file. The servant is then brought down. A new server -is started again which reads from the same meory map file. A new -client by name persistent_grid is started which reads the value from -the locations, where the client stored the values. The values are -printed for clarity purposes. +This example shows how to store the state of CORBA servants in +persistent memory. The example is a variation of the Grid example in +$TAO_ROOT/examples/Simple/grid. + +The server hosts the Grid servant. A client sets some values in the +grid. These values are written out by the server in to a +memory-mapped file, at which point the server shuts down. A new +server is then started, which reads from the same memory-mapped file. +Another client (named persistent_client) then reads and prints the +values from the locations where the original client stored the values. server: ------- diff --git a/TAO/examples/Persistent_Grid/client.cpp b/TAO/examples/Persistent_Grid/client.cpp index cec9630aa93..c67b7b80261 100644 --- a/TAO/examples/Persistent_Grid/client.cpp +++ b/TAO/examples/Persistent_Grid/client.cpp @@ -8,7 +8,6 @@ int main (int argc, char *argv[]) { Grid_Client_i client; - ACE_DEBUG ((LM_DEBUG, "\nGrid client\n\n")); diff --git a/TAO/examples/Persistent_Grid/persistent_client.cpp b/TAO/examples/Persistent_Grid/persistent_client.cpp index a51baf829dc..3bd9a3137e6 100644 --- a/TAO/examples/Persistent_Grid/persistent_client.cpp +++ b/TAO/examples/Persistent_Grid/persistent_client.cpp @@ -2,7 +2,7 @@ # include "Persistent_Client.h" -// The client program for the application. +// The "persistent client" program for the application. int main (int argc, char *argv[]) @@ -17,7 +17,6 @@ main (int argc, char *argv[]) return -1; else return 0; - } diff --git a/TAO/examples/README b/TAO/examples/README index 8142a4cb25d..f62da7d2f59 100644 --- a/TAO/examples/README +++ b/TAO/examples/README @@ -22,6 +22,11 @@ examples: This example implements a simple logging service using TAO. + . Persistent_Grid + + This example shows how to store the state of CORBA servants in + persistent memory. + . POA Contains various small examples of POA features based on |