sockets documentation and cleanup
[chaz/yoink] / src / Moof / Service.hh
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
9 *
10 **************************************************************************/
11
12 #ifndef _MOOF_SERVICE_HH_
13 #define _MOOF_SERVICE_HH_
14
15 #include <vector>
16
17 #include <Moof/Math.hh>
18 #include <Moof/Socket.hh>
19
20
21 namespace Mf {
22
23
24 /**
25 * Class representing a network service.
26 */
27 class Service
28 {
29 public:
30
31 /**
32 * Construct a network service.
33 * \param address The address of the host.
34 * \param text The service information.
35 */
36 Service(const SocketAddress& address, const std::string& text);
37
38
39 /**
40 * Get the host address.
41 * \return The address.
42 */
43 const SocketAddress& address() const;
44
45 /**
46 * Get the service information.
47 * \return The service information as a string.
48 */
49 const std::string& text() const;
50
51
52 /**
53 * Publish the service on the network.
54 */
55 void publish();
56
57 void update(Scalar t, Scalar dt);
58
59
60 private:
61
62 SocketAddress mAddress;
63 std::string mText;
64 };
65
66
67 class ServiceFinder
68 {
69 public:
70
71 ServiceFinder(const std::string& service, int type = SOCK_STREAM);
72
73 void update(Scalar t, Scalar dt);
74
75
76 const std::vector<Service>& services() const
77 {
78 return mServices;
79 }
80
81
82 private:
83
84 std::vector<Service> mServices;
85 };
86
87
88 } // namespace Mf
89
90 #endif // _MOOF_SERVICE_HH_
91
This page took 0.03172 seconds and 4 git commands to generate.