|
Isis 3 Programmer Reference
|
7 #include "CubeManager.h"
10 #include <sys/resource.h>
13 #include <QCoreApplication>
16 #include "CubeAttribute.h"
17 #include "CubeManager.h"
32 if (QCoreApplication::instance() == 0) {
33 static char **argv = 0;
37 argv[0] =
new char[1024];
38 strcpy(argv[0],
"CubeManager");
43 new QCoreApplication(argc, argv);
47 struct rlimit fileLimit;
49 if (getrlimit(RLIMIT_NOFILE, &fileLimit) != 0) {
50 QString msg =
"Cannot read the maximum allowable open files from system resources.";
97 IString attri = attIn.toString();
101 if (attri.size() > 0) {
105 IString fullName = expName + attri;
106 QString fileName(fullName.
ToQt());
109 if (searchResult ==
p_cubes.end()) {
111 searchResult =
p_cubes.find(fileName);
113 (*searchResult)->setVirtualBands(attIn.
bands());
119 (*searchResult)->open(fileName);
133 QString needsCleaned =
p_opened.dequeue();
137 return (*searchResult);
150 QString fileName(
FileName(cubeFileName).expanded());
153 if (searchResult ==
p_cubes.end()) {
157 delete searchResult.value();
158 searchResult.value() = NULL;
~CubeManager()
This is the CubeManager destructor.
File name manipulation and expansion.
QMap< QString, Cube * > p_cubes
This keeps track of the open cubes.
static CubeManager * p_instance
There is always at least one instance of CubeManager around.
unsigned int p_maxOpenFiles
60% of the maximum number of open files allowed by system resources
Cube * OpenCube(const QString &cubeFileName)
This method opens a cube.
static void CleanUp()
This method calls CleanCubes() on the static instance.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
unsigned int p_currentLimit
The current limit regarding number of open files allowed.
QQueue< QString > p_opened
This keeps track of cubes that have been opened.
IO Handler for Isis Cubes.
@ Programmer
This error is for when a programmer made an API call that was illegal.
This is free and unencumbered software released into the public domain.
Adds specific functionality to C++ strings.
CubeManager()
This initializes a CubeManager object.
This is free and unencumbered software released into the public domain.
QString ToQt() const
Retuns the object string as a QString.
void CleanCubes()
This method removes all cubes from memory.