diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Notify_ID_Pool_T.h')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Notify_ID_Pool_T.h | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_ID_Pool_T.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_ID_Pool_T.h index 658ed8045fc..cc0c56e4a34 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_ID_Pool_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_ID_Pool_T.h @@ -50,16 +50,38 @@ public: ID_TYPE get (void); // Returns the current id. - void put (ID_TYPE id); - // Return the id back. + protected: - void next (void); - // The current id is moved to the active_list_. + ID_TYPE max_id_; + // This is the last id circulating in the list.When there are no more id's + // in the resuse list, we increment this value to get a new id. - protected: - ID_TYPE id_; - // The next available id. + // @@ Pradeep: do you really need to do this? I mean, with a long + // or so you have 4 billion different IDs, recycling them is the + // least of your problems, right? + + // @@ Carlos: absolutely. I did not realize this. + // The recycling logic can be done away with! + + // Even if you need to recycle them, do you *really* need to keep + // *both* the active and free collections around? Isn't it enough + // to know which one is the maximum generated and the list of free + // ones? Anything else is active, right? + // Or if you know the active ones and the maximum given you know + // that anything else is free, right? + + // Carlos: right. with one list amd the max, the elements of the other list could be determined. + + // Also: in most cases the IDs will index some sort of map, right? + // You could obtain the active list from the set of keys in the map. + + // @@ Carlos: no, the <active_list_> list is the only list of id's. + // well, actually because i convert these ID's to ObjectID's and put them in POA's, + // i could get the list from the POA but there is no iterator in POA to get objectid's, + // + // I guess it is a classical tradeoff between CPU and memory, but I + // would tend to conserve memory in this case... ACE_Unbounded_Set <ID_TYPE> active_list_; // List of ids currently in use by clients of this class. }; |