Ignore:
Timestamp:
Nov 9, 2009 6:33:07 PM (10 years ago)
Author:
EdwinStraver
Message:

Changed formatting using AStyle -A4 -p

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcEventHandler.cpp

    r1271 r1286  
    1515
    1616//-------------------------------------------------------------------
    17 // Default Constructor 
     17// Default Constructor
    1818//-------------------------------------------------------------------
    1919
    2020CbcEventHandler::CbcEventHandler (CbcModel *model)
    21   : model_(model),
    22     dfltAction_(CbcEventHandler::noAction),
    23     eaMap_(0)
     21        : model_(model),
     22        dfltAction_(CbcEventHandler::noAction),
     23        eaMap_(0)
    2424{  /* nothing more required */ }
    2525
    2626//-------------------------------------------------------------------
    27 // Copy constructor 
     27// Copy constructor
    2828//-------------------------------------------------------------------
    2929/*
    3030  Here we need to clone the event/action map, if it exists
    3131*/
    32 CbcEventHandler::CbcEventHandler (const CbcEventHandler & rhs)
    33   : model_(rhs.model_),
    34     dfltAction_(rhs.dfltAction_),
    35     eaMap_(0)
    36 { if (rhs.eaMap_ != 0)
    37   { eaMap_ = new eaMapPair(*rhs.eaMap_) ; } }
     32CbcEventHandler::CbcEventHandler (const CbcEventHandler & rhs)
     33        : model_(rhs.model_),
     34        dfltAction_(rhs.dfltAction_),
     35        eaMap_(0)
     36{
     37    if (rhs.eaMap_ != 0) {
     38        eaMap_ = new eaMapPair(*rhs.eaMap_) ;
     39    }
     40}
    3841
    3942//----------------------------------------------------------------
    40 // Assignment operator 
     43// Assignment operator
    4144//-------------------------------------------------------------------
    4245CbcEventHandler&
    43 CbcEventHandler::operator=(const CbcEventHandler& rhs)
     46CbcEventHandler::operator=(const CbcEventHandler & rhs)
    4447{
    45   if (this != &rhs) {
    46     model_ = rhs.model_ ;
    47     dfltAction_ = rhs.dfltAction_ ;
    48     if (rhs.eaMap_ != 0)
    49     { eaMap_ = new eaMapPair(*rhs.eaMap_) ; }
    50     else
    51     { eaMap_ = 0 ; } }
    52   return (*this) ; }
     48    if (this != &rhs) {
     49        model_ = rhs.model_ ;
     50        dfltAction_ = rhs.dfltAction_ ;
     51        if (rhs.eaMap_ != 0) {
     52            eaMap_ = new eaMapPair(*rhs.eaMap_) ;
     53        } else {
     54            eaMap_ = 0 ;
     55        }
     56    }
     57    return (*this) ;
     58}
    5359
    5460//----------------------------------------------------------------
    5561// Clone
    5662//-------------------------------------------------------------------
    57 CbcEventHandler* 
     63CbcEventHandler*
    5864CbcEventHandler::clone() const
    59 { return (new CbcEventHandler(*this)) ; }
     65{
     66    return (new CbcEventHandler(*this)) ;
     67}
    6068
    6169//-------------------------------------------------------------------
    62 // Destructor 
     70// Destructor
    6371//-------------------------------------------------------------------
    6472/*
     
    6674*/
    6775CbcEventHandler::~CbcEventHandler ()
    68 { if (eaMap_ != 0) delete eaMap_ ; }
     76{
     77    if (eaMap_ != 0) delete eaMap_ ;
     78}
    6979
    7080
     
    7888  Otherwise return the default action.
    7989*/
    80 { if (eaMap_ != 0)
    81   { eaMapPair::iterator entry = eaMap_->find(event) ;
    82     if (entry != eaMap_->end())
    83     { return (entry->second) ; }
    84     else
    85     { return (dfltAction_) ; } }
    86   else
    87   { return (dfltAction_) ; } }
     90{
     91    if (eaMap_ != 0) {
     92        eaMapPair::iterator entry = eaMap_->find(event) ;
     93        if (entry != eaMap_->end()) {
     94            return (entry->second) ;
     95        } else {
     96            return (dfltAction_) ;
     97        }
     98    } else {
     99        return (dfltAction_) ;
     100    }
     101}
    88102
Note: See TracChangeset for help on using the changeset viewer.