icedb  version 0.5.1
Snow particle scattering database API
unitsPlugins.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "../defs.h"
3 #include <string>
4 #include <memory>
5 #include <functional>
6 #include <vector>
7 #include "../optionsForwards.hpp"
8 namespace icedb {
9  namespace units {
10  class converter;
11  namespace implementations {
12  struct Unithandler;
15  {
16  public:
20  typedef std::function<bool(optsType)> canConvertType;
21  canConvertType canConvert;
22  typedef std::function<std::shared_ptr<const Unithandler>(optsType)> constructType;
24  const char* name;
25  };
26  typedef std::shared_ptr<const Converter_registry_provider> conv_prov_cp;
27  typedef std::shared_ptr<const std::vector<conv_prov_cp> > conv_hooks_t;
28  conv_hooks_t getHooks();
30  struct Unithandler
31  {
32  protected:
33  const char* id;
34  Unithandler(const char* id);
35  public:
36  virtual ~Unithandler() {}
37  virtual double convert(double input) const = 0;
38  virtual bool isValid() const = 0;
39  };
40  }
41  }
42 }
43 
44 
45 
std::shared_ptr< const std::vector< conv_prov_cp > > conv_hooks_t
Opaque object provided to perform unit manipulations.
std::shared_ptr< const options > const_options_ptr
std::function< std::shared_ptr< const Unithandler >optsType)> constructType
std::shared_ptr< const Converter_registry_provider > conv_prov_cp