Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / examples / Persistent_Grid / Grid_i.h
blob31a1dc8dec3071050485bf70c30bd0a36633d13e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Grid_i.h
7 * This class implements the Grid IDL interface.
8 */
9 //=============================================================================
12 #ifndef GRID_I_H
13 #define GRID_I_H
15 #include "GridS.h"
16 #include "ace/Memory_Pool.h"
17 #include "ace/Null_Mutex.h"
18 #include "ace/Malloc_T.h"
20 typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> pool_t;
21 // Memory pool for the persistent stuff
23 //class Grid_Factory_i;
24 /**
25 * @class Grid_Factory_i
27 * Create a <Grid>.
29 class Grid_Factory_i : public POA_Grid_Factory
31 public:
32 /// Constructor.
33 Grid_Factory_i (void);
35 /// Destructor.
36 ~Grid_Factory_i (void);
38 /// This function creates and returns a <Grid>.
39 virtual Grid_ptr make_grid (CORBA::Short,
40 CORBA::Short);
42 /// Shutdown the server.
43 virtual void shutdown (void);
45 /// Do a clean up of the memory map
46 virtual void cleanup ( );
48 /// Set the ORB pointer.
49 void orb (CORBA::ORB_ptr o);
51 /// Set the pool pointer
52 void pool_name (const ACE_TCHAR *name);
54 private:
55 /// ORB pointer.
56 CORBA::ORB_var orb_;
58 /// Name of the pool
59 ACE_TCHAR *pool_name_;
61 /// Hold the pool of name pool_name_
62 pool_t *pool_t_;
64 void operator= (const Grid_Factory_i &);
68 /**
69 * @class Grid_i:
71 * @brief Grid object implementation.
73 * Grid object implementation
75 class Grid_i: public POA_Grid
77 public:
78 /// Constructor
79 Grid_i (void);
81 /// Constructor.
82 Grid_i (CORBA::Short, CORBA::Short, pool_t *);
84 /// Destructor
85 ~Grid_i (void);
87 /// Returns the width of the grid
88 virtual CORBA::Short width (void);
90 /// Returns the height of the grid
91 virtual CORBA::Short height (void);
93 /// Sets the width of the grid.
94 virtual void width (CORBA::Short);
96 /// Sets the height of the grid.
97 virtual void height (CORBA::Short);
99 /// Sets the grid value.
100 virtual void set (CORBA::Short,
101 CORBA::Short,
102 CORBA::Long);
104 /// Gets the grid value.
105 virtual CORBA::Long get (CORBA::Short,
106 CORBA::Short);
108 /// Destroy the grid.
109 virtual void destroy (void);
111 /// Set a pointer to the pool
112 void set_pool (pool_t *);
114 private:
115 /// Width of the grid.
116 CORBA::Short width_;
118 /// Height of the grid.
119 CORBA::Short height_;
121 /// Pointer to the matrix. This is organized as an "array of arrays."
122 CORBA::Long **array_;
124 ///Pointer to the memory pool..
125 pool_t *pool_t_;
129 #endif /* GRID_I_H */