kim-api  2.3.0+v2.3.0.GNU.GNU.
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
KIM_Collections.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_COLLECTIONS_HPP_
32 #define KIM_COLLECTIONS_HPP_
33 
34 #include <string>
35 
36 namespace KIM
37 {
38 // Forward declarations
39 class LogVerbosity;
40 class Collection;
41 class CollectionItemType;
42 class CollectionsImplementation;
43 
111 {
112  public:
125  static int Create(Collections ** const collections);
126 
140  static void Destroy(Collections ** const collections);
141 
162  int GetItemType(std::string const & itemName,
163  CollectionItemType * const itemType) const;
164 
188  std::string const & itemName,
189  std::string const ** const fileName,
190  Collection * const collection) const;
191 
209  std::string const & itemName,
210  int * const extent);
211 
253  int GetItemMetadataFile(int const index,
254  std::string const ** const fileName,
255  unsigned int * const fileLength,
256  unsigned char const ** const fileRawData,
257  int * const availableAsString,
258  std::string const ** const fileString) const;
259 
276  int * const extent);
277 
299  int GetItemNameByType(int const index,
300  std::string const ** const itemName) const;
301 
320  CollectionItemType const itemType,
321  int * const extent);
322 
345  int GetItemNameByCollectionAndType(int const index,
346  std::string const ** const itemName) const;
347 
369  Collection const collection,
370  CollectionItemType const itemType,
371  std::string const & itemName,
372  std::string const ** const fileName) const;
373 
393  Collection const collection,
394  CollectionItemType const itemType,
395  std::string const & itemName,
396  int * const extent);
397 
442  int const index,
443  std::string const ** const fileName,
444  unsigned int * const fileLength,
445  unsigned char const ** const fileRawData,
446  int * const availableAsString,
447  std::string const ** const fileString) const;
448 
449 
468  void GetProjectNameAndSemVer(std::string const ** const projectName,
469  std::string const ** const semVer) const;
470 
487  std::string const ** const name) const;
488 
510  std::string const ** const name, std::string const ** const value) const;
511 
529  void GetConfigurationFileName(std::string const ** const fileName) const;
530 
548  int CacheListOfDirectoryNames(Collection const collection,
549  CollectionItemType const itemType,
550  int * const extent);
551 
573  int GetDirectoryName(int const index,
574  std::string const ** const directoryName) const;
575 
584  void SetLogID(std::string const & logID);
585 
595  void PushLogVerbosity(LogVerbosity const logVerbosity);
596 
604  void PopLogVerbosity();
605 
606  private:
607  // do not allow copy constructor or operator=
608  Collections(Collections const &);
609  void operator=(Collections const &);
610 
611  Collections();
612  ~Collections();
613 
614  CollectionsImplementation * pimpl;
615 }; // class Collections
616 } // namespace KIM
617 
618 #endif // KIM_COLLECTIONS_HPP_
int CacheListOfItemMetadataFiles(CollectionItemType const itemType, std::string const &itemName, int *const extent)
Cache a list of an item&#39;s metadata files.
int GetItemLibraryFileNameAndCollection(CollectionItemType const itemType, std::string const &itemName, std::string const **const fileName, Collection *const collection) const
Get the item&#39;s library file name and its KIM::Collection.
int CacheListOfItemNamesByCollectionAndType(Collection const collection, CollectionItemType const itemType, int *const extent)
Cache a list of all item names of a specific type in a specific collection.
int GetItemNameByType(int const index, std::string const **const itemName) const
Get the name of an item from the cached list.
int GetEnvironmentVariableName(CollectionItemType const itemType, std::string const **const name) const
Get the names of environment variables that store configuration settings for the KIM::COLLECTION::env...
void SetLogID(std::string const &logID)
Set the identity of the Log object associated with the Collections object.
void PushLogVerbosity(LogVerbosity const logVerbosity)
Push a new LogVerbosity onto the Collections object&#39;s Log object verbosity stack. ...
static int Create(Collections **const collections)
Create a new KIM API Collections object.
Provides the interface to the KIM API Collections and is meant to be used by simulators.
An Extensible Enumeration for the CollectionItemType&#39;s supported by the KIM API.
static void Destroy(Collections **const collections)
Destroy a previously Collections::Create&#39;d object.
int GetItemLibraryFileNameByCollectionAndType(Collection const collection, CollectionItemType const itemType, std::string const &itemName, std::string const **const fileName) const
Get the item&#39;s library file name.
An Extensible Enumeration for the LogVerbosity&#39;s supported by the KIM API.
void GetConfigurationFileEnvironmentVariable(std::string const **const name, std::string const **const value) const
Get the name and value of the environment variable that stores the name of the KIM API user configura...
An Extensible Enumeration for the Collection&#39;s supported by the KIM API.
int GetDirectoryName(int const index, std::string const **const directoryName) const
Get the name of a directory from the cached list.
int CacheListOfItemNamesByType(CollectionItemType const itemType, int *const extent)
Cache a list of all item names of a specific type in the KIM API collections.
int GetItemMetadataFileByCollectionAndType(int const index, std::string const **const fileName, unsigned int *const fileLength, unsigned char const **const fileRawData, int *const availableAsString, std::string const **const fileString) const
Get the name and content of one of an item&#39;s metadata files.
void PopLogVerbosity()
Pop a LogVerbosity from the Collections object&#39;s Log object verbosity stack.
int GetItemType(std::string const &itemName, CollectionItemType *const itemType) const
Get the KIM::CollectionItemType of the item in the KIM API collections with a specific name...
int GetItemNameByCollectionAndType(int const index, std::string const **const itemName) const
Get the name of an item from the cached list.
void GetProjectNameAndSemVer(std::string const **const projectName, std::string const **const semVer) const
Get the KIM API project name and full Semantic Version string.
int CacheListOfItemMetadataFilesByCollectionAndType(Collection const collection, CollectionItemType const itemType, std::string const &itemName, int *const extent)
Cache a list of an item&#39;s metadata files.
void GetConfigurationFileName(std::string const **const fileName) const
Get the absolute file and path name of the KIM API user configuration file.
int GetItemMetadataFile(int const index, std::string const **const fileName, unsigned int *const fileLength, unsigned char const **const fileRawData, int *const availableAsString, std::string const **const fileString) const
Get the name and content of one of an item&#39;s metadata files.
int CacheListOfDirectoryNames(Collection const collection, CollectionItemType const itemType, int *const extent)
Cache a list of directory names where a specific KIM API collection stores library files for a specif...