Merge pull request #2317 from jwillemsen/jwi-deleteop
[ACE_TAO.git] / ACE / apps / JAWS / clients / Caching / Local_Locator.h
blob72dc4839751cbe7022973816748924daaa91c828
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Local_Locator.h
7 * @author Nanbor Wang
8 */
9 //=============================================================================
12 #ifndef ACE_LOCAL_LOCATOR_H
13 #define ACE_LOCAL_LOCATOR_H
15 #include "URL_Locator.h"
16 #include "ace/Containers.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ID_Generator.h"
24 /**
25 * @class ACE_URL_Record
27 * @brief A URL Record.
29 * A record placed in URL repository. Notice that
30 * both member pointers are own by URL_Record.
31 * They will get deallocated when the object goes
32 * out of scope.
34 class ACE_Svc_Export ACE_URL_Record
36 /**
37 * We are making ACE_Node as friend class because we don't want
38 * others to access default constructor and pushing in an invalid
39 * record. However, container classes need to use default constructor
40 * for its head record.
42 friend class ACE_URL_Local_Locator;
43 friend class ACE_Node<ACE_URL_Record>;
44 public:
45 /// ctor.
46 ACE_URL_Record (ACE_URL_Offer *offer);
48 /// dtor.
49 ~ACE_URL_Record ();
51 /// Two records are equal if they have the same offer id.
52 bool operator== (const ACE_URL_Record &rhs) const;
54 /// Unequal, complement of equal.
55 bool operator!= (const ACE_URL_Record &rhs) const;
58 private:
59 /// Default ctor. This is put here to prevent users from
60 /// pushing in an invalid record.
61 ACE_URL_Record ();
63 /// Offer ID in the repository.
64 ACE_WString *id_;
66 /// Offer (and its properties).
67 ACE_URL_Offer *offer_;
70 /**
71 * @class ACE_URL_Local_Locator
73 * @brief A simple URL repository to store URL offer locally.
75 * This class manage a collection of URL offers
76 * for local query and registration. But we should
77 * really use it within a server.
79 class ACE_Svc_Export ACE_URL_Local_Locator
81 /// Default destructor.
82 virtual ~ACE_URL_Local_Locator ();
84 /**
85 * Query the locator for HTTP with designate properties (none, some,
86 * or all). The locator being queried will return a sequence of
87 * offers with <how_many> offers in it. This interface allocates
88 * <offer> so users must deallocate it after use.
90 virtual int url_query (const ACE_URL_Locator::ACE_Selection_Criteria how,
91 const ACE_URL_Property_Seq *pseq,
92 const size_t how_many,
93 size_t &num_query,
94 ACE_URL_Offer_Seq *offer);
96 /// Export an offer to the locator.
97 virtual int export_offer (ACE_URL_Offer *offer,
98 ACE_WString &offer_id);
100 /// Withdraw an offer. return 0 if succeed, -1 otherwise.
101 virtual int withdraw_offer (const ACE_WString &offer_id);
103 /// Query a specific offer.
104 virtual int describe_offer (const ACE_WString &offer_id,
105 ACE_URL_Offer *offer);
107 /// Modify a previously registered offer.
108 virtual int modify_offer (const ACE_WString &offer_id,
109 const ACE_WString *url = 0,
110 const ACE_URL_Property_Seq *del = 0,
111 const ACE_URL_Property_Seq *modify = 0);
113 protected:
114 ACE_Unbounded_Set<ACE_URL_Record> repository_;
117 #if defined (__ACE_INLINE__)
118 #include "Local_Locator.inl"
119 #endif /* __ACE_INLINE__ */
121 #endif /* ACE_LOCAL_LOCATOR_H */