diff options
Diffstat (limited to 'docs/tutorials/Chap_7')
-rw-r--r-- | docs/tutorials/Chap_7/Chap_7.zip | bin | 4520 -> 0 bytes | |||
-rw-r--r-- | docs/tutorials/Chap_7/ex01.html | 90 | ||||
-rw-r--r-- | docs/tutorials/Chap_7/ex02.html | 165 | ||||
-rw-r--r-- | docs/tutorials/Chap_7/ex03.html | 158 |
4 files changed, 0 insertions, 413 deletions
diff --git a/docs/tutorials/Chap_7/Chap_7.zip b/docs/tutorials/Chap_7/Chap_7.zip Binary files differdeleted file mode 100644 index 0073e63d504..00000000000 --- a/docs/tutorials/Chap_7/Chap_7.zip +++ /dev/null diff --git a/docs/tutorials/Chap_7/ex01.html b/docs/tutorials/Chap_7/ex01.html deleted file mode 100644 index 59c8a3745d0..00000000000 --- a/docs/tutorials/Chap_7/ex01.html +++ /dev/null @@ -1,90 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 1</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "The Message Queue"</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#CC0000">//Example 1</FONT> -<BR><FONT COLOR="#000099">#include</FONT> "<FONT COLOR="#006600">ace/Message_Queue.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Get_Opt.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">SIZE_BLOCK -1</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">NO_MSGS -10</FONT> - -<P>class QTest{ -<BR>public: -<BR>QTest():no_msgs_(NO_MSGS){ -<BR> <FONT COLOR="#FF0000">//First create a message queue of default -size.</FONT> -<BR> if(!(this->mq_=new ACE_Message_Queue<ACE_NULL_SYNCH> ())) -<BR> ACE_DEBUG((LM_ERROR,"Error in message queue initialization \n")); -<BR> } -<BR> -<BR>int start_test(){ -<BR> for(int i=0; i<no_msgs_;i++){ -<BR> <FONT COLOR="#FF0000">//create a new message block of size 1</FONT> -<BR> ACE_Message_Block *mb= new ACE_Message_Block(SIZE_BLOCK);<FONT COLOR="#FF0000"></FONT> - -<P><FONT COLOR="#FF0000"> //Insert data into the message block using -the rd_ptr</FONT> -<BR> *mb->wr_ptr()=i; - -<P><FONT COLOR="#FF0000"> //Be careful to advance the wr_ptr</FONT> -<BR> mb->wr_ptr(1); - -<P> <FONT COLOR="#FF0000">//Enqueue the message block onto the message -queue</FONT> -<BR> if(this->mq_->enqueue_prio(mb)==-1){ -<BR> ACE_DEBUG((LM_ERROR,"\nCould not enqueue on to mq!!\n")); -<BR> return -1; -<BR> } -<BR> -<BR> ACE_DEBUG((LM_INFO,"EQd data: %d\n",*mb->rd_ptr())); -<BR> } <FONT COLOR="#FF0000">//end for</FONT> - -<P><FONT COLOR="#FF0000">//Now dequeue all the messages</FONT> -<BR>this->dequeue_all(); -<BR>return 0; -<BR> } - -<P>void dequeue_all(){ -<BR> ACE_DEBUG((LM_INFO,"\n\nBeginning DQ \n")); -<BR> ACE_DEBUG((LM_INFO,"No. of Messages on Q:%d Bytes on Q:%d \n",mq_->message_count(), -mq_->message_bytes())); -<BR> ACE_Message_Block *mb; - -<P> <FONT COLOR="#FF0000">//dequeue the head of the message queue -until no more messages are left</FONT> -<BR> for(int i=0;i<no_msgs_;i++){ -<BR> mq_->dequeue_head(mb); -<BR> ACE_DEBUG((LM_INFO,"DQd data %d\n",*mb->rd_ptr())); -<BR> } -<BR> } -<BR>private: -<BR> ACE_Message_Queue<ACE_NULL_SYNCH> *mq_; -<BR> int no_msgs_; -<BR>}; -<BR> - -<P>int main(int argc, char* argv[]){ -<BR> QTest test; -<BR> if(test.start_test()<0) -<BR> ACE_DEBUG((LM_ERROR,"Program failure \n")); -<BR>} - -<P> <A HREF="ex02.html">Next Example</A> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_7/ex02.html b/docs/tutorials/Chap_7/ex02.html deleted file mode 100644 index 3062e546994..00000000000 --- a/docs/tutorials/Chap_7/ex02.html +++ /dev/null @@ -1,165 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 2</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "The Message Queue"</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#CC0000">//Example 2</FONT><FONT COLOR="#000099"></FONT> - -<P><FONT COLOR="#000099">#include</FONT><FONT COLOR="#006600"> "ace/Message_Queue.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT><FONT COLOR="#006600"> "ace/Get_Opt.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> "<FONT COLOR="#006600">ace/Malloc_T.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">SIZE_BLOCK -1</FONT> - -<P>class Args{ -<BR>public: -<BR>Args(int argc, char*argv[],int& no_msgs, ACE_Message_Queue<ACE_NULL_SYNCH>* -&mq){ -<BR> ACE_Get_Opt get_opts(argc,argv,"h:l:t:n:xsd"); -<BR> while((opt=get_opts())!=-1) -<BR> switch(opt){ -<BR> case 'n': -<BR> <FONT COLOR="#FF0000"> //set the number of messages we -wish to enqueue and dequeue</FONT> -<BR> no_msgs=ACE_OS::atoi(get_opts.optarg); -<BR> ACE_DEBUG((LM_INFO,"Number of Messages %d \n",no_msgs)); -<BR> break; - -<P> case 'h': -<BR> <FONT COLOR="#FF0000">//set the high water mark</FONT> -<BR> hwm=ACE_OS::atoi(get_opts.optarg); -<BR> mq->high_water_mark(hwm); -<BR> ACE_DEBUG((LM_INFO,"High Water Mark %d msgs \n",hwm)); -<BR> break; -<BR> case 'l': -<BR> <FONT COLOR="#FF0000"> //set the low water mark</FONT> -<BR> lwm=ACE_OS::atoi(get_opts.optarg); -<BR> mq->low_water_mark(lwm); -<BR> ACE_DEBUG((LM_INFO,"Low Water Mark %d msgs \n",lwm)); -<BR> break; -<BR> default: -<BR> ACE_DEBUG((LM_ERROR, "Usage -n<no. messages> -h<hwm> --l<lwm>\n")); -<BR> break; -<BR> } -<BR> } - -<P>private: -<BR> int opt; -<BR> int hwm; -<BR> int lwm; -<BR>}; -<BR> -<BR> - -<P>class QTest{ -<BR>public: -<BR>QTest(int argc, char*argv[]){ -<BR><FONT COLOR="#FF0000"> //First create a message queue of default -size.</FONT> -<BR> if(!(this->mq_=new ACE_Message_Queue<ACE_NULL_SYNCH> ())) -<BR> ACE_DEBUG((LM_ERROR,"Error in message queue initialization \n")); -<BR> -<BR> <FONT COLOR="#FF0000">//Use the arguments to set the water marks -and the no of messages</FONT> -<BR> args_ = new Args(argc,argv,no_msgs_,mq_); -<BR> } -<BR>int start_test(){ -<BR> for(int i=0; i<no_msgs_;i++){ -<BR> <FONT COLOR="#FF0000">//Create a new message block of data buffer -size 1</FONT> -<BR> ACE_Message_Block * mb= new ACE_Message_Block(SIZE_BLOCK); -<BR> -<BR><FONT COLOR="#FF0000"> //Insert data into the message block using -the rd_ptr</FONT> -<BR> *mb->wr_ptr()=i; -<BR> -<BR> <FONT COLOR="#FF0000">//Be careful to advance the wr_ptr</FONT> -<BR> mb->wr_ptr(1); - -<P><FONT COLOR="#FF0000"> //Enqueue the message block onto the message -queue</FONT> -<BR> if(this->mq_->enqueue_prio(mb)==-1){ -<BR> ACE_DEBUG((LM_ERROR,"\nCould not enqueue on to mq!!\n")); -<BR> return -1; -<BR> } -<BR> -<BR> ACE_DEBUG((LM_INFO,"EQd data: %d\n",*mb->rd_ptr())); -<BR> } -<BR> <FONT COLOR="#FF0000">//Use the iterators to read</FONT> -<BR> this->read_all(); - -<P> <FONT COLOR="#FF0000">//Dequeue all the messages</FONT> -<BR> this->dequeue_all(); -<BR> return 0; -<BR> } - -<P>void read_all(){ -<BR> ACE_DEBUG((LM_INFO,"No. of Messages on Q:%d Bytes on Q:%d \n", -mq_->message_count(),mq_->message_bytes())); -<BR> ACE_Message_Block *mb; - -<P> <FONT COLOR="#FF0000">//Use the forward iterator</FONT> -<BR> ACE_DEBUG((LM_INFO,"\n\nBeginning Forward Read \n")); -<BR> ACE_Message_Queue_Iterator<ACE_NULL_SYNCH> mq_iter_(*mq_); -<BR> while(mq_iter_.next(mb)){ -<BR> mq_iter_.advance(); -<BR> ACE_DEBUG((LM_INFO,"Read data %d\n",*mb->rd_ptr())); -<BR> } -<BR> -<BR> <FONT COLOR="#FF0000">//Use the reverse iterator</FONT> -<BR> ACE_DEBUG((LM_INFO,"\n\nBeginning Reverse Read \n")); -<BR> ACE_Message_Queue_Reverse_Iterator<ACE_NULL_SYNCH> -<BR> mq_rev_iter_(*mq_); -<BR> while(mq_rev_iter_.next(mb)){ -<BR> mq_rev_iter_.advance(); -<BR> ACE_DEBUG((LM_INFO,"Read data %d\n",*mb->rd_ptr())); -<BR> } -<BR> -<BR> } - -<P>void dequeue_all(){ -<BR> ACE_DEBUG((LM_INFO,"\n\nBeginning DQ \n")); -<BR> ACE_DEBUG((LM_INFO,"No. of Messages on Q:%d Bytes on Q:%d \n", -mq_->message_count(),mq_->message_bytes())); -<BR> ACE_Message_Block *mb; - -<P><FONT COLOR="#FF0000"> //dequeue the head of the message queue -until no more messages are left</FONT> -<BR> for(int i=0;i<no_msgs_;i++){ -<BR> mq_->dequeue_head(mb); -<BR> ACE_DEBUG((LM_INFO,"DQd data %d\n",*mb->rd_ptr())); -<BR> } -<BR> } - -<P>private: -<BR> Args *args_; -<BR> ACE_Message_Queue<ACE_NULL_SYNCH> *mq_; -<BR> int no_msgs_; -<BR>}; -<BR> -<BR> - -<P>int main(int argc, char* argv[]){ -<BR> QTest test(argc,argv); -<BR> if(test.start_test()<0) -<BR> ACE_DEBUG((LM_ERROR,"Program failure \n")); -<BR> -<BR>} - -<P> <A HREF="ex03.html">Next Example</A> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_7/ex03.html b/docs/tutorials/Chap_7/ex03.html deleted file mode 100644 index 03b6dda63d6..00000000000 --- a/docs/tutorials/Chap_7/ex03.html +++ /dev/null @@ -1,158 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 3</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "The Message Queue"</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#CC0000">//Example 3</FONT> -<BR><FONT COLOR="#000099">#include</FONT> "<FONT COLOR="#006600">ace/Message_Queue.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> "<FONT COLOR="#006600">ace/Get_Opt.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> "<FONT COLOR="#006600">ace/OS.h"</FONT> - -<P>class Args{ -<BR>public: -<BR>Args(int argc, char*argv[],int& no_msgs, int& time,ACE_Message_Queue<ACE_NULL_SYNCH>* -&mq){ -<BR> ACE_Get_Opt get_opts(argc,argv,"h:l:t:n:xsd"); -<BR> while((opt=get_opts())!=-1) -<BR> switch(opt){ -<BR> case 't': -<BR> time=ACE_OS::atoi(get_opts.optarg); -<BR> ACE_DEBUG((LM_INFO,"Time: %d \n",time)); -<BR> break; -<BR> case 'n': -<BR> no_msgs=ACE_OS::atoi(get_opts.optarg); -<BR> ACE_DEBUG((LM_INFO,"Number of Messages %d \n",no_msgs)); -<BR> break; -<BR> case 'x': -<BR> mq=ACE_Message_Queue_Factory<ACE_NULL_SYNCH>:: create_laxity_message_queue(); -<BR> ACE_DEBUG((LM_DEBUG,"Creating laxity q\n")); -<BR> break; -<BR> case 'd': -<BR> mq=ACE_Message_Queue_Factory<ACE_NULL_SYNCH>:: create_deadline_message_queue(); -<BR> ACE_DEBUG((LM_DEBUG,"Creating deadline q\n")); -<BR> break; -<BR> case 's': -<BR> mq=ACE_Message_Queue_Factory<ACE_NULL_SYNCH>:: create_static_message_queue(); -<BR> ACE_DEBUG((LM_DEBUG,"Creating static q\n")); -<BR> break; -<BR> case 'h': -<BR> hwm=ACE_OS::atoi(get_opts.optarg); -<BR> mq->high_water_mark(hwm); -<BR> ACE_DEBUG((LM_INFO,"High Water Mark %d msgs \n",hwm)); -<BR> break; -<BR> case 'l': -<BR> lwm=ACE_OS::atoi(get_opts.optarg); -<BR> mq->low_water_mark(lwm); -<BR> ACE_DEBUG((LM_INFO,"Low Water Mark %d msgs \n",lwm)); -<BR> break; -<BR> default: -<BR> ACE_DEBUG((LM_ERROR,"Usage specify queue type\n")); -<BR> break; -<BR> } -<BR> } - -<P>private: -<BR> int opt; -<BR> int hwm; -<BR> int lwm; -<BR>}; -<BR> -<BR> - -<P>class QTest{ -<BR>public: -<BR>QTest(int argc, char*argv[]){ -<BR> args_ = new Args(argc,argv,no_msgs_,time_,mq_); -<BR> array_ =new ACE_Message_Block*[no_msgs_]; -<BR> } - -<P>int start_test(){ -<BR> for(int i=0; i<no_msgs_;i++){ -<BR> ACE_NEW_RETURN (array_[i], ACE_Message_Block (1), -1); -<BR> set_deadline(i); -<BR> set_execution_time(i); -<BR> enqueue(i); -<BR> } - -<P> this->dequeue_all(); -<BR> return 0; -<BR> } - -<P><FONT COLOR="#FF0000">//Call the underlying ACE_Message_Block method -msg_deadline_time() to set the deadline of the message.</FONT> -<BR>void set_deadline(int msg_no){ -<BR> float temp=(float) time_/(msg_no+1); -<BR> ACE_Time_Value tv; -<BR> tv.set(temp); -<BR> ACE_Time_Value deadline(ACE_OS::gettimeofday()+tv); -<BR> array_[msg_no]->msg_deadline_time(deadline); -<BR> ACE_DEBUG((LM_INFO,"EQd with DLine %d:%d\n", deadline.sec(),deadline.usec())); -<BR> } - -<P><FONT COLOR="#FF0000">//Call the underlying ACE_Message_Block method -to set the execution time</FONT> -<BR>void set_execution_time(int msg_no){ -<BR> float temp=(float) time_/10*msg_no; -<BR> ACE_Time_Value tv; -<BR> tv.set(temp); -<BR> ACE_Time_Value xtime(ACE_OS::gettimeofday()+tv); -<BR> array_[msg_no]->msg_execution_time (xtime); -<BR> ACE_DEBUG((LM_INFO,"Xtime %d:%d\n",xtime.sec(),xtime.usec())); -<BR> } - -<P>void enqueue(int msg_no){ -<BR><FONT COLOR="#FF0000"> //Set the value of data at the read position</FONT> -<BR> *array_[msg_no]->rd_ptr()=msg_no; -<BR><FONT COLOR="#FF0000"> //Advance write pointer</FONT> -<BR> array_[msg_no]->wr_ptr(1); -<BR><FONT COLOR="#FF0000"> //Enqueue on the message queue</FONT> -<BR> if(mq_->enqueue_prio(array_[msg_no])==-1){ -<BR> ACE_DEBUG((LM_ERROR,"\nCould not enqueue on to mq!!\n")); -<BR> return; -<BR> } -<BR> ACE_DEBUG((LM_INFO,"Data %d\n",*array_[msg_no]->rd_ptr())); -<BR> } - -<P>void dequeue_all(){ -<BR> ACE_DEBUG((LM_INFO,"Beginning DQ \n")); -<BR> ACE_DEBUG((LM_INFO,"No. of Messages on Q:%d Bytes on Q:%d \n", -mq_->message_count(),mq_->message_bytes())); -<BR> for(int i=0;i<no_msgs_ ;i++){ -<BR> ACE_Message_Block *mb; -<BR> if(mq_->dequeue_head(mb)==-1){ -<BR> ACE_DEBUG((LM_ERROR,'\nCould not dequeue from mq!!\n")); -<BR> return; -<BR> } -<BR> ACE_DEBUG((LM_INFO,"DQd data %d\n",*mb->rd_ptr())); -<BR> } -<BR> } -<BR>private: -<BR> Args *args_; -<BR> ACE_Message_Block **array_; -<BR> ACE_Message_Queue<ACE_NULL_SYNCH> *mq_; -<BR> int no_msgs_; -<BR> int time_; -<BR>}; - -<P>int main(int argc, char* argv[]){ -<BR> QTest test(argc,argv); -<BR> if(test.start_test()<0) -<BR> ACE_DEBUG((LM_ERROR,"Program failure \n")); -<BR> -<BR>} -<BR> -</BODY> -</HTML> |