kim-api  2.3.0+v2.3.0.GNU.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 // KIM-API: An API for interatomic models
3 // Copyright (c) 2013--2022, Regents of the University of Minnesota.
4 // All rights reserved.
5 //
6 // Contributors:
7 // Ryan S. Elliott
8 //
9 // SPDX-License-Identifier: LGPL-2.1-or-later
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU Lesser General Public
13 // License as published by the Free Software Foundation; either
14 // version 2.1 of the License, or (at your option) any later version.
15 //
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // Lesser General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public License
22 // along with this library; if not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 //
25 
26 //
27 // Release: This file is part of the kim-api-2.3.0 package.
28 //
29 
30 
31 #ifndef KIM_TIME_UNIT_HPP_
32 #define KIM_TIME_UNIT_HPP_
33 
34 #include <string>
35 
36 namespace KIM
37 {
46 class TimeUnit
47 {
48  public:
59 
63  TimeUnit();
64 
70  TimeUnit(int const id);
71 
79  TimeUnit(std::string const & str);
80 
88  bool Known() const;
89 
97  bool operator==(TimeUnit const & rhs) const;
98 
106  bool operator!=(TimeUnit const & rhs) const;
107 
118  std::string const & ToString() const;
119 }; // class TimeUnit
120 
123 namespace TIME_UNIT
124 {
130 extern TimeUnit const unused;
131 
137 extern TimeUnit const fs;
138 
144 extern TimeUnit const ps;
145 
151 extern TimeUnit const ns;
152 
158 extern TimeUnit const s;
159 
169 void GetNumberOfTimeUnits(int * const numberOfTimeUnits);
170 
184 int GetTimeUnit(int const index, TimeUnit * const timeUnit);
185 
190 {
195  bool operator()(TimeUnit const & a, TimeUnit const & b) const
196  {
197  return a.timeUnitID < b.timeUnitID;
198  }
199 }; // struct Comparator
200 } // namespace TIME_UNIT
201 } // namespace KIM
202 
203 #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.