1 #include "CubeManager.h" 4 #include <sys/resource.h> 7 #include <QCoreApplication> 11 #include "CubeManager.h" 26 if (QCoreApplication::instance() == 0) {
27 static char **argv = 0;
31 argv[0] =
new char[1024];
32 strcpy(argv[0],
"CubeManager");
37 new QCoreApplication(argc, argv);
41 struct rlimit fileLimit;
43 if (getrlimit(RLIMIT_NOFILE, &fileLimit) != 0) {
44 QString msg =
"Cannot read the maximum allowable open files from system resources.";
91 IString attri = attIn.toString();
95 if (attri.size() > 0) {
99 IString fullName = expName + attri;
100 QString fileName(fullName.
ToQt());
103 if (searchResult ==
p_cubes.end()) {
105 searchResult =
p_cubes.find(fileName);
107 (*searchResult)->setVirtualBands(attIn.
bands());
113 (*searchResult)->open(fileName);
127 QString needsCleaned =
p_opened.dequeue();
131 return (*searchResult);
144 QString fileName(
FileName(cubeFileName).expanded());
147 if (searchResult ==
p_cubes.end()) {
151 delete searchResult.value();
152 searchResult.value() = NULL;
QQueue< QString > p_opened
This keeps track of cubes that have been opened.
File name manipulation and expansion.
unsigned int p_currentLimit
The current limit regarding number of open files allowed.
This error is for when a programmer made an API call that was illegal.
CubeManager()
This initializes a CubeManager object.
void CleanCubes()
This method removes all cubes from memory.
#define _FILEINFO_
Macro for the filename and line number.
~CubeManager()
This is the CubeManager destructor.
QString ToQt() const
Retuns the object string as a QString.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
QMap< QString, Cube * > p_cubes
This keeps track of the open cubes.
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
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.
IO Handler for Isis Cubes.