/[ascend]/trunk/pygtk/interface/dimensions.h
ViewVC logotype

Contents of /trunk/pygtk/interface/dimensions.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 132 - (show annotations) (download) (as text)
Wed Dec 21 00:14:13 2005 UTC (14 years, 6 months ago) by johnpye
File MIME type: text/x-chdr
File size: 2041 byte(s)
Adding the PyGTK interface to CMU repository. Whaddyareckon?
1 #ifndef ASCXX_DIMENSIONS_H
2 #define ASCXX_DIMENSIONS_H
3
4 #include <string>
5
6 #include "units.h"
7
8 extern "C"{
9 #include <utilities/ascConfig.h>
10 #include <compiler/fractions.h>
11 #include <compiler/compiler.h>
12 #include <compiler/dimen.h>
13 }
14
15 /**
16 A mapping of dimensions to units
17 */
18 /*
19 map<Dimensions,UnitsM> defaultUnits
20 multimaps<Dimensions,UnitsM> allUnits
21 */
22
23 /**
24 A 'dimensions object'. This is a wrapper to the 'dim_type' in ASCEND.
25 This object allows querying to find suitable units for outputting
26 or inputting data from/for a given type.
27 */
28 class Dimensions{
29 private:
30 const dim_type *d;
31 public:
32 static const unsigned MAX_DIMS = NUM_DIMENS;
33 static const std::string BASEUNITS[MAX_DIMS];
34
35 /// Return the string name of fundamental unit for the i-th dimension of measurement.
36 static const std::string getBaseUnit(const unsigned &i);
37
38 /// Construct a Dimension object fro mthe ASCEND internal data type
39 Dimensions(const dim_type *d);
40
41 /// Copy constructor
42 Dimensions(const Dimensions &);
43
44 /// Default constructor, required to keep std::vector happy
45 Dimensions();
46
47 /// Return the ASCEND internal datatype
48 const dim_type *getInternalType() const;
49
50 // Comparison operators
51 const bool operator<(const Dimensions &) const;
52 const bool operator==(const Dimensions &) const;
53 const bool operator!=(const Dimensions &) const;
54
55 /// Get default units for the given dimension
56 // const UnitsM getDefaultUnits() const; # DEFINED IN PYTHON
57
58 /// Get the user's preferred units for the given dimension
59 //const UnitsM getUserUnits() const; # DEFINED IN PYTHON
60
61 /// Test for a dimensionless Dimension object
62 const bool isDimensionless() const;
63
64 /// Test for a wildcard ('don't care') Dimension object
65 const bool isWild() const;
66
67 /// Get the numerator part of the index in the i-th dimension (eg for Area, with i={length}, return 2)
68 const FRACPART getFractionNumerator(const unsigned &i) const;
69
70 /// Get the denominator part of the index in the i-th dimension
71 const FRACPART getFractionDenominator(const unsigned &i) const;
72 };
73
74 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22