1/**
2* @file sample_update_policy.hpp
3* Contains a sample policy for list update containers.
4*
5* Copyright Ami Tavory, IBM-HRL, 2004.
6*
7* Permission to use, copy, modify, sell, and distribute this software
8*	is hereby granted without fee, provided that the above copyright notice
9*	appears in all copies, and that both that copyright notice and this
10*	permission notice appear in supporting documentation.
11*
12* None of the above authors, nor IBM Haifa Research Laboratories, make any
13*	representation about the suitability of this software for any
14*	purpose. It is provided "as is" without express or implied warranty.
15**/
16
17
18#ifndef SAMPLE_UPDATE_POLICY_HPP
19#define SAMPLE_UPDATE_POLICY_HPP
20
21
22/**
23* <class
24*	description = "A sample list-update policy."
25*  comment = "This class serves to show the interface a list update functor
26*	needs to support.">
27**/
28class sample_update_policy
29{
30/**
31*******************************************************************************
32*******************************************************************************
33* <public_methods_group>
34**/
35public:
36	/**
37	***************************************************************************
38	***************************************************************************
39	** <group description = "Constructors, destructor, and related.">
40	**/
41
42	/*
43	* <fn description = "Default constructor."
44	*	comment = "Must be default constructible.">
45	**/
46		sample_update_policy
47		();
48	/** </fn> **/
49
50	/*
51	* <fn description = "Copy constructor."
52	*	comment = "Must be copy constructible.">
53	**/
54		sample_update_policy
55		(const sample_update_policy &r_other);
56	/** </fn> **/
57
58	/*
59	* <fn description = "Swaps content."
60	*	comment = "Must be swappable (if there is such a word).">
61	**/
62	inline void
63		swap
64		(sample_update_policy &r_other);
65	/** </fn> **/
66
67	/*
68	***************************************************************************
69	***************************************************************************
70	* </group>
71	**/
72
73/**
74*******************************************************************************
75*******************************************************************************
76* </public_methods_group>
77**/
78
79
80/**
81*******************************************************************************
82*******************************************************************************
83* <protected_types_group>
84**/
85protected:
86
87	/**
88	***************************************************************************
89	***************************************************************************
90	** <group description = "Metadata definitions.">
91	**/
92
93	/**
94	* <tdef description = "Metadata on which this functor operates."
95	*	comment = "The class must declare the metadata type on which it
96	*		operates; the list-update based containers will append to
97	*		each node an object of this type.">
98	**/
99	typedef
100		some_metadata_type
101		metadata_type;
102	/** </tdef> **/
103
104
105	/*
106	***************************************************************************
107	***************************************************************************
108	* </group>
109	**/
110
111/**
112*******************************************************************************
113*******************************************************************************
114* </protected_types_group>
115**/
116
117
118/**
119*******************************************************************************
120*******************************************************************************
121* <protected_methods_group>
122**/
123protected:
124	/**
125	***************************************************************************
126	***************************************************************************
127	** <group description = "Metadata operations.">
128	**/
129
130	/*
131	* <fn description = "Creates a metadata object."
132	*	comment = "A list-update based container object  will call this
133	*		method to create a metadata type when a node is created.">
134	**/
135	metadata_type
136		operator()
137		() const;
138	/** </fn> **/
139
140	/*
141	* <fn description = "Decides whether a metadata object should be
142	*	moved to the front of the list. A list-update based containers object
143	*	will call this
144	*	method to decide whether to move a node to the front of
145	*	the list. The method shoule return true if the node should
146	*	be moved to the front of the list."
147	*	comment = "@@sample_update_policy_metadata_reference">
148	**/
149	bool
150		operator()
151		(metadata_reference r_data) const;
152	/** </fn> **/
153
154	/*
155	***************************************************************************
156	***************************************************************************
157	* </group>
158	**/
159
160/**
161*******************************************************************************
162*******************************************************************************
163* </protected_methods_group>
164**/
165};
166/**
167* </class>
168**/
169
170
171#endif // #ifndef SAMPLE_UPDATE_POLICY_HPP
172