vcsl_length.cxx
Go to the documentation of this file.
1 // This is core/vcsl/vcsl_length.cxx
2 #include "vcsl_length.h"
3 #include <vcsl/vcsl_meter.h>
4 
5 //---------------------------------------------------------------------------
6 // Is `new_unit' a compatible unit for the dimension ?
7 //---------------------------------------------------------------------------
8 bool vcsl_length::compatible_unit(vcsl_unit_sptr const& new_unit) const
9 {
10  return new_unit->cast_to_length_unit()!=nullptr;
11 }
12 
13 //---------------------------------------------------------------------------
14 // Return the standard unit associated to the dimension
15 //---------------------------------------------------------------------------
17 {
18  return vcsl_meter::instance().ptr();
19 }
20 
21 //---------------------------------------------------------------------------
22 // Return the reference to the unique vcsl_length object
23 //---------------------------------------------------------------------------
25 {
26  static vcsl_length_sptr instance_=new vcsl_length;
27  return instance_;
28 }
vcsl_length()=default
bool compatible_unit(vcsl_unit_sptr const &new_unit) const override
Is ‘new_unit’ a compatible unit for the dimension ?.
Definition: vcsl_length.cxx:8
Standard unit associated to the length dimension.
vcsl_unit_sptr standard_unit() const override
Return the standard unit associated to the dimension.
Definition: vcsl_length.cxx:16
static vcsl_length_sptr instance()
Return the reference to the unique vcsl_length object.
Definition: vcsl_length.cxx:24
static vcsl_meter_sptr instance()
Return the reference to the unique vcsl_meter object.
Definition: vcsl_meter.cxx:7
Length dimension.
T * ptr() const