// // user_example.hpp // // Copyright (c) 2001 by Michael S. Kenniston. For the most // recent version check www.xnet.com/~msk/quantity. Permission is granted // to use this code without restriction so long as this copyright // notice appears in all source files. // This code is provided as-is, with no warrantee of correctness. // This file simply demonstrates how a programmer can add more // physical quantity types and units without modifying the // library. #ifndef USER_EXAMPLE_HPP_MSK20010704 #define USER_EXAMPLE_HPP_MSK20010704 #include "cuj/quantity/quantity.hpp" namespace hyperspace { // warp factor dimensions are m-2 kg+3 s-1 A typedef cuj::quantity::dimensions< -2, 3, -1, 1 > warp_factor_d; // standard unit of measurement for warp factor is the Scotty inline cuj::quantity::quantity< warp_factor_d > scotty() { using cuj::quantity::meter; using cuj::quantity::kilogram; using cuj::quantity::second; using cuj::quantity::ampere; return 1.0 / meter() / meter() * kilogram() * kilogram() * kilogram() / second() * ampere(); } } // namespace hyperspace // // You can now say things like: // // warp_factor_t full_power = 3.27 * mega() * scotty(); // #endif // USER_EXAMPLE_HPP_MSK20010704