Fawkes API  Fawkes Development Version
bb_cleanup.cpp
1 
2 /***************************************************************************
3  * bb_cleanup.cpp - cleanup unused 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/local.h>
24 #include <config/sqlite.h>
25 #include <iostream>
26 
27 using namespace std;
28 using namespace fawkes;
29 
30 int
31 main(int argc, char **argv)
32 {
33  SQLiteConfiguration config(CONFDIR);
34  config.load();
35 
36  std::string token = "";
37  try {
38  token = config.get_string("/fawkes/mainapp/blackboard_magic_token");
39  } catch (Exception &e) {
40  cout << "Could not read shared memory token for blackboard." << endl;
41  cout << "BlackBoard is probably running without shared memory." << endl;
42  return -1;
43  }
44 
45  LocalBlackBoard::cleanup(token.c_str());
46  return 0;
47 }
virtual void load(const char *file_path)=0
Load configuration.
Configuration storage using SQLite.
Definition: sqlite.h:39
Fawkes library namespace.
STL namespace.
Base class for exceptions in Fawkes.
Definition: exception.h:36
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.