kim-api-v2  2.0.0+912e79a.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
KIM_DataType.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-v2-2.0.0 package.
31 //
32 
33 
34 #ifndef KIM_DATA_TYPE_HPP_
35 #define KIM_DATA_TYPE_HPP_
36 
37 #include <string>
38 
39 namespace KIM
40 {
49 class DataType
50 {
51  public:
62 
66  DataType();
67 
73  DataType(int const id);
74 
82  DataType(std::string const & str);
83 
91  bool Known() const;
92 
100  bool operator==(DataType const & rhs) const;
101 
109  bool operator!=(DataType const & rhs) const;
110 
121  std::string const & ToString() const;
122 }; // class DataType
123 
126 namespace DATA_TYPE
127 {
135 extern DataType const Integer;
136 
144 extern DataType const Double;
145 
146 
157 void GetNumberOfDataTypes(int * const numberOfDataTypes);
158 
172 int GetDataType(int const index, DataType * const dataType);
173 
178 {
183  bool operator()(DataType const & a, DataType const & b) const
184  {
185  return a.dataTypeID < b.dataTypeID;
186  }
187 }; // struct Comparator
188 } // namespace DATA_TYPE
189 } // namespace KIM
190 
191 #endif // KIM_DATA_TYPE_HPP_
int dataTypeID
Integer identifying the specific DataType represented.
bool operator!=(DataType const &rhs) const
Compares DataType objects for inequality.
std::string const & ToString() const
Converts the object to a string.
DataType()
Create an uninitialized DataType object.
int GetDataType(int const index, DataType *const dataType)
Get the identity of each defined standard DataType.
DataType const Integer
The standard Integer data type.
DataType const Double
The standard Double data type.
Structure provided for use with std::map.
bool Known() const
Determines if the object is a quantity known to the KIM API.
bool operator==(DataType const &rhs) const
Compares DataType objects for equality.
bool operator()(DataType const &a, DataType const &b) const
Provides an (logically unmeaningful) ordering for DataType objects so that they can be stored in a st...
An Extensible Enumeration for the DataType&#39;s supported by the KIM API.
void GetNumberOfDataTypes(int *const numberOfDataTypes)
Get the number of standard DataType&#39;s defined by the KIM API.