Core iTOps Tube

Wednesday, 9 May 2012

writing C++ class and member functions

I have the following class and thought that when I call the set command to set a member, I always use value. Would that be fine?




Code:






class ModMisfit {



protected:



  Real    dtau;

  Real    mdacc;

  Real    mindist;

  bool    hw;

  Source**    src;



public:



  void  set_integration(

    const Integration  value);



  void  set_dtau(

    const Real  value);



  void  set_mdacc(

    const Real  value);



  void  set_mindist(

    const Real  value);



  void  set_hw(

    const bool  value);



};



void ModMisfit::set_dtau(

  const Real  value) {



  for ( int i = 0; i < nsrcs; i++ ) {

      src[i]->SetdTau( value );

  }



}



inline void ModMisfit::set_mdacc(

  const Real  value ) {



  mdacc = value;



}



inline void ModMisfit::set_mindist(

  const Real  value ) {



  mindist = value;



}



void ModMisfit::set_integration(

  const Integration  value ) {



  for ( int i = 0; i < nsrcs; i++ ) {

      Src[i]->SetIntegration( value );

  }



}






No comments:

Post a Comment