00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.17 $ 00012 00013 License 00014 OSB rating and billing library for communication networks 00015 Copyright (C) 2004, 2005, 2006 OSB systems 00016 00017 This file may be distributed and/or modify under the terms of the 00018 GNU General Public License (GPL) as published by the Free Software 00019 Foundation which is provided in the file LICENSE.GPL included in the 00020 packaging of this file. 00021 00022 The file is distributed in the hope that it will be useful, but WITHOUT 00023 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00024 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00025 for more details. 00026 00027 Holders of a OSB Commercial License may use this file under the terms 00028 and conditions of this commercial license. 00029 */ 00030 #ifndef _MODULES_H_ 00031 #define _MODULES_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 #include <string> 00037 #include <list> 00038 00039 // + libraries 00040 00041 // + local headers 00042 #include "osbid.h" 00043 #include "osbconst.h" 00044 00045 // + class declarations 00046 namespace OSB_LIB { 00047 class UserMgmtCfg; 00048 class ModAccessMap; 00049 } 00050 00051 namespace OSB_DB { 00052 class Session; // dbsession.h 00053 class ModuleGw; // modules-gw.h 00054 } 00055 00056 // ************************************************************************ 00057 // namespace extensions 00058 namespace OSB_LIB { 00059 00060 // ************************************************************************ 00061 // forward declarations 00062 00063 // ************************************************************************ 00064 // type definitions 00065 00066 // ************************************************************************ 00067 // class definitions 00071 class Module { 00073 friend class UserMgmtCfg; 00075 friend class OSB_DB::ModuleGw; 00076 00077 public: 00079 typedef Id<ModuleId> Oid; 00080 00081 public: 00083 explicit Module(const Oid& oid); 00085 ~Module(); 00087 Module(const Module& rhs); 00089 Module& operator=(const Module& rhs); 00090 00091 public: 00093 Oid oid() const; 00095 ModuleId modId() const; 00097 const std::string& name() const; 00099 const std::string appType() const; 00106 const ModAccessMap& accessMap() const; 00107 00108 private: 00110 00118 void lock( 00119 const OSB_DB::Session& session, 00120 bool noWait 00121 ) const; 00132 static void handleObjectStatus( 00133 ObjectStatus os, 00134 const Oid& id 00135 ); 00147 void incObjVs(const OSB_DB::Session& session); 00149 00150 private: 00152 Oid oid_; 00154 long objVs_; 00156 std::string name_; 00158 std::string appType_; 00160 ModAccessMap* accessMap_; 00161 }; // class Module 00162 00166 class Modules { 00168 friend class UserMgmtCfg; 00169 00170 public: 00172 typedef std::list<Module> Cont; 00174 typedef Cont::const_iterator ConstIter; 00175 00176 public: 00185 void read( 00186 const OSB_DB::Session& session 00187 ); 00188 00196 const Module& get(ModuleId id) const; 00197 00199 ConstIter begin() const; 00201 ConstIter end() const; 00203 bool empty() const; 00204 00212 const Cont& cont() const; 00213 00214 private: // UserMgmtCfg only 00222 Module& get(ModuleId id); 00223 00224 private: 00226 Cont cont_; 00227 }; // class Modules 00228 } // namespace OSB_LIB 00229 00230 // ************************************************************************ 00231 // inline definitions 00232 namespace OSB_LIB { 00233 } // namespace OSB_LIB 00234 00235 #endif // #ifndef _MODULES_H_