======================
Custom Counting Units
======================

The units library defines 16 special counting units.  These are custom counting units intended to specify a specific type of event.  The key idea behind the custom counting units is that they can be multiplied, divided by any powers of distance, mass, currency, or time units and can be inverted. The primary usage of these is for units that are procedurally defined and often used in the context of per mass or per volume or per time or per $.

In strings these can be represented by "CXCUN[X]"  Where X is some number between 0 and 15.

In C++ code they can be generated by

.. code-block:: c++

   precise_unit new_cxc_unit=generate_custom_count_unit(code);


A set of checks and queries is available to check for custom_count_units.

-  bool precise::custom::is_custom_count_unit(detail::unit_data udata);
-  bool precise::custom::is_custom_count_unit_inverted(detail::unit_data udata);
-  unsigned short precise::custom::custom_count_unit_number(detail::unit_data udata);

These checks will operate regardless of any m/kg/s unit combination or inverted units.  Underlying this is a set of codes and unit powers that would be extremely odd to encounter in normal use.

Custom count units in Use
----------------------------
there are a few custom count units in use for specific clinical units Many of these units defy conversion to other known units but are used in pharmacological contexts
So there is no translation to other units and cannot be converted except to multiple of the same unit.  There are often well established tests for these units but no good way to convert them to other units.  Many of these units come from `UCUM <https://unitsofmeasure.org/ucum.html>`_.

-   custom_count_unit(0):  is used for specific count units with commodities of some kind for string translation
-   custom_count_unit(1):  is `Arbitrary Unit` which has a clinical definition of some kind
-   custom_count_unit(2):  is `International Unit <https://en.wikipedia.org/wiki/International_unit>`_
-   custom_count_unit(3):  is `Index of reactivity <http://finto.fi/ucum/en/page/r394>`_ which has a clinical definition
-   custom_count_unit(4):  is `limit of flocculation <http://finto.fi/ucum/en/page/r404>`_ which has a clinical definition
-   custom_count_unit(5):  is `HPF <https://medical-dictionary.thefreedictionary.com/high-power+field>`_ or High Power field which is related to microscopy
-   6-15 are not currently in use.

The other custom units are available for use or the one with known definition can be use if there is no domain conflicts.

Implementation details
----------------------------
Custom count units utilizes the flags, candela, ampere, and Kelvin fields to make use of some non-physical unit definitions for a more useful purpose.
