resourcefwd.h

Go to the documentation of this file.
00001 // OSB library ************************************************ -*- C++ -*-
00006 /*
00007   AUTHOR(S): Stephan Broennimann (vb)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.8.2.2 $
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 _RESOURCEFWD_H_
00031 #define _RESOURCEFWD_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <string>
00037 
00038 // + libraries
00039 
00040 // + local headers
00041 #include "osbid.h"
00042 
00043 // + class declarations
00044 namespace OSB_LIB {
00045     class Network;
00046     class NetworkElement;
00047 }
00048 
00049 // ************************************************************************
00050 // namespace extensions
00051 namespace OSB_LIB {
00052 
00053 // ************************************************************************
00054 // type declarations
00055     // defined in resourcelists.h
00056     template<typename R> class ResourceList;
00057 
00058 // ************************************************************************
00059 // class definitions
00066         enum ResourceType {
00068             rtUnknown       = 0,
00070             rtCallingCard   = 2,
00072             rtTrunkResource = 6,
00074             rtAccessNumber  = 7,
00076             rtE164          = 8,
00078             rtIp4Address    = 9,
00080             rtIpGroup       = 10,
00082             rtImsi          = 11,
00084             rtInTrunk       = 13,
00086             rtOutTrunk      = 14
00087         };
00088 
00094         typedef std::string ResourceNumber;
00095 
00102         struct ResourceKey {
00104             ResourceType type_;
00106             ResourceNumber number_;
00114             Id2<NetworkElement> neId_;
00115         public:
00117             ResourceKey();
00118 
00120             ResourceKey(
00121                       ResourceType    type,
00122                 const ResourceNumber& number
00123             );
00124 
00126             ResourceKey(
00127                       ResourceType    type,
00128                 const ResourceNumber& number,
00129                 const Id<Network>&    nwId
00130             );
00131 
00136             ResourceKey(
00137                       ResourceType         type,
00138                 const ResourceNumber&      number,
00139                 const Id2<NetworkElement>& neId
00140             );
00141 
00143             inline bool operator<(const ResourceKey& rhs) const;
00145             inline bool operator==(const ResourceKey& rhs) const;
00146         };                              // struct ResourceKey
00147 
00155         ResourceType mkResType(long rt);
00163         long toLong(ResourceType rt);
00164 }                                       // namespace OSB_LIB
00165 
00166 // ************************************************************************
00167 // inline definitions
00168 namespace OSB_LIB {
00169 
00170     // *****************************************************************
00171     // struct ResourceKey
00172     bool ResourceKey::operator<(const ResourceKey& rhs) const
00173     {
00174         if (type_   != rhs.type_)   return type_   < rhs.type_;
00175         if (number_ != rhs.number_) return number_ < rhs.number_;
00176         return neId_ < rhs.neId_;
00177     }
00178 
00179     bool ResourceKey::operator==(const ResourceKey& rhs) const
00180     {
00181         return type_   == rhs.type_
00182             && number_ == rhs.number_
00183             && neId_   == rhs.neId_;
00184     }
00185 }                                       // namespace OSB_LIB
00186 #endif                                  // #ifndef _RESOURCEFWD_H_

Generated on Sat Sep 2 14:06:34 2006 for OSB Library by  doxygen 1.4.7