Fawkes API  Fawkes Development Version
bb_list.cpp
1 
2 /***************************************************************************
3  * bb_list.cpp - list Fawkes BlackBoard shared memory segments
4  *
5  * Generated: Thu Oct 19 14:56:13 2006 (Anne's 25th Birthday)
6  * Copyright 2005-2006 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.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include <utils/ipc/shm.h>
24 #include <config/sqlite.h>
25 #include <blackboard/shmem/header.h>
26 #include <blackboard/shmem/lister.h>
27 #include <blackboard/blackboard.h>
28 #include <blackboard/bbconfig.h>
29 #include <iostream>
30 
31 using namespace std;
32 using namespace fawkes;
33 
34 int
35 main(int argc, char **argv)
36 {
37  SQLiteConfiguration config(CONFDIR);
38  config.load();
39 
40  std::string token = "";
41  try {
42  token = config.get_string("/fawkes/mainapp/blackboard_magic_token");
43  } catch (Exception &e) {
44  cout << "Could not read shared memory token for blackboard." << endl;
45  cout << "BlackBoard is probably running without shared memory." << endl;
46  return -1;
47  }
48 
49  BlackBoardSharedMemoryHeader *bbsh = new BlackBoardSharedMemoryHeader(BLACKBOARD_VERSION);
51  SharedMemory::list(token.c_str(), bbsh, bblister);
52  delete bblister;
53  delete bbsh;
54  return 0;
55 }
virtual void load(const char *file_path)=0
Load configuration.
Configuration storage using SQLite.
Definition: sqlite.h:39
Fawkes library namespace.
STL namespace.
BlackBoard shared memory lister.
Definition: lister.h:33
Base class for exceptions in Fawkes.
Definition: exception.h:36
BlackBoard Shared Memory Header.
Definition: header.h:34
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.