All pastes #483218 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-11 16:43 UTC
rendered paste body
globals.h:
#ifndef GLOBALS_H_
#define GLOBALS_H_
#include <IceUtil/Thread.h>
#include <IceUtil/StaticMutex.h>
#include <IceUtil/Mutex.h>
#include "X12.h"

extern IceUtil::Mutex m1;
extern int disp_heigth;
extern int disp_with;

#endif /*GLOBALS_H_*/

globals.cpp:
#include globals.h

IceUtil::Mutex m1;
int disp_height = 80;
int disp_with = 60;

myDisplay.h:

#ifndef MYDISPLAY_H_
#define MYDISPLAY_H_
#include <vector>
#include <string>
#include <Ice/Ice.h>
#include "X12.h"
#include "command.h"
#include "globals.h"

class myIDisplay : public X12::Display::IDisplay
{
	private:
		std::vector<command> *m_comList;
	
	public:
    void putCharacter(Ice::Int x, Ice::Int y, Ice::Byte c, X12::Color col, const Ice::Current&);
    void putString(Ice::Int x, Ice::Int y, const std::string& s, X12::Color col, const Ice::Current&);
    void fillRectangle(Ice::Int x, Ice::Int y, Ice::Int w, Ice::Int h, Ice::Byte c, X12::Color col, const Ice::Current&);
    void putBitmap(Ice::Int x, Ice::Int y, const X12::Bitmap& bm, const Ice::Current&);
    void getSize(Ice::Int& w, Ice::Int& h, const Ice::Current&) const;
    //IceUtil::Mutex dispMutex;
    myIDisplay(std::vector<command> *comList) { m_comList = comList; };
	~myIDisplay(){};
};
#endif /*MYDISPLAY_H_*/


myDisplay.cpp:


void myIDisplay::putCharacter(Ice::Int x, Ice::Int y, Ice::Byte c, X12::Color col, const Ice::Current&)
{
	command temp;
	temp.commandid = 0;
	temp.x = x;
	temp.y = y;
	temp.c = c;
	temp.col = col;
	
	IceUtil::Mutex::Lock l1(m1);
	//dispMutex->lock();	
		m_comList->push_back(temp);
	//dispMutex->unlock();
}