CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Documentation/CodingRules/ExampleClass.cc

Go to the documentation of this file.
00001 //#include "Utilities/Configuration/interface/Architecture.h"
00002 
00003 /* \file ExampleClass.cc
00004  *
00005  *  $Date: 2005/07/26 10:13:49 $
00006  *  $Revision: 1.1 $
00007  *  \author W. Woodpecker - CERN
00008  */
00009 
00010 //#include "Subsystem/Package/interface/ExampleClass.h"
00011 //#include "Subsystem/Package/interface/SomeAlgorithm.h"
00012 
00013 using namespace std;
00014 
00015 #include "ExampleClass.h"
00016 class SomeAlgorithm {
00017  public: SomeAlgorithm(){};
00018 };
00019   
00020 
00021 
00022 // Constructor
00023 ExampleClass::ExampleClass() :
00024   theCount(0),
00025   theAlgo(new SomeAlgorithm()) 
00026 {}
00027 
00028 // Destructor
00029 ExampleClass::~ExampleClass(){
00030   delete theAlgo;
00031 }
00032 
00033 
00034 // A simple setter
00035 void ExampleClass::setCount(int ticks){
00036   theCount = ticks;
00037 }
00038 
00039 
00040 // A simple getter
00041 int ExampleClass::count() const{
00042   return theCount;
00043 }
00044 
00045 
00046 
00047 // Another setter
00048 void ExampleClass::setValues(const vector<float>& entries) {
00049   theValues = entries;
00050 }
00051 
00052 
00053 // A getter returning a const reference
00054 const vector<float>& ExampleClass::values() const {
00055   return theValues;
00056 }
00057 
00058 
00059 
00060 // A member function
00061 float ExampleClass::computeMean() const {
00062   float result = 1.;
00063   //... do all necessary computations...
00064   return result;
00065 }
00066