Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / apps / drwho / Binary_Search.h
blob07c1631444ed7cf50730c1b157ddde316d1b4213
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Binary_Search.h
7 * Defines a binary search abstraction for friend records.
9 * @author Douglas C. Schmidt
11 //=============================================================================
14 #ifndef _BINARY_SEARCH_H
15 #define _BINARY_SEARCH_H
17 #include "Search_Struct.h"
19 /**
20 * @class Binary_Search
22 * @brief Defines a binary search abstraction for friend records.
24 class Binary_Search : public Search_Struct
26 public:
27 /// Initialize the values for the iterators...
28 Binary_Search ();
30 /// Destructor.
31 virtual ~Binary_Search ();
33 /**
34 * Returns the next friend in the sequence of sorted friends. Note
35 * that this function would be simplified if we expanded the
36 * iterator interface to include an "initialize" and "next"
37 * function!
39 virtual Protocol_Record *get_next_entry ();
41 /**
42 * An iterator, similar to Binary_Search::get_next_friend, though in
43 * this case the friend records are returned in the order they
44 * appeared in the friend file, rather than in sorted order. Also,
45 * we skip over entries that don't have any hosts associated with
46 * them.
48 virtual Protocol_Record *get_each_entry ();
50 /**
51 * This function is used to merge the <key_name> from server
52 * <host_name> into the sorted list of userids kept on the client's
53 * side.
55 virtual Protocol_Record *insert (const char *key_name,
56 int max_len = MAXUSERIDNAMELEN) = 0;
58 /// This function is passed to qsort to perform the comparison
59 /// between login names for two friends.
60 static int name_compare (const void *, const void *);
62 protected:
63 Protocol_Record **current_ptr_;
64 int current_index_;
66 Protocol_Record *protocol_record_;
67 Protocol_Record **sorted_record_;
69 const char *buffer_;
70 int buffer_size_;
73 #endif /* _BINARY_SEARCH_H */