1 /*****************************************************************************
2 * Author: Valient Gough <vgough@pobox.com>
3 *
4 *****************************************************************************
5 * Copyright (c) 2004, Valient Gough
6 *
7 * This library is free software; you can distribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License (LGPL), as published by
9 * the Free Software Foundation; either version 2.1 of the License, or (at your
10 * option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the LGPL in the file COPYING for more
15 * details.
16 *
17 */
18
19
20 #include "rlog.h"
21 #include "rloginit.h"
22
23 #include <list>
24
25 using namespace rlog;
26 using namespace std;
27
28
~RLogModule()29 RLogModule::~RLogModule()
30 {
31 }
32
init(int & argc,char ** argv)33 void RLogModule::init( int &argc, char **argv )
34 {
35 (void)argc;
36 (void)argv;
37 }
38
39
40
41 static std::list< RLogModule * > moduleList;
42 static int *gArgc =0;
43 static char **gArgv = 0;
44
RLogInit(int & argc,char ** argv)45 void rlog::RLogInit( int &argc, char **argv )
46 {
47 gArgc = &argc;
48 gArgv = argv;
49
50 list<RLogModule*>::const_iterator it;
51 for(it = moduleList.begin(); it != moduleList.end(); ++it)
52 (*it)->init( argc, argv );
53 }
54
RegisterModule(RLogModule * module)55 RLogModule * rlog::RegisterModule( RLogModule *module )
56 {
57 moduleList.push_back( module );
58 if(gArgc)
59 module->init( *gArgc, gArgv );
60
61 return module;
62 }
63
64
65