Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
widwork.h
Go to the documentation of this file.
1
27#ifndef WIDWORK_H_INCLUDED
28#define WIDWORK_H_INCLUDED
29
30#include <list>
31#include <functional>
32#include <iostream>
33
34class Widget {
35public:
36 Widget (int a = 0) : id (a)
37 { }
38
39 void operator= (const Widget& rhs) {
40 id = rhs.id;
41 }
42
43 friend std::ostream& operator<< ( std::ostream&, const Widget& );
44 int id;
45};
46
47typedef std::list<Widget, std::allocator<Widget> > widgetList;
48typedef std::list<int, std::allocator<int> > idList;
49
50struct WidgetTester : std::binary_function<Widget, int, bool>
51{
52public:
53 bool operator () (const Widget & wid, int testid) const;
54};
55
57{
58public:
59 void order (int wid); // Process order for widget type wid.
60 void receive (int wid); // Receive widget of type wid in shipment.
61
62private:
63 widgetList on_hand;
64 idList on_order;
65};
66
67
68#endif // WIDWORK_H_INCLUDED
#define rhs
Definition 17.names.cpp:536
#define a
Definition 17.names.cpp:109
int id
Definition widwork.h:44
friend std::ostream & operator<<(std::ostream &, const Widget &)
Definition widwork.cpp:33
Widget(int a=0)
Definition widwork.h:36
void operator=(const Widget &rhs)
Definition widwork.h:39
void receive(int wid)
Definition widwork.cpp:72
void order(int wid)
Definition widwork.cpp:54
bool operator()(const Widget &wid, int testid) const
Definition widwork.cpp:48
std::list< Widget, std::allocator< Widget > > widgetList
Definition widwork.h:47
std::list< int, std::allocator< int > > idList
Definition widwork.h:48