kim-api  2.1.4-git+v2.1.3-git-1-g7847914a.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
KIM_TimeUnit.hpp
Go to the documentation of this file.
1 //
2 // CDDL HEADER START
3 //
4 // The contents of this file are subject to the terms of the Common Development
5 // and Distribution License Version 1.0 (the "License").
6 //
7 // You can obtain a copy of the license at
8 // http://www.opensource.org/licenses/CDDL-1.0. See the License for the
9 // specific language governing permissions and limitations under the License.
10 //
11 // When distributing Covered Code, include this CDDL HEADER in each file and
12 // include the License file in a prominent location with the name LICENSE.CDDL.
13 // If applicable, add the following below this CDDL HEADER, with the fields
14 // enclosed by brackets "[]" replaced with your own identifying information:
15 //
16 // Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
17 //
18 // CDDL HEADER END
19 //
20 
21 //
22 // Copyright (c) 2016--2019, Regents of the University of Minnesota.
23 // All rights reserved.
24 //
25 // Contributors:
26 // Ryan S. Elliott
27 //
28 
29 //
30 // Release: This file is part of the kim-api.git repository.
31 //
32 
33 
34 #ifndef KIM_TIME_UNIT_HPP_
35 #define KIM_TIME_UNIT_HPP_
36 
37 #include <string>
38 
39 namespace KIM
40 {
49 class TimeUnit
50 {
51  public:
62 
66  TimeUnit();
67 
73  TimeUnit(int const id);
74 
82  TimeUnit(std::string const & str);
83 
91  bool Known() const;
92 
100  bool operator==(TimeUnit const & rhs) const;
101 
109  bool operator!=(TimeUnit const & rhs) const;
110 
121  std::string const & ToString() const;
122 }; // class TimeUnit
123 
126 namespace TIME_UNIT
127 {
133 extern TimeUnit const unused;
134 
140 extern TimeUnit const fs;
141 
147 extern TimeUnit const ps;
148 
154 extern TimeUnit const ns;
155 
161 extern TimeUnit const s;
162 
172 void GetNumberOfTimeUnits(int * const numberOfTimeUnits);
173 
187 int GetTimeUnit(int const index, TimeUnit * const timeUnit);
188 
193 {
198  bool operator()(TimeUnit const & a, TimeUnit const & b) const
199  {
200  return a.timeUnitID < b.timeUnitID;
201  }
202 }; // struct Comparator
203 } // namespace TIME_UNIT
204 } // namespace KIM
205 
206 #endif // KIM_TIME_UNIT_HPP_
void GetNumberOfTimeUnits(int *const numberOfTimeUnits)
Get the number of standard TimeUnit&#39;s defined by the KIM API.
bool operator==(TimeUnit const &rhs) const
Compares TimeUnit objects for equality.
TimeUnit()
Create an uninitialized TimeUnit object.
An Extensible Enumeration for the TimeUnit&#39;s supported by the KIM API.
std::string const & ToString() const
Converts the object to a string.
TimeUnit const ps
The standard picosecond unit of time.
TimeUnit const ns
The standard nanosecond unit of time.
TimeUnit const s
The standard second unit of time.
Structure provided for use with std::map.
TimeUnit const fs
The standard femtosecond unit of time.
bool Known() const
Determines if the object is a quantity known to the KIM API.
bool operator()(TimeUnit const &a, TimeUnit const &b) const
Provides an (logically unmeaningful) ordering for TimeUnit objects so that they can be stored in a st...
bool operator!=(TimeUnit const &rhs) const
Compares TimeUnit objects for inequality.
int timeUnitID
Integer identifying the specific TimeUnit represented.
int GetTimeUnit(int const index, TimeUnit *const timeUnit)
Get the identity of each defined standard TimeUnit.
TimeUnit const unused
Indicates that a TimeUnit is not used.