Пример #1
0
void generateAverage(int **x, int n)
{
    allocateMem(x,n);
    int i=0;
    for(i=0; i<n; i++)
        *(*x+i)=rand();
}
Пример #2
0
void generateBest(int **x, int n)
{
    allocateMem(x,n);
    int i=0;
    for(i=0; i<n; i++)
    {
        *(*x+i)=i;
    }
}
Пример #3
0
int frame::setDepth(int d) {
    if(d < 1 || d > 2)
        return(INVALID_ARGS);
    if(d==depth)
        return(NO_ERROR);
    if(allocateMem(width,height,color,d)!=NO_ERROR)
        return(NO_MEM);
    depth=d;
}
Пример #4
0
void generateWorst(int **x, int n)
{
    allocateMem(x,n);
    int i=0;
    for(i=n-1; i>=0; i--)
    {
        *(*x+i)=n-i;
    }
}
Пример #5
0
int frame::setHeight(int h) {
    if(h<=0)
        return(INVALID_ARGS);
    if(h==height)
        return(NO_ERROR);
    if(allocateMem(width,h,color,depth)!=NO_ERROR)
        return(NO_MEM);
    height=h;
}
Пример #6
0
int frame::setColor(int c) {
    if(c < MONO || c > BGR)
        return(INVALID_ARGS);
    if(c==color)
        return(NO_ERROR);
    if(allocateMem(width,height,c,depth)!=NO_ERROR)
        return(NO_MEM);
    color=c;
}
Пример #7
0
int frame::setWidth(int w) {
    if(w<=0)
        return(INVALID_ARGS);
    if(w==width)
        return(NO_ERROR);
    if(allocateMem(w,height,color,depth)!=NO_ERROR)
        return(NO_MEM);
    width=w;
}
Пример #8
0
KdTree::KdTree()
{
    m_allocated = false;
    m_root = NULL;
    m_splitList = NULL;
    m_splitPool = NULL;
    m_kdPtr = NULL;
    m_objPtr = NULL;
    m_kdMem = NULL;
    m_objMem = NULL;

    allocateMem();
    m_root = newKdTreeNode();
}
Пример #9
0
//
// copy operator
//
frame& frame::operator=(const frame &f) {
    if(allocateMem(f.width,f.height,f.color,f.depth)==NO_ERROR) {
        width=f.width;
        height=f.height;
        color=f.color;
        depth=f.depth;

        observer=f.observer;
        camera=f.camera;
        telescope=f.telescope;
        frameDate=f.frameDate;
        frameDateUTC=f.frameDateUTC;
    }
}
Пример #10
0
//
// full constructor
//
frame::frame(int w,int h,int c,int d, string o="unknown", string cam="unknown", string t="unknown", int64_t date=0, int64_t dateUTC=0) {
    observer=o;
    camera=cam;
    telescope=t;
    frameDate=0;
    frameDateUTC=0;

    if(allocateMem(w,h,c,d)==NO_ERROR) {
        width=w;
        height=h;
        color=c;
        depth=d;
    } else {
        width=0;
        height=0;
        color=MONO;
        depth=0;

        mono_plan=NULL;
        red_plan=NULL;
        green_plan=NULL;
        blue_plan=NULL;
    }
}
Пример #11
0
//
// copy constructor
//
frame::frame(const frame &f) {
    observer=f.observer;
    camera=f.camera;
    telescope=f.telescope;
    frameDate=f.frameDate;
    frameDateUTC=f.frameDateUTC;

    if(allocateMem(f.width,f.height,f.color,f.depth)==NO_ERROR) {
        width=f.width;
        height=f.height;
        color=f.color;
        depth=f.depth;
    } else {
        width=0;
        height=0;
        color=MONO;
        depth=0;

        mono_plan=NULL;
        red_plan=NULL;
        green_plan=NULL;
        blue_plan=NULL;
    }
}
Пример #12
0
BaseImage<T>::BaseImage(const Bounds<int>& b, double scale) :
    AssignableToImage<T>(b), _owner(), _data(0), _stride(0), _scale(scale)
{
    if (this->_bounds.isDefined()) allocateMem();
    // Else _data is left as 0, stride = 0.
}
Пример #13
0
void comhandle()
{
	serial_println("");
	serial_println("Welcome to the MPX OS.");
	serial_println("Feel free to begin entering commands.");
	serial_println("");
	while(1) {
		sys_req(IDLE);
		char *command = polling();
		if (!strcmpigncase(command, "shutdown")) {
			if (shutdownConfirmed()) {
				serial_println("System shutting down...");
				clearAllQueues();
				break;
			} else {
				serial_println("Shutdown canceled.");
			}
		} else if (!strcmpigncase(command, "version")) {
			version();
		} else if (!strcmpigncase(command, "help")) {
			help();
		} else if (!strcmpigncase(command, "setdate")) {
			setdate();
		} else if (!strcmpigncase(command, "getdate")) {
			getdate();
		} else if (!strcmpigncase(command, "settime")) {
			settime();
		} else if (!strcmpigncase(command, "gettime")) {
			gettime();
		} else if (!strcmpigncase(command, "suspend")) {
			suspendPCB();
		} else if (!strcmpigncase(command, "resume")) {
			resumePCB();
		} else if (!strcmpigncase(command, "setpriority")) {
			setPriority();
		} else if (!strcmpigncase(command, "showPCB")) {
		        showPCB();
		} else if (!strcmpigncase(command, "deletePCB")) {
			deletePCB();
		} else if (!strcmpigncase(command, "showReady")) {
		        showReady();
		} else if (!strcmpigncase(command, "showBlocked")) {
		        showBlocked();
		} else if (!strcmpigncase(command, "showAll")) {
		        showAll();
		} else if (!strcmpigncase(command, "loadr3")) {
		        loadR3();
		} else if (!strcmpigncase(command, "allocate")) {
			allocateMem();
		} else if (!strcmpigncase(command, "freeMemory")) {
			freeMem();
		} else if (!strcmpigncase(command, "printAlloc")) {
			printAlloc();
		} else if (!strcmpigncase(command, "printFree")) {
			printFree();
		} else if (!strcmpigncase(command, "isEmpty")) {
			isEmpty();
		} else if (strcmp(command, '\0')) {
			serial_println("Command not recognized. Type help to view commands.");
			serial_println("");
		}
		sys_free_mem(command);
	}
	sys_req(EXIT);
}