Click here to Skip to main content
15,905,566 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 4:59
ScotDolan14-May-07 4:59 
AnswerRe: C++ Multiple inheritance Pin
jhwurmbach14-May-07 4:59
jhwurmbach14-May-07 4:59 
AnswerRe: C++ Multiple inheritance Pin
Cedric Moonen14-May-07 5:04
Cedric Moonen14-May-07 5:04 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 5:14
ScotDolan14-May-07 5:14 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 5:14
ScotDolan14-May-07 5:14 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 7:41
ScotDolan14-May-07 7:41 
GeneralRe: C++ Multiple inheritance Pin
Cedric Moonen14-May-07 7:52
Cedric Moonen14-May-07 7:52 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 8:26
ScotDolan14-May-07 8:26 
I want to inherit ClxThread twice because, i need to create two ClxThreads which are just worker threads. One in the Mainloop and one in Poll. It is looking like I should change ClxThread to have the capablities to be object within Mainloop and Poll instead of a inherited object.


<br />
class ClxThread<br />
{<br />
public:<br />
	ClxThread();<br />
	virtual ~ClxThread();<br />
<br />
	typedef unsigned (__stdcall *PTHREADFUNC)(void *);<br />
	//Thread Management<br />
	bool CreateNewThread(void);<br />
	bool CreateNewThread(PTHREADFUNC pThreadFunc);<br />
	bool Wait(); //Wait for thread to end<br />
	bool Suspend(); //Suspend the thread<br />
	bool Resume(); //Resume a suspended thread<br />
	bool Kill(); //Terminate a thread<br />
	bool IsActive(); //Check for activity<br />
<br />
	//override these functions in the derived class<br />
	virtual void ThreadEntry(){ }<br />
	virtual void ThreadExit(){ }<br />
	virtual void ThreadRun(){ }<br />
<br />
	//a friend<br />
	//friend DWORD WINAPI _ThreadFunc(LPVOID  pvThread);<br />
	static UINT  WINAPI _ThreadFunc(LPVOID pParam);<br />
<br />
public:<br />
	HANDLE m_hThread;	// Thread handle<br />
	UINT   uiThreadId;	//<br />
<br />
	bool m_bActive; //activity indicator<br />
	DWORD m_lpId; //Thread ID<br />
};<br />








The main loop classes header.

<br />
<br />
class mainloop :  public LENZE_8200_MOTION, private  ClxThread<br />
{<br />
public:<br />
	mainloop();<br />
	~mainloop();<br />
<br />
	void Start(void){  CreateNewThread(  ); };// Start Clx thread objecty<br />
<br />
protected:	<br />
<br />
	// The Setup Function the MC362X<br />
	void init_mc362X(void);<br />
	bool read_mc362x(void);<br />
	bool read_lenze_cfg_sheet(void);<br />
	bool read_independencer( void );<br />
<br />
private:	<br />
	// This is function that becomes the worker thread. <br />
	void ThreadRun(void);				<br />
<br />
	MC362X_MOTION		isacard;		//Defines Motion object<br />
<br />
	ClxUdp				cmd_socket;		//<br />
	ClxUdp				data_socket;	//<br />
<br />
	bool isRaising;<br />
    void Raise(void);<br />
	bool Balance_A( double position );<br />
	void Balance_B(void);<br />
	void init_lift(void);<br />
	void lift(void);<br />
<br />
private:<br />
	bool m_bBalanced;<br />
	char m_cStateCurrent;<br />
	char m_cStateLast;<br />
	bool m_bDown;<br />
	bool m_bEStop;<br />
	bool m_bPortUp;<br />
	bool m_bStarboard;<br />
	bool m_bCanopyOpen;<br />
	bool m_bUp;<br />
	char m_cCommand;	<br />
<br />
};<br />



The Poll classer headers


<br />
class LENZE_8200_MOTION : public  ClxThread, protected CLX_LENZE_8200<br />
{<br />
public:<br />
   LENZE_8200_MOTION(void);<br />
   ~LENZE_8200_MOTION(void);<br />
	<br />
public:<br />
   bool init_lenze8200( int comm_port, int baud_rate, long timeout_ms, int maxtxfailures );<br />
   bool start_lenze8200(void){ return CreateNewThread(); }<br />
	<br />
   //These public member functions are to set, get and control Lift axis lenze 8200 inverter	<br />
   // These function provide a thread safe way to access data member variables that contain <br />
  // lift axis status information and perform commands. <br />
   void   pitch_set_address( char address ){ return SetAddress( &pitch_axis_data, address );  };<br />
  char   pitch_get_address( void ){ return GetAddress( &pitch_axis_data );  }<br />
<br />
}<br />


Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures

GeneralRe: C++ Multiple inheritance Pin
Mark Salsbery14-May-07 8:18
Mark Salsbery14-May-07 8:18 
GeneralRe: Mark Has a, Does a, Where is a, Pin
ScotDolan14-May-07 8:35
ScotDolan14-May-07 8:35 
GeneralRe: Mark Has a, Does a, Where is a, Pin
Mark Salsbery14-May-07 9:01
Mark Salsbery14-May-07 9:01 
GeneralRe: Mark Has a, Does a, Where is a, Pin
led mike14-May-07 9:39
led mike14-May-07 9:39 
GeneralThe purpose of the thread class Pin
ScotDolan14-May-07 10:56
ScotDolan14-May-07 10:56 
QuestionRe: The purpose of the thread class Pin
Mark Salsbery14-May-07 11:16
Mark Salsbery14-May-07 11:16 
GeneralRe: The purpose of the thread class Pin
led mike14-May-07 12:33
led mike14-May-07 12:33 
GeneralRe: The purpose of the thread class Pin
ScotDolan15-May-07 3:26
ScotDolan15-May-07 3:26 
GeneralRe: The purpose of the thread class Pin
led mike15-May-07 5:43
led mike15-May-07 5:43 
AnswerRe: The purpose of the thread class Pin
ScotDolan15-May-07 6:14
ScotDolan15-May-07 6:14 
GeneralRe: The purpose of the thread class Pin
led mike15-May-07 7:04
led mike15-May-07 7:04 
AnswerRe: C++ Multiple inheritance Pin
led mike14-May-07 8:01
led mike14-May-07 8:01 
QuestionNetwork Machines Pin
rw10414-May-07 4:33
rw10414-May-07 4:33 
AnswerRe: Network Machines Pin
led mike14-May-07 4:47
led mike14-May-07 4:47 
GeneralRe: Network Machines Pin
rw10414-May-07 5:01
rw10414-May-07 5:01 
QuestionRe: Network Machines Pin
David Crow14-May-07 4:53
David Crow14-May-07 4:53 
AnswerRe: Network Machines Pin
rw10414-May-07 5:00
rw10414-May-07 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.