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 <blackboard/bbconfig.h>
24#include <blackboard/blackboard.h>
25#include <blackboard/shmem/header.h>
26#include <blackboard/shmem/lister.h>
27#include <config/sqlite.h>
28#include <utils/ipc/shm.h>
29
30#include <iostream>
31
32using namespace std;
33using namespace fawkes;
34
35int
36main(int argc, char **argv)
37{
38 SQLiteConfiguration config(CONFDIR);
39 config.load();
40
41 std::string token = "";
42 try {
43 token = config.get_string("/fawkes/mainapp/blackboard_magic_token");
44 } catch (Exception &e) {
45 cout << "Could not read shared memory token for blackboard." << endl;
46 cout << "BlackBoard is probably running without shared memory." << endl;
47 return -1;
48 }
49
50 BlackBoardSharedMemoryHeader *bbsh = new BlackBoardSharedMemoryHeader(BLACKBOARD_VERSION);
52 SharedMemory::list(token.c_str(), bbsh, bblister);
53 delete bblister;
54 delete bbsh;
55 return 0;
56}
BlackBoard Shared Memory Header.
Definition: header.h:35
BlackBoard shared memory lister.
Definition: lister.h:34
virtual void load(const char *file_path)=0
Load configuration.
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.
Base class for exceptions in Fawkes.
Definition: exception.h:36
Configuration storage using SQLite.
Definition: sqlite.h:41
Fawkes library namespace.