OSB_LIB::RoundRule Class Reference

Inheritance diagram for OSB_LIB::RoundRule:

Inheritance graph
[legend]
Collaboration diagram for OSB_LIB::RoundRule:

Collaboration graph
[legend]
List of all members.

Detailed Description

Abstract base class for round rule.

Contains functions to carry out Rounding operations.

Definition at line 66 of file roundrule.h.

Public Types

Public Member Functions

Read access to data member:
Modify data members:

Private Member Functions

Private Attributes


Member Typedef Documentation

typedef std::auto_ptr<RoundRule> OSB_LIB::RoundRule::AutoPtr

Short-cut for an auto pointer.

For details see quality manual, implementation patterns: Virtual copy construction.

Reimplemented in OSB_LIB::RoundUp, and OSB_LIB::DontRound.

Definition at line 78 of file roundrule.h.

typedef Id<RoundRule> OSB_LIB::RoundRule::Oid

Typesave object identification, database link.

Definition at line 70 of file roundrule.h.


Member Enumeration Documentation

enum OSB_LIB::RoundRule::Type

Supported types of rounding rules.

This value refer to database link: ROUNDRULE_TYPE.ROUNDRULE_ID. RoundRuleFactory::create needs to support it.

Enumerator:
rr_unknown  Unknown type.
rr_roundUp 
rr_dontRound 

Definition at line 86 of file roundrule.h.


Constructor & Destructor Documentation

OSB_LIB::RoundRule::RoundRule ( const Oid id  )  [inline]

Constructor only with object id.

Definition at line 93 of file roundrule.h.

OSB_LIB::RoundRule::RoundRule ( const Oid id,
const std::string &  name,
const std::string &  des 
) [inline]

Constructor with object id, name and des.

Definition at line 95 of file roundrule.h.

virtual OSB_LIB::RoundRule::~RoundRule (  )  [inline, virtual]

Destructor for abstract base class.

Definition at line 100 of file roundrule.h.


Member Function Documentation

AutoPtr OSB_LIB::RoundRule::clone (  )  const

Virtual copy construction.

For details see quality manual, implementation patterns.

Reimplemented in OSB_LIB::RoundUp, and OSB_LIB::DontRound.

virtual RoundRule* OSB_LIB::RoundRule::clone_ (  )  const [private, pure virtual]

Internal virtual copy constructor.

For details see quality manual, implementation patterns.

Implemented in OSB_LIB::RoundUp, and OSB_LIB::DontRound.

const std::string& OSB_LIB::RoundRule::des (  )  const [inline]

RoundRule description.

Definition at line 113 of file roundrule.h.

References des_.

template<typename R>
const R * OSB_LIB::RoundRule::isa ( R *&  ptr  )  const

Downcasting: see template<typename R> R* isa(R*&).

Definition at line 502 of file roundrule.h.

template<typename R>
R * OSB_LIB::RoundRule::isa ( R *&  ptr  ) 

Downcast to a derived class.

The function uses dynamic_cast<R*> to downcast an object of RoundRule to an object of a derived class.

          ptr = dynamic_cast<R*>();
          return ptr;

An usage example is given below:

          void foo(const RoundRule& rr)
          {
              ...
              RoundUp* pRup;
              if (0 != rr.isa(pRup)) {
                  // work with pRup
              }
          }

Parameters:
ptr Pointer to cast to. It gets the result of the downcast. It's value will be 0 if the cast fails.
Returns:
The argument pointer `ptr' after the downcast.

Definition at line 496 of file roundrule.h.

const std::string& OSB_LIB::RoundRule::name (  )  const [inline]

RoundRule name.

Definition at line 111 of file roundrule.h.

References name_.

const Oid& OSB_LIB::RoundRule::oid (  )  const [inline]

Object id, database link.

Definition at line 109 of file roundrule.h.

References id_.

virtual Decimal OSB_LIB::RoundRule::operator() ( const Decimal  )  const [pure virtual]

Performs the rounding.

Implemented in OSB_LIB::RoundUp, and OSB_LIB::DontRound.

Referenced by round().

Decimal OSB_LIB::RoundRule::round ( const Decimal d  )  const [inline]

Explicit form of the rounding operation. Calls operator().

Definition at line 104 of file roundrule.h.

References operator()().

void OSB_LIB::RoundRule::setDes ( const std::string &  des  ) 

Set the object's description.

void OSB_LIB::RoundRule::setName ( const std::string &  name  ) 

Set the object's name.


Member Data Documentation

std::string OSB_LIB::RoundRule::des_ [private]

Description of round rule.

Definition at line 165 of file roundrule.h.

Referenced by des().

Oid OSB_LIB::RoundRule::id_ [private]

Unique id, database link.

Definition at line 163 of file roundrule.h.

Referenced by oid().

std::string OSB_LIB::RoundRule::name_ [private]

Name of round rule.

Definition at line 164 of file roundrule.h.

Referenced by name().


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:12:59 2006 for OSB Library by  doxygen 1.4.7