Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * bb_list.cpp - list Fawkes BlackBoard shared memory segments 00004 * 00005 * Generated: Thu Oct 19 14:56:13 2006 (Anne's 25th Birthday) 00006 * Copyright 2005-2006 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #include <utils/ipc/shm.h> 00024 #include <config/sqlite.h> 00025 #include <blackboard/shmem/header.h> 00026 #include <blackboard/shmem/lister.h> 00027 #include <blackboard/blackboard.h> 00028 #include <blackboard/bbconfig.h> 00029 #include <iostream> 00030 00031 using namespace std; 00032 using namespace fawkes; 00033 00034 int 00035 main(int argc, char **argv) 00036 { 00037 SQLiteConfiguration config(CONFDIR); 00038 config.load(); 00039 00040 std::string token = ""; 00041 try { 00042 token = config.get_string("/fawkes/mainapp/blackboard_magic_token"); 00043 } catch (Exception &e) { 00044 cout << "Could not read shared memory token for blackboard." << endl; 00045 cout << "BlackBoard is probably running without shared memory." << endl; 00046 return -1; 00047 } 00048 00049 BlackBoardSharedMemoryHeader *bbsh = new BlackBoardSharedMemoryHeader(BLACKBOARD_VERSION); 00050 BlackBoardSharedMemoryLister *bblister = new BlackBoardSharedMemoryLister(); 00051 SharedMemory::list(token.c_str(), bbsh, bblister); 00052 delete bblister; 00053 delete bbsh; 00054 return 0; 00055 }