Click here to Skip to main content
15,916,463 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
For that scenario why wouldn't you declare an inherited class "inside of mainloop"?

Mike,
That is exactly what I am trying to do. However, I want mainloop to inherit ClxThread. but i also need it to inherit a Poll_Invertors. The problem is Poll_Invertors also inherits a ClxThread to create its own thread. The results is i end up with only one thread even being started ie basicly dreaded diamond.

       mainloop                           
         /  \
        /    \
       /      \
      /        \
ClxThread    Poll_Invertors
                 \
                  \
                   \
                ClxThread 




The mainloop code

<br />
class mainloop :  public Poll_Invertors, public ClxThread<br />
{<br />
public:<br />
	mainloop();<br />
	~mainloop();<br />
	void Start(void){  CreateNewThread( ); };// Start Clx thread objecty<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 />
	void ThreadRun( void );	 // This is function that becomes the worker thread. <br />
	MC362X_MOTION		isacard;		//Defines Motion object<br />
	ClxUdp			cmd_socket;		//<br />
	ClxUdp			data_socket;	//<br />
}<br />



The Poll_Invertors Header
<br />
lass 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 />
   private:	<br />
        void ThreadRun(void);  // This is the thread function that polls the invertors<br />
	void RunAll( void );   <br />
<br />
	LNZ82_INVRT_DATA pitch_axis_data;<br />
	LNZ82_INVRT_DATA roll_axis_data;<br />
	LNZ82_INVRT_DATA lift_axis_data;<br />
	LNZ82_INVRT_DATA counterweight_axis_data;<br />
	ClxSafeQue<char>	m_sqInvertorsCmdQue;<br />
	char				m_iInvertorsPollState;<br />
	   <br />
	char pitch_init(LNZ82_INVRT_DATA *axis);<br />
	char roll_init(LNZ82_INVRT_DATA *axis);	<br />
	char lift_init(LNZ82_INVRT_DATA *axis);<br />
	char counterweight_init(LNZ82_INVRT_DATA *axis);<br />
<br />
<br />
<br />
	void   SetAddress( LNZ82_INVRT_DATA *axis, char address );		<br />
	char   GetAddress(  LNZ82_INVRT_DATA *axis );				<br />
	void   SetOperatingVoltage( LNZ82_INVRT_DATA *axis, int volts );	<br />
	char   GetOperatingVoltage(  LNZ82_INVRT_DATA *axis);		<br />
	bool   GetOutputVoltage( LNZ82_INVRT_DATA *axis, double *dTemp);			<br />
	bool   GetOutputCurrent( LNZ82_INVRT_DATA *axis, double *dTemp);			<br />
	bool   GetOutputFrequencey( LNZ82_INVRT_DATA *axis, double *dTemp);		<br />
	bool   GetOutputTemperature( LNZ82_INVRT_DATA *axis, double *dTemp);		<br />
	bool   GetBusVoltage( LNZ82_INVRT_DATA *axis, double *dTemp);			<br />
	bool   GetPoweronTime( LNZ82_INVRT_DATA *axis, double *dTemp);				<br />
	bool   GetOperatingTime( LNZ82_INVRT_DATA *axis, double *dTemp);			<br />
<br />
};<br />


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

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 
QuestionSimple GDI program Pin
Dustin Henry14-May-07 4:28
Dustin Henry14-May-07 4:28 
AnswerRe: Simple GDI program Pin
Arman S.14-May-07 5:40
Arman S.14-May-07 5:40 
GeneralRe: Simple GDI program Pin
Dustin Henry14-May-07 6:20
Dustin Henry14-May-07 6:20 
GeneralRe: Simple GDI program Pin
Arman S.14-May-07 6:57
Arman S.14-May-07 6:57 
AnswerRe: Simple GDI program [modified] Pin
Mark Salsbery14-May-07 5:56
Mark Salsbery14-May-07 5:56 
GeneralRe: Simple GDI program Pin
Dustin Henry14-May-07 6:17
Dustin Henry14-May-07 6:17 
GeneralRe: Simple GDI program Pin
Michael Dunn14-May-07 8:04
sitebuilderMichael Dunn14-May-07 8:04 
GeneralRe: Simple GDI program Pin
Mark Salsbery14-May-07 8:20
Mark Salsbery14-May-07 8:20 
Questionread xml with dataset Pin
lavy288314-May-07 4:18
lavy288314-May-07 4:18 
QuestionRe: read xml with dataset Pin
David Crow14-May-07 4:20
David Crow14-May-07 4:20 

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.