File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
CubeManager.h
1 #ifndef CubeManager_h
2 #define CubeManager_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include "IException.h"
11 
12 #include <QMap>
13 #include <QQueue>
14 #include <QString>
15 #include <memory>
16 
17 #include <iostream>
18 
19 using namespace std;
20 
21 /*
22  * Unless noted otherwise, the portions of Isis written by the
23  * USGS are public domain. See individual third-party library
24  * and package descriptions for intellectual property
25  * information,user agreements, and related information.
26  *
27  * Although Isis has been used by the USGS, no warranty, expressed or implied,
28  * is made by the USGS as to the accuracy and functioning of such software
29  * and related material nor shall the fact of distribution constitute any such
30  * warranty, and no responsibility is assumed by the USGS in connection
31  * therewith.
32  *
33  * For additional information, launch
34  * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see
35  * the Privacy &amp; Disclaimers page on the Isis website,
36  * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
37  * http://www.usgs.gov/privacy.html.
38  */
39 namespace Isis {
40  class Cube;
41 
70  class CubeManager {
71  public:
72  CubeManager();
73  ~CubeManager();
74 
84  static Cube *Open(const QString &cubeFileName) {
85  if (!p_instance) {
86  p_instance = new CubeManager();
87  }
88 
89  return p_instance->OpenCube(cubeFileName);
90  }
91 
102  void SetNumOpenCubes(unsigned int numCubes) {
103 
104  // check to see if numCubes exceeds the number of open files limitations
105  if (numCubes > p_maxOpenFiles) {
106  p_currentLimit = p_maxOpenFiles;
107  }
108  p_currentLimit = numCubes;
109  }
110 
111 
120  static void CleanUp(const QString &cubeFileName) {
121  p_instance->CleanCubes(cubeFileName);
122  }
123 
124 
130  static void CleanUp() {
131  delete p_instance;
132  p_instance = 0;
133  };
134 
135  void CleanCubes(const QString &cubeFileName);
136  void CleanCubes();
137  Cube *OpenCube(const QString &cubeFileName);
138 
139  protected:
140 
143 
146 
149 
151  unsigned int p_currentLimit;
152 
154  unsigned int p_maxOpenFiles;
155  };
156 }
157 
158 #endif
Isis::CubeManager::p_cubes
QMap< QString, Cube * > p_cubes
This keeps track of the open cubes.
Definition: CubeManager.h:145
Isis::CubeManager::p_instance
static CubeManager * p_instance
There is always at least one instance of CubeManager around.
Definition: CubeManager.h:142
Isis::CubeManager::p_maxOpenFiles
unsigned int p_maxOpenFiles
60% of the maximum number of open files allowed by system resources
Definition: CubeManager.h:154
Isis::CubeManager::Open
static Cube * Open(const QString &cubeFileName)
This method calls the method OpenCube() on the static instance.
Definition: CubeManager.h:84
Isis::CubeManager::CleanUp
static void CleanUp()
This method calls CleanCubes() on the static instance.
Definition: CubeManager.h:130
Isis::CubeManager
Class for quick re-accessing of cubes based on file name.
Definition: CubeManager.h:70
Isis::CubeManager::CleanUp
static void CleanUp(const QString &cubeFileName)
This method calls CleanCubes(const QString &cubeFileName) on the static instance.
Definition: CubeManager.h:120
Isis::CubeManager::p_currentLimit
unsigned int p_currentLimit
The current limit regarding number of open files allowed.
Definition: CubeManager.h:151
Isis::CubeManager::p_opened
QQueue< QString > p_opened
This keeps track of cubes that have been opened.
Definition: CubeManager.h:148
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
std
Namespace for the standard library.
QQueue< QString >
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
Isis::CubeManager::SetNumOpenCubes
void SetNumOpenCubes(unsigned int numCubes)
This sets the maximum number of opened cubes for this instance of CubeManager.
Definition: CubeManager.h:102
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:16:22