core/vcsl/vcsl_axis.h
Go to the documentation of this file.
00001 #ifndef vcsl_axis_h_
00002 #define vcsl_axis_h_
00003 //:
00004 // \file
00005 // \brief Axis descriptor: a dimension, a unit, a label
00006 // \author François BERTEL
00007 //
00008 // \verbatim
00009 //  Modifications
00010 //   2000/06/28 François BERTEL Creation. Adapted from IUE
00011 //   2004/09/17 Peter Vanroose  do not pass vcsl_unit objects; use vcsl_unit_sptr instead
00012 // \endverbatim
00013 
00014 #include <vbl/vbl_ref_count.h>
00015 #include <vcsl/vcsl_axis_sptr.h>
00016 #include <vcsl/vcsl_unit_sptr.h>
00017 #include <vcsl/vcsl_dimension_sptr.h>
00018 #include <vcl_string.h>
00019 
00020 //: Axis descriptor: a dimension, a unit, a label
00021 class vcsl_axis
00022   : public vbl_ref_count
00023 {
00024  public:
00025   //***************************************************************************
00026   // Constructors/Destructor
00027   //***************************************************************************
00028 
00029   //: Default constructor. Axis with length in meters and an empty label
00030   vcsl_axis();
00031 
00032   //: Constructor from dimension. Unit is the standard one. Label is empty
00033   explicit vcsl_axis(vcsl_dimension_sptr const& new_dimension);
00034 
00035   //: Constructor from dimension and unit. Label is empty
00036   //  REQUIRE: new_dimension.compatible_unit(new_unit)
00037   vcsl_axis(vcsl_dimension_sptr const& new_dimension,
00038             vcsl_unit_sptr const& new_unit);
00039 
00040   //: Constructor from dimension, unit and label
00041   vcsl_axis(vcsl_dimension_sptr const& new_dimension,
00042             vcsl_unit_sptr const& new_unit,
00043             vcl_string const& new_label)
00044     : dimension_(new_dimension), unit_(new_unit), label_(new_label) {}
00045 
00046   // Copy constructor
00047   vcsl_axis(const vcsl_axis &a)
00048     : vbl_ref_count(),dimension_(a.dimension_),unit_(a.unit_),label_(a.label_){}
00049 
00050   // Destructor
00051   ~vcsl_axis() {}
00052 
00053   //***************************************************************************
00054   // Status report
00055   //***************************************************************************
00056 
00057   //: Return the dimension
00058   vcsl_dimension_sptr dimension() const { return dimension_; }
00059 
00060   //: Return the unit of the dimension
00061   vcsl_unit_sptr unit() const { return unit_; }
00062 
00063   //: Return the label of the axis
00064   vcl_string label() const { return label_; }
00065 
00066   //***************************************************************************
00067   // Status change
00068   //***************************************************************************
00069 
00070   //: Set the dimension. The unit is set with the standard unit
00071   void set_dimension(vcsl_dimension_sptr const& new_dimension);
00072 
00073   //: Set the dimension and the unit
00074   //  REQUIRE: new_dimension.compatible_unit(new_unit)
00075   void set_dimension_and_unit(vcsl_dimension_sptr const& new_dimension,
00076                               vcsl_unit_sptr const& new_unit);
00077 
00078   //: Set the unit of the dimension
00079   //  REQUIRE dimension()->compatible_unit(new_unit)
00080   void set_unit(vcsl_unit_sptr const& new_unit);
00081 
00082   //: Set the label
00083   void set_label(vcl_string const& new_label) { label_=new_label; }
00084 
00085  protected:
00086   //***************************************************************************
00087   // Implementation
00088   //***************************************************************************
00089 
00090   //: Dimension
00091   vcsl_dimension_sptr dimension_;
00092 
00093   //: Unit of the dimension
00094   vcsl_unit_sptr unit_;
00095 
00096   //: Label of the axis
00097   vcl_string label_;
00098 };
00099 
00100 #endif // vcsl_axis_h_