section.h

Go to the documentation of this file.
00001 // OSB library ************************************************ -*- C++ -*-
00006 /*
00007   AUTHOR(S): Narendranath Reddy (nr)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.34 $
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 _SECTION_H_
00031 #define _SECTION_H_
00032 
00033 // *********************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <string>
00037 #include <utility>
00038 
00039 // + local headers
00040 #include "osbid.h"
00041 
00042 #include "contract.h"
00043 #include "persproduct.h"
00044 #include "product.h"
00045 #include "chargetraits.h"
00046 
00047 // *********************************************************************
00048 // class declarations
00049 namespace OSB_LIB {
00050     class OsbXml;
00051 }
00052 
00053 // *********************************************************************
00054 // namespace extensions
00055 namespace OSB_LIB {
00056 
00057 // *********************************************************************
00058 // type definitions
00059     enum SectionType {
00060         notSet             =     0,
00061         subsCharges        =   100,
00062         oneTimeCharges     =   200,
00063         international      =  1000,
00064         totalInternational =  1100,
00065         national           =  2000,
00066         totalNational      =  2100,
00067         localcall          =  3000,
00068         totalLocal         =  3100,
00069         productTotal       =  1200
00070     };
00071 
00072 // *********************************************************************
00073 // class definitions
00074     class Section {
00075         friend class BillingXml;
00076         friend class SumCdr01BillingXml;
00077     public:
00078         Section(PersProduct::UserId productUserId,
00079                 PersProduct::Oid    persProductId,
00080                 ProductNode::Oid    productNodeId,
00081                 SectionType         sectionPart)
00082             : productUserId_(productUserId),
00083               persProductId_(persProductId),
00084               productNodeId_(productNodeId),
00085               sectionPart_(sectionPart) {}
00086 
00087         std::string str() const;
00088         bool operator==(const Section&) const;
00089         bool operator!=(const Section&) const;
00090         bool operator< (const Section&) const;
00091         bool operator> (const Section&) const;
00092         bool operator<=(const Section&) const;
00093         bool operator>=(const Section&) const;
00094 
00095         // returns the position of the first section part that differs
00096         // (from left, e.g., 2 if persProductId is not the same) and
00097         // 0 if both sections are equal.
00098         int compare(const Section& rhs) const;
00099 
00100         // get the section name for a section type identifier
00101         // ToDo: Should be implemented in a generic way as a separate
00102         // list of id/name pairs. Currently, both the types as well as
00103         // the names are hardcoded in the Section.
00104         std::string getName(const SectionType&) const;
00105 
00106         // return a global section for invoice items that are not
00107         // related to any specific section. globalSection() is < any
00108         // other section.
00109         static const Section& globalSection();
00110 
00111         // sections do not need to be complete.
00112         static const PersProduct::UserId NO_PROD_USER;
00113         static const PersProduct::Oid    NO_PERS_PROD;
00114         static const ProductNode::Oid    NO_PROD_NODE;
00115         static const SectionType         NO_SECTION_PART;
00116 
00117     private:
00118         PersProduct::UserId  productUserId_;
00119         PersProduct::Oid     persProductId_;
00120         ProductNode::Oid     productNodeId_;
00121         SectionType          sectionPart_;
00122     };
00123 }                                       // namespace OSB_LIB
00124 #endif                                  // #ifndef _SECTION_H_

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