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);
117 (*searchResult)->open(fileName);
131 QString needsCleaned =
p_opened.dequeue();
135 return (*searchResult);
148 QString fileName(
FileName(cubeFileName).expanded());
151 if (searchResult ==
p_cubes.end()) {
155 delete searchResult.value();
156 searchResult.value() = NULL;
IO Handler for Isis Cubes.
unsigned int p_maxOpenFiles
60% of the maximum number of open files allowed by system resources
static CubeManager * p_instance
There is always at least one instance of CubeManager around.
QMap< QString, Cube * > p_cubes
This keeps track of the open cubes.
Cube * OpenCube(const QString &cubeFileName)
This method opens a cube.
void CleanCubes()
This method removes all cubes from memory.
QQueue< QString > p_opened
This keeps track of cubes that have been opened.
CubeManager()
This initializes a CubeManager object.
static void CleanUp()
This method calls CleanCubes() on the static instance.
unsigned int p_currentLimit
The current limit regarding number of open files allowed.
~CubeManager()
This is the CubeManager destructor.
File name manipulation and expansion.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
@ Programmer
This error is for when a programmer made an API call that was illegal.
Adds specific functionality to C++ strings.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.