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,
38  const char * id,
39  const unsigned char * hash,
40  unsigned int serial,
41  bool has_writer,
42  unsigned int num_readers,
43  const std::list<std::string> &readers,
44  const std::string & writer,
45  const Time * timestamp);
46  InterfaceInfo(const InterfaceInfo &i);
48 
49  const char * type() const;
50  const char * id() const;
51  const unsigned char * hash() const;
52  std::string hash_printable() const;
53  bool has_writer() const;
54  unsigned int num_readers() const;
55  const std::list<std::string> &readers() const;
56  const std::string & writer() const;
57  unsigned int serial() const;
58  const Time * timestamp() const;
59 
61  bool operator<(const InterfaceInfo &ii) const;
62 
63 private:
64  char * type_;
65  char * id_;
66  unsigned char * hash_;
67  bool has_writer_;
68  unsigned int num_readers_;
69  unsigned int serial_;
70  Time * timestamp_;
71  std::list<std::string> readers_;
72  std::string writer_;
73 };
74 
75 class InterfaceInfoList : public std::list<InterfaceInfo>
76 {
77 public:
78  void append(const char * type,
79  const char * id,
80  const unsigned char * hash,
81  unsigned int serial,
82  bool has_writer,
83  unsigned int num_readers,
84  const std::list<std::string> &readers,
85  const std::string & writer,
86  const Time & timestamp);
87 };
88 
89 } // end namespace fawkes
90 
91 #endif
fawkes::InterfaceInfo::has_writer
bool has_writer() const
Check if there is a writer.
Definition: interface_info.cpp:171
fawkes::InterfaceInfo::~InterfaceInfo
~InterfaceInfo()
Destructor.
Definition: interface_info.cpp:92
fawkes::InterfaceInfo::operator<
bool operator<(const InterfaceInfo &ii) const
< operator This compares two interface infos with respect to the less than (<) relation considering t...
Definition: interface_info.cpp:230
fawkes::InterfaceInfo::serial
unsigned int serial() const
Get interface instance serial.
Definition: interface_info.cpp:207
fawkes::InterfaceInfo::readers
const std::list< std::string > & readers() const
Get readers of interface.
Definition: interface_info.cpp:189
fawkes::InterfaceInfo::hash_printable
std::string hash_printable() const
Get interface version hash in printable format.
Definition: interface_info.cpp:157
fawkes::InterfaceInfo::writer
const std::string & writer() const
Get name of writer on interface.
Definition: interface_info.cpp:198
fawkes::InterfaceInfo::hash
const unsigned char * hash() const
Get interface version hash.
Definition: interface_info.cpp:148
fawkes::InterfaceInfoList::append
void append(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)
Append an interface info.
Definition: interface_info.cpp:260
fawkes::InterfaceInfo::id
const char * id() const
Get interface ID.
Definition: interface_info.cpp:139
fawkes::InterfaceInfo::num_readers
unsigned int num_readers() const
Get number of readers.
Definition: interface_info.cpp:180
fawkes::InterfaceInfo::InterfaceInfo
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.
Definition: interface_info.cpp:52
fawkes::InterfaceInfo::operator=
InterfaceInfo & operator=(const InterfaceInfo &i)
Assignment operator.
Definition: interface_info.cpp:105
fawkes
Fawkes library namespace.
fawkes::InterfaceInfoList
Interface information list.
Definition: interface_info.h:76
fawkes::Time
A class for handling time.
Definition: time.h:93
fawkes::InterfaceInfo::timestamp
const Time * timestamp() const
Get interface timestamp.
Definition: interface_info.cpp:216
fawkes::InterfaceInfo::type
const char * type() const
Get interface type.
Definition: interface_info.cpp:130
fawkes::InterfaceInfo
Interface info.
Definition: interface_info.h:35