File: hash.yo

package info (click to toggle)
bobcat 1.18.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,920 kB
  • ctags: 575
  • sloc: makefile: 12,973; cpp: 6,284; perl: 401; ansic: 68; sh: 52
file content (129 lines) | stat: -rw-r--r-- 4,750 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
includefile(header.inc)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::Hash)(3bobcat)(_CurYrs_)(libbobcat1-dev__CurVers_-x.tar.gz)
                    (Key hashing containers)

manpagename(FBB::Hash)(Various mapping template classes using hashing)

manpagesynopsis()
    bf(#include <bobcat/hash>)nl()

manpagedescription()
    The bf(FBB:Hash) group of template classes offer hashing-based
mapping. Various variants are availabe, all based on the facilities offered by
the GNU bf(g++)(1) bf(ext/hash_map) header file. Hashing containers are not
(yet) part of the ANSI-ISO bf(C++) standard, and an extension to the standard
is offered by GNU's bf(g++)(1) compiler. GNU's hash map is defined in the
bf(__gnu_cxx) namespace, indicating that this container is not one that is
offered in the bf(C++) standard. 

    Unfortunately, the hash-map offered in the bf(ext/hash_map) header file
has a fairly complex interface, and bf(FBB::Hash) is an attempt to simplify
this interface. In practice, hashing uses a textual key, which may be 
bf(std::string) or tt(char *) based, and the keys may be used either case
sensitively or case insensitively. bf(FBB::Hash) simplifies the use of the
hash map offered in bf(ext/hash_map) by requiring its users to specify only
the map's value type. 

includefile(namespace.inc)

manpagesection(INHERITS FROM)
    bf(__gnu_cxx::hash_map), using various instantiations.

manpagesection(CONSTRUCTORS)
    Using em(case sensitive) bf(char const *) keys:
    itemization(
    itb(HashCharPtr<Value>())
        The default constructor creates an empty hash-map container, in which
the keys are tt(char const *)s. The map contains value of template type
tt(Value). 
    itb(HashCharPtr<Value>(InputIterator begin, InputIterator end))
        This constructor creates a hash-map container, using elements pointed
to by a pair of iterators in the hash-map. The iterators must point to 
tt(std::pair<char const *, Value>) objects.
    )

    Using em(case insensitive) bf(char const *) keys:
    itemization(
    itb(HashCharCasePtr<Value>())
        The default constructor creates an empty hash-map container, in which
the keys are tt(char const *)s. The map contains value of template type
tt(Value). 
    itb(HashCharCasePtr<Value>(InputIterator begin, InputIterator end))
        This constructor creates a hash-map container, using elements pointed
to by a pair of iterators in the hash-map. The iterators must point to 
tt(std::pair<char const *, Value>) objects.
    )

    Using em(case sensitive) bf(std::string) keys:
    itemization(
    itb(HashString<Value>())
        The default constructor creates an empty hash-map container, in which
the keys are tt(std::string)s. The map contains value of template type
tt(Value). 
    itb(HashString<Value>(InputIterator begin, InputIterator end))
        This constructor creates a hash-map container, using elements pointed
to by a pair of iterators in the hash-map. The iterators must point to 
tt(std::pair<std::string, Value>) objects.
    )

    Using em(case insensitive) bf(std::string) keys:
    itemization(
    itb(HashStringCase<Value>())
        The default constructor creates an empty hash-map container, in which
the keys are tt(std::string)s. The map contains value of template type
tt(Value). 
    itb(HashStringCase<Value>(InputIterator begin, InputIterator end))
        This constructor creates a hash-map container, using elements pointed
to by a pair of iterators in the hash-map. The iterators must point to 
tt(std::pair<std::string, Value>) objects.
    )
    The copy constructor is available for all bf(FBB:Hash...) hash-map 
containers.

manpagesection(OVERLOADED OPERATOR)
     The overloaded assignment operator is available for all bf(FBB:Hash)
hash-map containers.

manpagesection(MEMBER FUNCTIONS)
     All members of bf(__gnu_cxx::hash_map) are available, as bf(FBB::Hash)
inherits from this template class. These members are (expected to be) the same
members as available for the bf(std::map) container.

manpagesection(EXAMPLE)
        verb(
    #include <iostream>
    #include <bobcat/hash>
    
    using namespace std;
    using namespace FBB;
    
    pair<char const *, size_t> ap[] =
    {
        pair<char const *, size_t>("one", 1),
        pair<char const *, size_t>("two", 2),
    };
    
    int main()
    {
        HashCharPtr<size_t> hcp;
        HashCharPtr<size_t> hcp2(ap, ap + 2);
        HashCharPtr<size_t> hcp3(hcp2);

        hcp = hcp2;
    
        cout << hcp2["one"] << endl;
    }
        )

manpagefiles()
    em(bobcat/hash) - defines the class interface

manpageseealso()
    bf(bobcat)(7), bf(g++)(1), bf(ext/hash_map)

manpagebugs()
    None Reported.

includefile(trailer.inc)