Fawkes API  Fawkes Development Version
interface_info.h
1 
2 /***************************************************************************
3  * interface_info.h - BlackBoard Interface Info
4  *
5  * Created: Mon Mar 03 15:43:45 2008 (after topic switch)
6  * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACE_INTERFACE_INFO_H_
25 #define __INTERFACE_INTERFACE_INFO_H_
26 
27 #include <list>
28 #include <string>
29 
30 namespace fawkes {
31 
32 class Time;
33 
35 {
36  public:
37  InterfaceInfo(const char *type, const char *id, const unsigned char *hash,
38  unsigned int serial, bool has_writer, unsigned int num_readers,
39  const std::list<std::string> &readers, const std::string &writer,
40  const Time *timestamp);
41  InterfaceInfo(const InterfaceInfo &i);
43 
44  const char * type() const;
45  const char * id() const;
46  const unsigned char * hash() const;
47  std::string hash_printable() const;
48  bool has_writer() const;
49  unsigned int num_readers() const;
50  const std::list<std::string> & readers() const;
51  const std::string & writer() const;
52  unsigned int serial() const;
53  const Time * timestamp() const;
54 
55  bool operator<(const InterfaceInfo &ii) const;
56 
57  private:
58  char *__type;
59  char *__id;
60  unsigned char *__hash;
61  bool __has_writer;
62  unsigned int __num_readers;
63  unsigned int __serial;
64  Time *__timestamp;
65  std::list<std::string> __readers;
66  std::string __writer;
67 };
68 
69 
70 class InterfaceInfoList : public std::list<InterfaceInfo>
71 {
72  public:
73  void append(const char *type, const char *id, const unsigned char *hash,
74  unsigned int serial, bool has_writer, unsigned int num_readers,
75  const std::list<std::string> &readers, const std::string &writer,
76  const Time &timestamp);
77 };
78 
79 } // end namespace fawkes
80 
81 #endif
const char * type() const
Get interface type.
Fawkes library namespace.
const char * id() const
Get interface ID.
bool operator<(const InterfaceInfo &ii) const
< operator This compares two interface infos with respect to the less than (<) relation considering t...
A class for handling time.
Definition: time.h:91
const unsigned char * hash() const
Get interface version hash.
const Time * timestamp() const
Get interface timestamp.
Interface information list.
InterfaceInfo(const char *type, const char *id, const unsigned char *hash, unsigned int serial, bool has_writer, unsigned int num_readers, const std::list< std::string > &readers, const std::string &writer, const Time *timestamp)
Constructor.
const std::string & writer() const
Get name of writer on interface.
const std::list< std::string > & readers() const
Get readers of interface.
bool has_writer() const
Check if there is a writer.
unsigned int serial() const
Get interface instance serial.
~InterfaceInfo()
Destructor.
unsigned int num_readers() const
Get number of readers.
std::string hash_printable() const
Get interface version hash in printable format.
Interface info.