cprover
jar_pool.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #include "jar_pool.h"
10 #include "jar_file.h"
11 
12 jar_filet &jar_poolt::operator()(const std::string &file_name)
13 {
14  const auto it = m_archives.find(file_name);
15  if(it == m_archives.end())
16  {
17  // VS: Can't construct in place
18  auto file = jar_filet(file_name);
19  return m_archives.emplace(file_name, std::move(file)).first->second;
20  }
21  else
22  return it->second;
23 }
24 
26  const std::string &buffer_name,
27  const void *pmem,
28  size_t size)
29 {
30  const auto it = m_archives.find(buffer_name);
31  if(it == m_archives.end())
32  {
33  // VS: Can't construct in place
34  auto file = jar_filet(pmem, size);
35  return m_archives.emplace(buffer_name, std::move(file)).first->second;
36  }
37  else
38  return it->second;
39 }
jar_filet & add_jar(const std::string &buffer_name, const void *pmem, size_t size)
Add a jar archive or retrieve from cache if already added.
Definition: jar_pool.cpp:25
jar_filet & operator()(const std::string &jar_path)
Load jar archive or retrieve from cache if already loaded.
Definition: jar_pool.cpp:12
Class representing a .jar archive.
Definition: jar_file.h:23
std::map< std::string, jar_filet > m_archives
Jar files that have been loaded.
Definition: jar_pool.h:37
Definition: kdev_t.h:19